Repository navigation
render: load GL string queries; qualify SDF occupancy on Windows/OpenGL - #4927
Conversation
GetGLAPI.py took the function name as the fourth token of each glcorearb.h prototype, which is the name only for `void APIENTRY`-shaped returns. glGetString and glGetStringi (`const GLubyte *APIENTRY`) were never loaded or injected, so their GL4API slots stayed null and the GL_NVX_gpu_memory_info lookup behind the SDF-RESIDENCY witness segfaulted every --sdf-voxel-scene auto-profile on OpenGL. The generator now takes the last token, the checked-in GLAPITrace.h gains the four missing lines, and GLApiLoader tests assert every dispatch slot loads. The profile runner records the Windows power source through GetSystemPowerStatus. OpenGL has no whole-frame GPU timer, so an explicit --allow-unsupported-gpu-frame lets an all-timing-off matrix accept runs whose report witnesses that, while timing-on runs supply GPU stage costs. The retained Windows/OpenGL slice holds 66 guarded clean Release runs across density, 16-copy overlap and root/parent motion, with the measured use cases and limits folded into the representation guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jakildev
left a comment
There was a problem hiding this comment.
Review — render: load GL string queries; qualify SDF occupancy on Windows/OpenGL
Verdict: approve
The loader fix is narrowly correct: taking the last token before the parameter list handles both void APIENTRY and pointer-returning GL prototypes, the checked-in table now loads and injects both string queries, and the new OpenGL-only regression test covers both the specific failure and completeness of the dispatch table. The profiling changes preserve the strict default gate; the opt-in exception requires an explicit supported=0 report, while the SDF matrix additionally confines it to timing-off cases.
The retained artifact is internally consistent: 66 runs cover 11 cases per arm over three rounds; every retained run is clean, guarded, fresh, and carries both SDF witnesses; timing-off is explicitly unmeasured and timing-on carries stage measurements. The documentation keeps NVX device-wide usage distinct from process residency and scopes the performance conclusions to this fixture and host.
Acceptance (issue #4762)
| Criterion | Grade | Basis |
|---|---|---|
| Presentation, lighting, and moving root/parent controls | met | The PR's first evidence row links the merged native presentation qualification, which crosses GRID, rigid DETACHED, and revoxelized root/parent poses under full and isolated-local lighting; this slice adds the OpenGL root/parent arms. |
| Bake coverage, admission, scratch accounting, and beyond-64³ input | met | SdfBake.* covers supported descriptors, invalid/oversized admission, exact output-plus-scratch budget boundaries, and a successful 65³ bake; the PR reports that suite passing on Windows. |
| Guarded AC Windows/OpenGL Release profiles across density, overlap, and motion | met | windows-gl-release-memory/runs.json contains two 33-run, three-round matrices spanning the 11 named cases. All runs are clean, guarded, fresh, configuration-stable, and carry both witnesses; the tables retain whole-frame, memory, NVX, and timing-on stage results while stating the backend's process-residency limitation. |
| Document measured use cases, limitations, invalidation, and no automatic migration | met | voxel-and-sdf-rendering.md records the measured selection boundary, invalidation/rebuild behavior, OpenGL counter limits, and the no-automatic-migration boundary. |
| Keep recipes/dynamic GPU baking as follow-ups; add no shape-specific shadow algorithm | met | The diff adds neither mechanism and retains both as follow-ups while continuing to use ordinary voxel lighting. |
Validation
- Focused reviewer run:
python3 -m unittest test_repeat_profile test_sdf_controls test_shape_profile— 78 tests passed. - Current-head CI at review time: comment refs, format, header checks, instruction size, closes lint, Python lint, whitespace, and change detection passed.
linux-build,fleet-tests, andperf-gatewere still pending, so this review does not claim those checks passed. - The author reports the OpenGL-specific C++ tests, GL-context suite, Debug/Release crash reproduction, and corrected clean runs on the Windows/OpenGL host; those host results are consistent with the retained evidence.
Praise
- The unsupported-timer escape hatch is positive-witnessed and opt-in instead of weakening the normal measurement gate.
- The write-up is careful not to mislabel device-wide NVX counters as per-process residency or over-generalize one fixture's timing result.
🤖 Reviewed by Codex (GPT-5, runtime codex; opus review class)
Opus recheck not required (reviewed at opus class).
|
Cross-host smoke OK on macos (fresh checkout + IRShapeDebug --auto-screenshot 10 — build clean, exit 0, no log warnings). |
Perf gateHead host slug: perf comparison: a3d54c9 → 0570dfb-cibaseline: host calibration
thresholds: regress ≥ 10%, improve ≥ 5% voxel cull effectiveness
frame timing (ms)
GPU frame timing (ms; separate from stage samples)
GPU stage timing (avg ms per sampled invocation)
top CPU systems by avg ms (head)
|
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
247.886 → 257.229 (+3.8%) |
| RENDER | ComputeLightVolume |
32.632 → 34.409 (+5.4%) |
| RENDER | CanvasToFramebuffer |
17.085 → 17.175 (+0.5%) |
| RENDER | BakeSunShadowMap |
9.662 → 10.347 (+7.1%) |
| RENDER | ComputeSunShadow |
7.624 → 7.593 (-0.4%) |
| UPDATE | PropagateTransform |
4.519 → 4.676 (+3.5%) |
| UPDATE | FogRevealEval |
4.190 → 4.342 (+3.6%) |
| RENDER | ComputeVoxelAO |
3.904 → 4.003 (+2.5%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1025.715 → 1028.135 (+0.2%) |
| RENDER | ComputeLightVolume |
29.338 → 29.237 (-0.3%) |
| RENDER | ComputeSunShadow |
21.864 → 21.770 (-0.4%) |
| RENDER | CanvasToFramebuffer |
15.908 → 16.128 (+1.4%) |
| RENDER | ComputeVoxelAO |
9.249 → 9.350 (+1.1%) |
| RENDER | BakeSunShadowMap |
8.417 → 8.490 (+0.9%) |
| RENDER | LightingToTrixel |
8.371 → 8.422 (+0.6%) |
| UPDATE | PropagateTransform |
4.405 → 4.578 (+3.9%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
288.688 → 292.972 (+1.5%) |
| RENDER | ComputeSunShadow |
55.366 → 56.133 (+1.4%) |
| RENDER | LightingToTrixel |
36.271 → 35.928 (-0.9%) |
| RENDER | ComputeLightVolume |
32.424 → 32.502 (+0.2%) |
| RENDER | BakeSunShadowMap |
22.377 → 23.036 (+2.9%) |
| RENDER | CanvasToFramebuffer |
17.441 → 17.264 (-1.0%) |
| RENDER | FogToTrixel |
7.107 → 7.098 (-0.1%) |
| UPDATE | PropagateTransform |
6.121 → 6.232 (+1.8%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1457.395 → 1458.686 (+0.1%) |
| RENDER | ComputeLightVolume |
29.173 → 28.990 (-0.6%) |
| RENDER | ComputeSunShadow |
18.725 → 18.125 (-3.2%) |
| RENDER | CanvasToFramebuffer |
16.205 → 16.015 (-1.2%) |
| RENDER | BakeSunShadowMap |
8.811 → 8.825 (+0.2%) |
| RENDER | ComputeVoxelAO |
8.092 → 7.817 (-3.4%) |
| RENDER | LightingToTrixel |
6.600 → 6.657 (+0.9%) |
| UPDATE | PropagateTransform |
6.104 → 6.098 (-0.1%) |
Summary
GetGLAPI.pyread the function name from the fourth token of eachglcorearb.hprototype. That is the name only forvoid APIENTRYreturns.glGetStringandglGetStringireturnconst GLubyte *APIENTRY, so they were never loaded or injected and theirGL4APIslots stayed null. TheGL_NVX_gpu_memory_infolookup inOpenGLRenderDevice::gpuMemoryStats(), which feeds theSDF-RESIDENCYwitness, then crashed (SIGSEGV) at the end of every--sdf-voxel-sceneauto-profile, in both Debug and Release.GLAPITrace.hgains the four missingINJECT/LOAD_GL_FUNClines.GLApiLoader.*tests check that every dispatch slot is requested and loaded.repeat_profile.pyreadshost_powerand battery state throughGetSystemPowerStatuson Windows. The manifests now recordAC Powerinstead ofnull.--allow-unsupported-gpu-frame(inrepeat_profile.pyandsdf_controls.py) accepts a run only when its report witnessesCoverage: supported=0, and recordsgpu_measured: false.sdf_controls.pyrefuses the flag unless every selected case is timing-off. The flag is off by default, so the strict gate is unchanged. The summary note no longer claims that timing-off cases keep a GPU envelope on every backend.docs/perf/sdf-voxel-profile/windows-gl-release-memory/:RESULT=CLEAN/QUIET=guarded, with both SDF witnesses.runs.jsonare retained.docs/design/voxel-and-sdf-rendering.md; the slice indexes andscripts/perf/README.mdare updated.test_repeat_profilepatchesos.getloadavgwithcreate=True, so it runs on native Windows.Test plan
fleet-build --release --target IRShapeDebugandfleet-build --target IrredenEngineTest --target IRShapeDebug: both built clean on Windows (MSYS2 mingw64).fleet-run IrredenEngineTest --gtest_filter='GLApiLoader.*:ProcessMemory.*:SdfBake.*':[ PASSED ] 12 tests.,RESULT=CLEAN.GLApiLoadertests fail ("GL4API slot 118 is never loaded", "slot 119"). The same Debug build's SDF scene also SIGSEGVs. With the lines restored, all 12 tests pass.fleet-run IrredenEngineTest --gtest_filter='*Gpu*:*GPU*:*OpenGL*:*Readback*':[ PASSED ] 56 tests.. These are the GL-context tests that dispatch through the same table.IRShapeDebug --auto-profile … --sdf-voxel-scene baked: before the fix,RESULT=CRASH … signal=SIGSEGVafter 6 s. After the fix,SDF-RESIDENCY … gpu_device_capacity_bytes=8589934592 …andRESULT=CLEAN.python3 -m unittest discover -s scripts/perf -p 'test_*.py': 144 tests. One error is pre-existing and unrelated:test_replay_attributionhitsWinError 1314because native Windows lacks symlink privilege.ruff check scripts/: all checks passed. clang-format-18 (WSL) ontest/render/gl_api_loader_test.cpp: no diff.python3 scripts/lint_comment_refs.py: ok.6d19cab1…, AC Power, Release).Acceptance evidence
fleet-run IrredenEngineTest --gtest_filter='…:SdfBake.*'on WindowsSdfBake.*passes inside the 12-test run. On OpenGL, baked asset and scratch bytes (62.4 / 434.1 KiB, 5.2 / 36.2 KiB) match the Metal slice byte for byte.sdf_controls.py --release --rounds 3 [--allow-unsupported-gpu-frame]× 11 timing-off and 11 timing-on casesAC Power, with bake µs, asset/scratch bytes, working-set final/peak deltas, NVX device used, steady mean/p95, and per-stage GPU ms. Timing-off is the instrumentation-off control. OpenGL exposes no process GPU residency (recorded as 0, unavailable). NVX is device-wide and does not resolve per-scene differences.git diff origin/master -- docs/design/voxel-and-sdf-rendering.mdPlan departures
## Plancomment. The 2026-11-01 decline scoped the remaining acceptance work to the Windows/OpenGL profile that render: measure SDF occupancy process and GPU memory #4832 left open; that is what this PR delivers.Notes for reviewer
engine/render/change loads two string-query pointers and has no visual effect (engine/render/CLAUDE.md, "Changes without a visual effect need no captures").GetGLAPI.pycan no longer regenerateGLAPITrace.hend to end: its stub writer crashes on the reformatted vendoredglcorearb.h. So the header was edited by hand to match the fixed generator's selection. A scripted check confirmed that everyfuncs_list.txtentry is now loaded, and every entry exceptglGetError(excluded by design) is injected. The new tests guard the loaded set, whatever produced the header.fleet-pr-overlapreportsVERDICT: overlap:scripts/perf/repeat_profile.pyandtest_repeat_profile.py, and both merge clean. It only addsIR_GATHER_FILTER_DIAGNOSTICto the render-experiment allowlist, with no semantic interaction.test/CMakeLists.txtand merge clean.base-conflictontest/CMakeLists.txt. Each conflicts with master5d93af97calone; this branch neither adds to nor touches those conflicts.QUIET=breachin round 3 and was rerun fresh.Closes #4762
🤖 Generated with Claude Code