fix(spectrum): make AETHER_NO_GPU select OpenGL backend on Windows (#3597)#3987
Conversation
…ethersdr#3597) AETHER_NO_GPU=1 only sets QT_OPENGL=software in main.cpp, but on Windows QRhiWidget defaults to the D3D11 backend and ignores QT_OPENGL, so the documented software-render escape hatch was a silent no-op there. On a weak GPU (reporter: GeForce GT 220) the spectrum still saturated the GPU via D3D11 with no runtime way to fall back. Force QRhiWidget::Api::OpenGL when software OpenGL is requested, so the software rasterizer set up in main.cpp actually drives the spectrum. The GLSL variants are already bundled in the .qsb shaders, so pipeline creation succeeds on the OpenGL backend. No change on Linux, whose default backend is already OpenGL. Note: this makes the flag functional; it does not by itself resolve the performance complaint on weak GPU+CPU hardware, for which an FFT-FPS throttle is tracked separately. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Clean, well-scoped fix. I traced the whole chain and it holds up:
- Premise confirmed.
main.cpp:87-88setsQT_OPENGL=softwareforAETHER_NO_GPU, but that's only an OpenGL-context hint — aQRhiWidgetwith nosetApi()does default to D3D11 on Windows and ignore it. So the flag really was a silent no-op there, exactly as described. - Correct placement. The
setApi()call sits in the#ifdef AETHER_GPU_SPECTRUM/ non-Q_OS_MACbranch, mirroring the existing macOSsetApi(Metal)a few lines up, and is called in the constructor before first show — the right point forQRhiWidget::setApi(). - Reuses the existing
qtSoftwareOpenGlRequested()helper (already used byrendererDescription()), so detection stays consistent with how the renderer reports itself. - No Linux regression. The branch also covers Linux, but its
QRhiWidgetbackend already defaults to OpenGL, so this is a harmless explicit restatement — good for keeping both platforms on one path.
I also checked the one dependency this introduces: the forced OpenGL backend + QT_OPENGL=software needs Qt's software rasterizer DLL present at runtime. .github/workflows/windows-installer.yml:127 runs windeployqt without --no-opengl-sw, so opengl32sw.dll is bundled by default. The dependency is satisfied on packaged builds. 👍
No AppSettings/RAII/lifetime concerns, and the file is the only one touched — scope matches the stated intent.
One note, not blocking: as you already call out, this makes the flag functional on Windows but won't help the #3597 reporter's perf complaint if their CPU is also weak — software-rasterizing the 60 fps per-pixel FFT pipeline just moves the saturation from GPU to CPU. Worth being explicit with @EA7JQA that the ask here is "does the panadapter render and does panstats renderer report software OpenGL," separate from the load question (the FFT-FPS cap tracked separately is the real lever for that).
Since the failure mode is Windows-only and unverifiable in CI/on Linux, reporter confirmation is the right gate before merge. Thanks for the clear writeup and the honest scoping, @motoham88.
🤖 aethersdr-agent · cost: $4.2941 · model: claude-opus-4-8
|
Well-researched root cause and honest scoping. Independent verification:
What @EA7JQA's test tells us: "the panadapter renders" with One piece missing for a clean Principle XI close: the Holding merge pending that confirmation. For future reference: comment block is 5 lines; AGENTS.md style is one short line max. The WHY here is non-obvious enough to warrant something, but it could be trimmed. Not a blocker. CI 6/6 green. Tier 3 only. Will revisit once the log line is confirmed. |
|
I'm not understanding this PR at all. Why would an env var to turn off the GPU ever invoke OpenGL? (which then invokes a GPU) Is this the right fix? As I understand it, the goal is to invoke a software renderer. |
ten9876
left a comment
There was a problem hiding this comment.
Clean, minimal fix for a real silent-no-op bug: setApi(OpenGL) under AETHER_GPU_SPECTRUM's non-Mac branch makes AETHER_NO_GPU/QT_OPENGL=software actually switch the QRhi backend to OpenGL on Windows (was defaulting to D3D11 regardless). Correctly guarded, uses the existing qtSoftwareOpenGlRequested() helper, right setApi timing, Linux is a harmless restatement. LGTM.
Summary
AETHER_NO_GPU=1is documented as the runtime escape hatch to force software rendering, but on Windows it is a silent no-op.main.cpponly setsQT_OPENGL=software, which is an OpenGL-context hint — but the spectrum is aQRhiWidgetthat has nosetApi()call on Windows, so it defaults to the D3D11 backend and ignoresQT_OPENGLentirely. There is no runtime path to move the spectrum off the GPU.This surfaced in #3597: on a weak GPU (reporter's GeForce GT 220, a 2009 DX10.1 part) the D3D11 QRhi spectrum + waterfall + overlay pipeline saturates the GPU (~89%), and setting
AETHER_NO_GPU=1changed nothing — confirmed by the reporter.Change
In the
SpectrumWidgetconstructor's non-macOS branch, when software OpenGL is requested (qtSoftwareOpenGlRequested()), explicitlysetApi(QRhiWidget::Api::OpenGL). Combined with theQT_OPENGL=softwareset inmain.cpp, this drives the spectrum through the software OpenGL rasterizer instead of D3D11..qsbshaders already contain GLSL variants (GLSL 100es/120/150 alongside SPIR-V/HLSL/MSL), so pipeline creation succeeds on the OpenGL backend.QRhiWidgetdefault backend is already OpenGL — this just makes the two platforms share one explicit code path.src/gui/SpectrumWidget.cpp— 1 file, ~10 lines (comment + guardedsetApi).Scope / what this does NOT claim
AETHER_NO_GPU=1flag functional on Windows (review suggestion PHONE applet: DEXP commands rejected on firmware v1.4.0.0 #1 from Serial CW keying stopped working, high CPU usage, and blurry panadapter on AetherSDR 26.6.3 #3597). It does not by itself resolve the performance complaint on weak GPU and CPU hardware — software-rendering a 60 fps per-pixel GPU FFT pipeline on a 2009 CPU will likely just move saturation from GPU to CPU. The proper lever for that (an FFT-FPS cap / present throttle, suggestion build(deps): Bump github/codeql-action from 3 to 4 #2) remains tracked separately.Testing
AETHER_NO_GPU=1and confirm the panadapter renders and the renderer reports the OpenGL/software backend (visible in panstatsrenderer), and to report the resulting CPU/GPU load.Refs #3597
🤖 Generated with Claude Code