Repository navigation
render: bound sun-face bake to feeder chunks - #5070
Conversation
jakildev
left a comment
There was a problem hiding this comment.
Review — render: bound sun-face bake to feeder chunks
Verdict: approve
Stacked on #5064 (claude/4956-sparse-store-clear-feeder-hiz-gates, fleet:approved, open). Reviewing the child diff only — upstream is approved separately.
Big picture: this does what #4962 asks. The finite sun-face bake gets its own copy of the frustum-only chunk mask (SunFaceChunkVisibilityBuffer), so the occlusion pre-pass that mutates ChunkVisibilityBuffer in place can no longer narrow it. Both kernels drop a rejected chunk before any per-voxel load, and the admitted-slot count is reported next to Visible and Total.
What I checked
- Mask sizing and tail math. In the non-detached branch
buildChunkVisibilityMaskreturnsgetChunkCount()entries. That isceil(liveVoxelCount/256), andeffectiveVoxelCount == liveVoxelCountthere becauserevoxInversetakes the first branch. SouploadMask.back()is the chunk holding the tail slot, and thesunFaceAdmittedCounttail subtraction is correct. ThetailSlots != 0 &&guard also protectsback()on an empty mask. - Detached and revoxelized domains. They upload the all-visible scratch to the new buffer and report
effectiveVoxelCount. That matches the doc paragraph and the PR body. - Kernel index bound.
chunkVisible[index / VOXEL_CHUNK_SIZE]only runs after theindex >= dispatch.xbound check. The buffer holdsmaxVoxelPoolChunkswords, the same as the original. - Binding hygiene.
bakeVoxelFacesbinds the new buffer atkBufferIndex_ChunkVisibility(24).chunkVisBuf_is rebound at 24 right after the bake, so later stage-1 consumers see their own mask again. The two shader declarations (GLSLbinding = 24, Metalbuffer(24)) match, andir_constants.{glsl,metal}both defineVOXEL_CHUNK_SIZE = 256. - GLSL/Metal parity. The two kernels carry the identical early-out in the same position.
shader-parityis green. - Test. I re-ran
python3 scripts/tests/test_render_fog_cut_voxel_faces.pyon this head. It passes for glsl and metal, and theignored_chunk_maskmutation is in the variant list. The adapter extracts the real gate line from the shader source rather than restating it, so the control tracks the shipped kernels.
CI state (head 1640336ab)
perf-gate: FAILURE, inherited. It fails at the link step of theIRPerfGridbuild:libjack.so: undefined reference to __cxa_call_terminate@CXXABI_1.3.15. That is a runner toolchain issue unrelated to this diff. The parent #5064 shows the same redperf-gateandall-checks. I do not hold it against this PR.linux-build,render-harness-tests,fleet-tests: stillIN_PROGRESS. These are unread, not green.- Green:
format-check,header-checks,shader-parity,comment-refs,instruction-refs,instruction-size,closes-lint,python-lint,no-plan-files,whitespace.
Acceptance (issue #4962), graded from the PR's evidence table
I did not dispatch review-acceptance. I graded from the PR's own table, so the per-criterion reading below is mine.
| # | Criterion | Reading |
|---|---|---|
| 1 | Admitted counter fires below live, equals live when all-visible | Met. Tight pose: 764,480 of 1,000,000. All-visible pose: 512 of 512. |
| 2 | Tight-pose record demand lower than parent | Unverifiable on this host. The probe produced no CSV. The executable kernel control covers "rejected chunk emits zero faces". |
| 3 | Cost follows admitted fraction | Partially evidenced. The ratio is 0.734 against a 0.914 bound, but it rests on one 120-frame head run against a 3×300 parent. The requested five interleaved pairs were not obtained. |
| 4 | Zoom-4 yaw 0/45 controls do not regress | Unverifiable on this host (#5052). |
| 5 | Same-session captures and occlusion validators | Unverifiable on this host (#5052). |
| 6 | Both dialects reject a non-admitted chunk; mutation and conventions pass | Met. Reproduced above. |
Each unverifiable row is attributed to the open #5052 display and lease instability rather than silently claimed, which is the honest shape. Criteria 4 and 5 are the ones that would catch a visual or perf regression on the default control poses, so the cross-host smoke lanes need to cover them.
Nits (follow-up)
engine/profile/src/profile_report.cpp:442— the newSunFaceAdmitrow has no direct assertion. The*ProfileReport*gtests pass, but none of them pins the row. A one-line check in the next test touch on that file would lock it.engine/prefabs/irreden/render/systems/system_voxel_to_trixel.hpp:1830— the twoif (voxelFaceBaker_ != nullptr)blocks repeat the guard. Nothing is wrong, since the buffer is only read when the baker exists. Folding the mask upload into a small helper would remove the duplicatedsubDatapair on the next pass over this function.
Test plan the author should run before merge
- Let
linux-build,render-harness-tests, andfleet-testsfinish green on this head. - On a stable-display host, run the criterion 4 and 5 captures (zoom-4 yaw 0/45 controls,
render-verify,light-verify) that were host-unverifiable.
Escalation: please Opus-recheck before merge (touches: engine/render, engine/prefabs/irreden/render).
🤖 Reviewed by Claude Sonnet (review-pr skill)
Opus recheck required: engine/render GPU path. A new GPU buffer is bound at the shared ChunkVisibility slot 24 and restored afterwards, and two compute kernels gained an early-out. I confirmed the binding handoff, the tail math, and the kernel parity by reading. The cross-frame buffer-binding lifetime and the sun-caster coverage argument need an Opus-class read: does the frustum-only feeder mask ever drop a chunk that casts into a visible receiver? Criteria 2 to 5 have no same-host evidence, so I am not confident enough to stamp this final.
jakildev
left a comment
There was a problem hiding this comment.
Opus recheck — render: bound sun-face bake to feeder chunks
Verdict: needs-fix
Stacked on #5064 (fleet:approved, open). Reviewing the child diff only; the upstream is approved separately. Head 1640336ab.
Sonnet asked: "does the frustum-only feeder mask ever drop a chunk that casts into a visible receiver?" On closer read, yes. In the default render path the mask this PR gates on is not widened toward the sun, so off-screen casters within the shadow throw stop casting.
Blocker: the gate mask has no sun sweep exactly when the gate is active
The chain, all at this head:
system_voxel_to_trixel.hpp:2549,beginTick:shadowFeederParams_ = voxelRasterFeederParams(voxelFaceBaker_ != nullptr);sun_shadow_constants.hpp:85(added by the parent #5064):voxelRasterFeederParams(true)returnsShadowFeederParams{}, sosweepDistance_ == 0. Its comment gives the reason: "Under finite face casting the sun bake reads pool faces and never the canvas depth an off-screen feeder deposits, so the raster admits no feeder ring at all."system_voxel_to_trixel.hpp:1795:chunkVp = shadowFeederCullViewport(kCullChunkMargin, shadowFeederParams_). With a zero sweep,IRMath::shadowFeederIsoBoundsreturns the visible viewport unchanged (ir_math.hpp:1480). SochunkVpis the visible cull viewport pluskCullChunkMargin = 8iso units.- This PR copies that same mask into
SunFaceChunkVisibilityBufferand the bake kernels return on it. The copy happens only undervoxelFaceBaker_ != nullptr, the same condition that zeroed the sweep in step 1. - Finite coverage is the default:
voxelFaceCoverage_ = true(system_bake_sun_shadow_map.hpp:199). It turns off only when a particle-to-trixel system is registered.
So whenever this gate runs, it admits visible+8 chunks, not visible widened by kSunShadowMaxDistance = 64 voxels along the sun. A caster up to 64 voxels toward the sun casts onto on-screen receivers, but at a typical sun its iso shift is far larger than 8 units. Any chunk in that band is now rejected before its faces reach the face index or the sampled layer. The visible symptom: shadows from casters just off-screen on the sun side vanish, and they pop in as the camera pans those casters into the margin.
The parent's zero-sweep decision was sound only because the bake read the whole pool. This PR removes that, so the parent's comment in step 2 becomes false once the two compose. The issue's own Scope defines the domain this needs: "the visible iso viewport widened along the sun by the shadow throw, kSunShadowMaxDistance". The plan's "Verified current state" bullet ("built from chunk iso bounds against the shadow-feeder viewport") describes master, where the sweep is live. #5064 changed that on this tree, and the issue's Dependencies section flagged #5064 for exactly this reason. The new paragraph in docs/design/sun-shadow-bake-coverage.md ("admits source slots through the frustum-only chunk mask built from the shadow-feeder viewport") has the same mismatch.
The criterion that would have caught this is 5: a same-session RGB-identical parent/head capture set. It is recorded as host-unverifiable. Criteria 1, 3 and 6 all pass on a too-narrow mask, because a narrower mask admits fewer slots and costs less.
Fix (mechanical, in scope): build the sun-face mask from the widened viewport, shadowFeederCullViewport(kCullChunkMargin, IRPrefab::SunShadow::frameShadowFeederParams()). Resolve those params once in beginTick beside shadowFeederParams_, not per canvas. The raster mask keeps its zero-sweep viewport. buildChunkVisibilityMask returns a reference to one thread_local vector, so a second call overwrites the first result. Either upload chunkVisBuf_ before the second call, or test both viewports in one bounds pass so rebuildChunkBounds runs once. Then:
- Recompute
sunFaceAdmittedCountfrom the widened mask. That is the number criterion 1 reports. - Re-take criteria 1 and 3. The admitted fraction will rise, and the 0.914 bound moves with it.
- Correct the design-doc paragraph so it names the sun-swept viewport and says it differs from the raster's.
Positive-fire control to add: extend an existing render gtest, or the kernel adapter suite, with a case that fails on this head. Put a chunk outside the visible+margin viewport, within the 64-voxel throw on the sun side, and assert the sun-face mask admits it. Then mutate the sun-face viewport back to shadowFeederParams_ and confirm the case fails by name. The ignored_chunk_mask mutation only proves the kernel reads the mask. It cannot see which mask was built.
Confirmed from the Sonnet pass
- Tail math and the
back()guard: correct for the mask lengthgetChunkCount() == divCeil(effectiveVoxelCount, 256)in the world branch. It stays correct once the widened mask replaces the current one, since that mask has the same length. - Binding handoff: the bake binds
SunFaceChunkVisibilityBufferat 24 insidebakeVoxelFaces, andchunkVisBuf_is rebound at 24 right after (:2134), before the compact and the occlusion pre-pass bind their own inputs. The plan's Metal gotcha (bindings don't persist across program switches) is honored. Per-canvassubDatainto one shared buffer follows the same patternchunkVisBuf_already uses, so it adds no new cross-canvas hazard. - The two upload and bake sites share one
voxelFaceBaker_ != nullptrguard.voxelFaceBaker_is assigned only inbeginTick, so a bake never reads a mask that was skipped for this canvas. - Detached and revoxelized canvases stay all-visible. GLSL and Metal gates are identical.
VOXEL_CHUNK_SIZEmatcheskVoxelChunkSize.
Nits (carry forward from Sonnet, unchanged)
profile_report.cpp:442: theSunFaceAdmitrow has no direct test assertion.system_voxel_to_trixel.hpp:1830/1853: the duplicatedvoxelFaceBaker_guard and upload pair. This is worth folding into one helper when the widened-mask build lands there.
CI
perf-gate red at the IRPerfGrid link step (libjack.so __cxa_call_terminate@CXXABI_1.3.15), inherited from the parent. Not held against this PR.
🤖 Reviewed by Claude Opus (review-pr skill, Opus recheck)
|
Addressed feedback:
— Codex worker (GPT-5) |
jakildev
left a comment
There was a problem hiding this comment.
Re-review — render: bound sun-face bake to feeder chunks
Verdict: approve (Opus recheck required, see the footer)
Stacked on #5064 (fleet:approved, open). Reviewing the child diff only — upstream is approved separately. Delta-scoped re-review of 1640336ab..441c79b63 against the Opus needs-fix on 1640336ab.
Prior-review resolution
- ✅ Blocker, gate mask had no sun sweep (
system_voxel_to_trixel.hpp,chunkVpfromshadowFeederParams_) — verified fixed at441c79b.beginTick(:2576) now resolvessunFaceFeederParams_ = frameShadowFeederParams()once per frame, andshadowFeederParams_is zero-sweep only undervoxelFaceBaker_ != nullptr. That matches the oldvoxelRasterFeederParams(voxelFaceBaker_ != nullptr)for the raster. The per-canvas tick buildssunFaceChunkVpfromsunFaceFeederParams_(:1817) and a secondbuildChunkVisibilityMaskcall from it (:1874). The raster mask and itschunkVisBuf_upload keep the visible-only viewport. - ✅
thread_localmask overwrite hazard — verified safe.uploadMaskis last read at:1871, before the second call returns the same vector.sunFaceMaskis consumed immediately byuploadSunFaceChunkMask. The identical-args second call hits therebuildChunkBoundsdirty check, so bounds are not rebuilt. - ✅
sunFaceAdmittedCountrecomputed from the widened mask (:1883). The all-visible branch now goes through the same helper, and the tail math giveseffectiveVoxelCountthere (admittedChunkCount == chunkWords, last word is 1). That is the same value as before. - ✅ Design doc paragraph — now names the sun-swept viewport and says it differs from the raster's (
docs/design/sun-shadow-bake-coverage.md). - ✅ Nit
profile_report.cpp:442(noSunFaceAdmitassertion) —ProfileReportVoxelCull.SunFaceAdmittedRowCarriesAverageMaximumAndSamplespins the row. - ✅ Nit, duplicated guard/upload pair — folded into
uploadSunFaceChunkMask. Theback()-on-empty hazard stays covered:tailSlots != 0implies a non-empty mask. - ↗ Criteria 1, 3, 4, 5 (same-session captures and perf pairs) — still host-unverifiable (
RESULT=NO-DISPLAY, #5052). The PR body withdraws the superseded narrow-mask figures, so no stale numbers carry forward. Step-5c smoke labels cover the lane.
Nits (follow-up)
test/ecs/chunk_bounds_eviction_test.cpp:137—SunFaceMaskAdmitsCasterInsideShadowThrowexercisesbuildChunkVisibilityMaskwith two hand-built viewports, so it would also pass on the pre-amend head. Reverting the sun-face mask toshadowFeederParams_in the system tick would not fail it by name, which is the mutation the prior review asked the control to catch. It proves the widened viewport admits the caster, not that the tick feeds that viewport to the sun-face mask. Extracting the choice into a small helper that the test and the tick both call (for examplesunFaceChunkViewport(margin, params)) would close it. I left this for Opus to judge as nit or needs-fix, since it decides whether the prescribed control is met.engine/prefabs/irreden/render/sun_shadow_constants.hpp:85—voxelRasterFeederParamsnow has no caller (beginTickopen-codes the ternary). Either call it, or drop it and update thedocs/design/voxel-feeder-split.md:249reference.
CI state (head 441c79b63)
- Green:
format-check,header-checks,shader-parity,comment-refs,instruction-refs,instruction-size,closes-lint,python-lint,no-plan-files,whitespace. linux-build,render-harness-tests,fleet-testsandperf-gate: pending on this head, so unread, not green. The parent'sperf-gatewas red at thelibjack.solink step on the earlier head, a runner-toolchain issue unrelated to this diff.- I did not run a build or test myself. The author's
IrredenEngineTestbuild and 39 focused gtests, the fog-cut suite, parity and header checks are cited from the PR body only.
Escalation: please Opus-recheck before merge (touches: engine/prefabs/irreden/render, sun-shadow bake, GPU chunk-mask binding).
🤖 Reviewed by Claude Sonnet (review-pr skill)
Opus recheck required: this amend answers an Opus needs-fix on the render sun-shadow gate. I confirmed the wiring and mask lifetime by reading, but the display-backed criteria are unverifiable. Also needs a judgement on whether the unit control meets the mutation requirement (nit above).
Perf gateHead host slug: perf comparison: 7c08741 → eac8b2f-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)Window rows on one side and exclusive rows on the other measure different things, so these cells carry no stage marks:
top CPU systems by avg ms (head)
|
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
258.186 → 290.566 (+12.5%) ⚠ |
| RENDER | ComputeLightVolume |
42.093 → 43.514 (+3.4%) |
| RENDER | ComputeSunShadow |
8.886 → 26.379 (+196.9%) ⚠ |
| RENDER | CanvasToFramebuffer |
21.871 → 20.573 (-5.9%) ↓ |
| RENDER | BakeSunShadowMap |
10.411 → 9.960 (-4.3%) |
| UPDATE | PropagateTransform |
5.175 → 5.769 (+11.5%) ⚠ |
| UPDATE | FogRevealEval |
5.008 → 4.813 (-3.9%) |
| RENDER | ComputeVoxelAO |
3.926 → 4.248 (+8.2%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1099.483 → 994.315 (-9.6%) ↓ |
| RENDER | ComputeSunShadow |
24.535 → 49.562 (+102.0%) ⚠ |
| RENDER | ComputeLightVolume |
39.483 → 40.009 (+1.3%) |
| RENDER | CanvasToFramebuffer |
20.548 → 19.480 (-5.2%) ↓ |
| RENDER | ComputeVoxelAO |
8.641 → 9.515 (+10.1%) ⚠ |
| RENDER | LightingToTrixel |
9.023 → 9.458 (+4.8%) |
| RENDER | BakeSunShadowMap |
9.093 → 8.622 (-5.2%) ↓ |
| UPDATE | PropagateTransform |
4.869 → 5.816 (+19.4%) ⚠ |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
276.966 → 318.572 (+15.0%) ⚠ |
| RENDER | ComputeSunShadow |
42.505 → 51.549 (+21.3%) ⚠ |
| RENDER | ComputeLightVolume |
40.970 → 42.574 (+3.9%) |
| RENDER | LightingToTrixel |
25.716 → 24.308 (-5.5%) ↓ |
| RENDER | CanvasToFramebuffer |
21.682 → 21.408 (-1.3%) |
| RENDER | BakeSunShadowMap |
13.045 → 13.016 (-0.2%) |
| UPDATE | PropagateTransform |
6.438 → 6.744 (+4.8%) |
| RENDER | FogToTrixel |
5.843 → 5.625 (-3.7%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1535.741 → 1501.700 (-2.2%) |
| RENDER | ComputeSunShadow |
20.850 → 71.196 (+241.5%) ⚠ |
| RENDER | ComputeLightVolume |
38.296 → 43.675 (+14.0%) ⚠ |
| RENDER | CanvasToFramebuffer |
20.398 → 19.005 (-6.8%) ↓ |
| RENDER | BakeSunShadowMap |
9.056 → 8.539 (-5.7%) ↓ |
| RENDER | ComputeVoxelAO |
7.156 → 7.903 (+10.4%) ⚠ |
| RENDER | LightingToTrixel |
7.408 → 7.717 (+4.2%) |
| UPDATE | PropagateTransform |
6.497 → 6.451 (-0.7%) |
jakildev
left a comment
There was a problem hiding this comment.
Opus recheck: render: bound sun-face bake to feeder chunks (semantic-conflict rebase)
Verdict: approve
The PR is standalone on master (parent #5064 merged). Head 2b9acadd6 rebases the two PR-only commits onto master's deterministic three-pass sun-record admission (#5063). The last Opus approval was on 441c79b63. This recheck covers the one new piece of executable logic: how the chunk gate composes with count → scan → bake. The C++ mask construction is the code the last Opus pass approved, carried over by the rebase.
Sonnet's open item: count/bake mismatch at runtime
Sonnet confirmed barrier reach and the single binding by reading. It flagged that no runtime run exists to catch a count/bake mismatch. On closer read I confirm the mismatch cannot happen, and the reason is structural, so it does not depend on a runtime run:
- Same predicate, same inputs, every pass. Passes 0 and 2 are the same kernel.
activeVoxelfolds the chunk test in right after the range test (c_bake_voxel_sun_faces.glsl:103,.metal:92).recordMaskdepends only onactiveVoxel, the voxel loads, the fog window andFrameDataSun, and none of those change between pass 0 and pass 2.chunkVisibilityis bound once at slot 24 before pass 0 (system_bake_sun_shadow_map.hpp:1253). Nothing writessunFaceChunkVisBuf_between the threedispatchComputecalls: its onlysubDataruns in the per-canvas tick beforebakeVoxelFaces. So pass 2 writes exactly the records pass 0 counted, and the prefix allocation stays exact. - Barrier uniformity. A rejected lane is inactive, not returned, so every lane reaches both
barrier()/threadgroup_barriercalls. Pass 0 still writesadmissionScratch[group]for every group, zero for a fully rejected group. That meets the steward's A1 rule that pass 1 sums every slot and nothing clears it between frames. The only early returns, theadmission.x == 1scan and the pass-0 tail, are uniform across the workgroup. - Cross-canvas buffer reuse on Metal. I checked this beyond the last recheck.
sunFaceChunkVisBuf_is patched per canvas while the previous canvas's bake may still be queued in the same uncommitted command buffer.MetalBufferImpl::subDataRanges(metal_buffer.cpp:97-117) sends a write to an already-encoded buffer throughreplaceBacking(full size) orstagePatch(a GPU-timeline blit). Either way the earlier encoder reads its own canvas's bytes. GL ordersglBufferSubDataagainst prior reads implicitly. The buffer is shader read-only, so the NVIDIA "subData into a buffer a queued shader wrote" stall inengine/render/CLAUDE.mddoes not apply. - Index bound.
chunkVisible[index / 256]is reached only forindex < dispatch.x == effectiveVoxelCount. The upload coversdivCeil(effectiveVoxelCount, 256)words in both branches, and the buffer holdsmaxVoxelPoolChunks. That is the same boundchunkVisBuf_already relies on for the same count.
Run here (macOS, head 2b9acadd6)
fleet-build --target IrredenEngineTest: exit 0.fleet-run IrredenEngineTest --gtest_filter=ChunkBoundsEvictionTest.*:ProfileReport*.*: 39 passed,RESULT=CLEAN. This includesSunFaceMaskAdmitsCasterInsideShadowThrowandProfileReportVoxelCull.SunFaceAdmittedRowCarriesAverageMaximumAndSampleson the rebased tree. The PR body listed these as pre-rebase only.python3 scripts/tests/test_render_sun_record_capacity.py: OK. Each dialect passed 12 retention orders and 6 grown-capacity controls.python3 scripts/tests/test_render_fog_cut_voxel_faces.py: OK, 40,296 retained-solid rays per dialect,ignored_chunk_maskmutation included.python3 scripts/shader_parity_audit.py: clean (149 GLSL / 138 Metal).
CI (head 2b9acadd6)
- Green:
linux-build,perf-gate,fleet-tests,format-check,header-checks,shader-parity,comment-refs,instruction-refs,instruction-size,closes-lint,python-lint,no-plan-files,whitespace,gate. - Red:
render-harness-tests(andall-checks), inherited. The one failing suite istest_harness_dependency_contract.py(130/131 pass). It fails onscripts/verify_common.pyimportingfleet, which master7944324d2(#5078) added.render-harness-testsfails on that master commit too, and #5088 tracks it. This PR's only script change is the fog-cut adapter, which adds no import. Not held against this PR.
Acceptance (#4962)
My reading matches Sonnet's table. Criterion 6 is met, now including the record-capacity suite that A1 added. Criteria 1 and 2 have their domain and kernel halves met. Criteria 3–5 are host-unverifiable (#5052), and the superseded narrow-mask figures are correctly withdrawn. fleet:needs-windows-smoke carries the off-screen sun-side caster capture and the zoom-4 yaw 0/45 pair.
Nits (follow-up)
engine/prefabs/irreden/render/sun_shadow_constants.hpp:85:voxelRasterFeederParamsis still uncalled now that #5064 is on master, becausebeginTickopen-codes the ternary. Either call it (shadowFeederParams_ = voxelRasterFeederParams(voxelFaceBaker_ != nullptr)) or drop it and fix thedocs/design/voxel-feeder-split.md:249reference. Carried from the last recheck.scripts/tests/test_render_sun_record_capacity.pydoes not model the lane predicate, so the count/bake agreement under the chunk gate is pinned by structure, not by a control. A future adapter that runs pass 0 and pass 2 over one lane set with a half-rejected workgroup would lock it. Not needed for this PR.- On Metal, the per-canvas sun-face mask write to an already-encoded buffer costs one extra blit encoder per canvas per frame, the same as
chunkVisBuf_already does. It is small, but the PR body's "adds no GPU dispatch" claim leaves it out. The criterion-3/4 perf pair on a display host will show whether it matters.
🤖 Reviewed by Claude Opus (review-pr skill, Opus recheck)
The stack below this branch (#5064, #5070) has merged, so the branch is rebased onto master and every reading is retaken against it: the interleaved timing series (now series-3, replacing series-1 and series-2, which measured the old stack base), the 45-degree stage profiles, the census and rejection counts, the base/head capture identity, and the late-pose GUI fixtures (criteria 10-13). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aw (#4954) (#5084) * render: reject hidden overflow-lane faces before sort, relight and draw The per-axis overflow lane held every exposed face that lost its cardinal store cell, and the sort, the relight, the fog pass and the scatter draw all sized their work from it. On the million control at 45 degrees that is 2.36 million records, of which about 1,500 own a framebuffer pixel. Stage 1 now draws the faces that won their store cells into the main framebuffer's depth, reduces that depth to a block-maximum pyramid, and tests each overflow candidate's whole projected footprint against it before appending. A face is rejected only when no pixel centre falls in its footprint, or every occluder over it is nearer by more than one tie band, so the image is unchanged. The append is its own compiled variant of the stage-1 body; the store kernel no longer carries it. The test and the draw must project a face at the same place, so the scatter placement is computed by one function. Stage 1 derives it ahead of the composite; a frame that rejected is drawn with that value. When a system writes the camera between the two, or a glitch subject can blank a store cell, the append keeps every candidate. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * docs: record the overflow-lane rejection counts and timings Adds the measurement document for the overflow-lane rejection: how many lane faces own a pixel, what the append rejects, two series of interleaved base/head timing pairs with their reports and manifests, the per-stage split at 45 degrees, and the capture comparison. Adds the matching row to the optimize skill's big-wins reference. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * render: opt the late-pose GUI fixtures out of overflow rejection The GUI-test cyclers that IRShapeDebug splices ahead of the composite write each shot's pose between VOXEL_TO_TRIXEL_STAGE_1 and TRIXEL_TO_FRAMEBUFFER, outside the camera ordering contract. --gui-test, --continuous-zoom-gui-test and --rotation-pick-test gui now keep the full overflow lane for the whole run, so the frame a pose lands on draws as the base does. - setOverflowRejectionEnabled returns whether it took effect; the demo asserts it, because the setter changes nothing before the voxel system exists. - Stage 1 logs the first rotating frame's rejection verdict once per run. - GuiTestConfig::capturePoseWriteFrame_ (IRShapeDebug --capture-pose-write-frame) adds a capture of each pose-write frame. - IRShapeDebug --late-camera-write-test writes the yaw in that slot on scheduled frames and checks the latch, a refill inside the stand-down and a second latch after it expires. - The camera row of the render ordering table now puts camera controls before VOXEL_PICKING / VOXEL_TO_TRIXEL_STAGE_1; the design doc states the contract, the fixture opt-outs and the recovery boundary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: retake the overflow-lane rejection evidence on master 345dbbf The stack below this branch (#5064, #5070) has merged, so the branch is rebased onto master and every reading is retaken against it: the interleaved timing series (now series-3, replacing series-1 and series-2, which measured the old stack base), the 45-degree stage profiles, the census and rejection counts, the base/head capture identity, and the late-pose GUI fixtures (criteria 10-13). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: grade the perf-HUD pose-write frame with its graph masked The --gui-test perf_hud_closed pose-write frame differs between any two runs, base against base included, only inside the HUD's frame-time graph, which plots wall-clock timings. Record the graph's opaque rectangle and the masked max-delta-0 comparison that passes on two independent base/head run pairs (#4954 criterion 10). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Summary
SunFaceAdmit, with direct profile-row and off-screen-caster controls.Performance
The original head measured 2.105 ms at 764,480 / 1,000,000 admitted slots, but review found that mask was too narrow and excluded valid off-screen casters. Those figures are superseded and are not evidence for this head. A fresh runtime matrix is host-unverifiable:
light-verify --if-changedreached Metal capture setup and then exited 69 withRESULT=NO-DISPLAY(Discovered 0 display monitors), the open macOS verification instability tracked by #5052.Static hot-path review: the amendment resolves the sun direction once per frame, adds no per-voxel CPU work or GPU dispatch, reuses the existing chunk-bounds cache and mask staging storage, and performs the additional mask construction only while finite face casting is active. After the semantic-conflict rebase, the mask predicate participates in master's existing
activeVoxellane predicate so rejected lanes still reach the deterministic admission pass's workgroup barriers with zero records.Test plan
fleet-build --target IRShapeDebug(rebased head2b9acadd6, exit 0)python3 scripts/tests/test_render_fog_cut_voxel_faces.py(GLSL + Metal; 40,296 retained-solid rays per dialect, includingignored_chunk_maskmutation)python3 scripts/shader_parity_audit.py(149 GLSL, 138 Metal, 5 allowlisted)fleet-build --target IrredenEngineTest(detached job20261112T112107Z-build-93d784, exit 0)fleet-run --timeout 180 IrredenEngineTest '--gtest_filter=ChunkBoundsEvictionTest.*:ProfileReport*.*'(39 passed)fleet-build --target header-checkspython3 scripts/light-verify.py --if-changed(unverifiable on this host: detached job20261112T111952Z-light-verify-3a83bfexited 69,RESULT=NO-DISPLAY; render: run #4959's base/head render rows and sort-cost pairs, unverified at PR #5020's merge #5052)Acceptance evidence
ChunkBoundsEvictionTest.SunFaceMaskAdmitsCasterInsideShadowThrow;ProfileReportVoxelCull.SunFaceAdmittedRowCarriesAverageMaximumAndSamples; runtime matrixtest_render_fog_cut_voxel_faces.py; live index probelight-verify --if-changedIRLightingEmissive, saved 23 captures, then exited 69 withRESULT=NO-DISPLAY; no visual verdict is claimed. #5052 tracks the host instability.ignored_chunk_mask; parity passed. The new C++ positive control distinguishes the correct sun-swept mask from the raster viewport.Plan departures
Closes #4962