Repository navigation
render: draw images into the main framebuffer at pixel resolution - #5142
Conversation
A canvas-draw image is sampled once per canvas texel, and a texel is two framebuffer pixels wide, so an image on a layer canvas keeps half its horizontal detail. queueFramebufferImage draws the same loaded image straight into the main framebuffer, one sample per pixel, where the glitch pass and the recorder still see it. IMAGE_TO_FRAMEBUFFER runs after TRIXEL_TO_FRAMEBUFFER and draws each queued image as a depth-tested quad. The fragment writes the depth the composite gives a canvas texel of the same distance, plus half an encode step, so the canvas-draw depth constants keep their meaning: canvas text at the image's distance or nearer covers it, and a world voxel occludes a BEHIND image. The crop, mosaic, posterize and tint options are the canvas path's, with the box and cell in framebuffer pixels. The image filter moved out of c_canvas_image_to_trixel into a shared include that the new fragment shader also uses, so both paths resolve a crop the same way; the canvas sample's reference is unchanged. Lua gets IRCanvas.framebufferImage and IRCanvas.framebufferSize. The GLSL side has not been run on an OpenGL host. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Perf gateHead host slug: perf comparison: 9e35941 → cd0bb58-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 |
219.304 → 216.864 (-1.1%) |
| RENDER | ComputeLightVolume |
26.211 → 25.048 (-4.4%) |
| RENDER | CanvasToFramebuffer |
14.693 → 14.445 (-1.7%) |
| RENDER | ComputeSunShadow |
12.666 → 12.669 (+0.0%) |
| UPDATE | FogRevealEval |
7.427 → 8.497 (+14.4%) ⚠ |
| RENDER | BakeSunShadowMap |
5.992 → 5.929 (-1.1%) |
| UPDATE | PropagateTransform |
3.715 → 4.079 (+9.8%) |
| UPDATE | LuaWaveStateToOffset |
2.939 → 2.750 (-6.4%) ↓ |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
719.964 → 717.133 (-0.4%) |
| RENDER | ComputeSunShadow |
26.039 → 25.756 (-1.1%) |
| RENDER | ComputeLightVolume |
22.266 → 23.009 (+3.3%) |
| RENDER | CanvasToFramebuffer |
13.799 → 13.860 (+0.4%) |
| UPDATE | FogRevealEval |
7.552 → 7.097 (-6.0%) ↓ |
| RENDER | ComputeVoxelAO |
6.645 → 6.657 (+0.2%) |
| RENDER | LightingToTrixel |
5.013 → 5.209 (+3.9%) |
| RENDER | BakeSunShadowMap |
5.063 → 5.203 (+2.8%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
234.552 → 235.887 (+0.6%) |
| RENDER | ComputeSunShadow |
34.668 → 34.713 (+0.1%) |
| RENDER | ComputeLightVolume |
23.793 → 24.024 (+1.0%) |
| RENDER | LightingToTrixel |
18.714 → 18.717 (+0.0%) |
| RENDER | CanvasToFramebuffer |
14.805 → 14.481 (-2.2%) |
| RENDER | BakeSunShadowMap |
7.977 → 8.142 (+2.1%) |
| UPDATE | FogRevealEval |
6.797 → 7.560 (+11.2%) ⚠ |
| UPDATE | PropagateTransform |
4.687 → 4.848 (+3.4%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1094.359 → 1094.766 (+0.0%) |
| RENDER | ComputeSunShadow |
34.468 → 33.909 (-1.6%) |
| RENDER | ComputeLightVolume |
24.906 → 23.938 (-3.9%) |
| RENDER | CanvasToFramebuffer |
13.381 → 13.495 (+0.9%) |
| UPDATE | FogRevealEval |
7.813 → 7.508 (-3.9%) |
| RENDER | ComputeVoxelAO |
5.560 → 5.585 (+0.4%) |
| RENDER | BakeSunShadowMap |
5.213 → 5.272 (+1.1%) |
| UPDATE | PropagateTransform |
4.663 → 4.782 (+2.6%) |
jakildev
left a comment
There was a problem hiding this comment.
Review — render: draw images into the main framebuffer at pixel resolution
Verdict: needs-fix
The implementation, backend twins, depth ordering, and new C++/Lua coverage look sound, but the current head does not have a green required check.
Needs-fix
- Current-head
fleet-testsfailed intest_fleet_claim_acquire_race.shandtest_fleet_claim_cross_lane.sh; the exact base commit's Fleet Tests run is green. Please rerun the failed workflow to obtain a clean head result, and investigate the claim-race failures if they reproduce.linux-buildis also still pending, so it is unread rather than green.
Praise
System<IMAGE_TO_FRAMEBUFFER>preserves painter order at equal depth by walking the queue in reverse under the existing strict depth test, while still letting encoded distance arbitrate different-depth draws.- The shared sampling include keeps the canvas and framebuffer paths aligned, with explicit GLSL/Metal twins and layout assertions for the 96-byte frame block.
Checked
- Read the complete PR thread, inline-comment stream, timeline, and all changed files at head
e1a6a6453b954566589bfc7d237d4d5caa36c21c; there are no prior reviews, comments, linked closing issues, or stack base. fleet-build --detach --target IrredenEngineTest: terminal resultfleet-jobs: 20261117T193736Z-build-0edb3b succeeded exit=0on macOS.fleet-run IrredenEngineTest --gtest_filter='FramebufferImageTest.*:LuaFramebufferImageTest.*:LuaPipelineRegisterTest.SystemNameEnumBound': 15/15 passed.- Inspected the committed macOS Metal reference: pixel-detail preservation, crop/mosaic/posterize/tint, world occlusion, canvas-text overlay, and equal-depth later-draw behavior are visually represented as described.
- Current CI: shader parity, render harness, perf gate, formatting, headers, instruction checks, closes lint, and whitespace pass; Fleet Tests fails; Linux build is pending.
Test plan the author should run before merge
- Rerun the failed Fleet Tests workflow and confirm both claim-race suites pass.
- Confirm
linux-buildcompletes successfully; OpenGL runtime smoke remains cross-host debt.
🤖 Reviewed by Codex (GPT-5), opus-class review-pr pass
Opus recheck not required (reviewed at opus class).
|
Addressed feedback:
— worker (pool-5) |
jakildev
left a comment
There was a problem hiding this comment.
Review — render: draw images into the main framebuffer at pixel resolution
Verdict: approve
The prior CI-only send-back is resolved on the unchanged head; no substantive finding remains.
Prior-review resolution
- ✅ Current-head Fleet Tests failure and pending Linux build — the rerun of
fleet-testsandgatepassed,linux-buildpassed, andall-checksreports all 15 checks green ate1a6a6453.
Checked
- Read the complete PR discussion, prior review, inline-comment stream, and timeline; the head remains
e1a6a6453b954566589bfc7d237d4d5caa36c21c, so this re-review is delta-scoped to the previously flagged CI state. gh pr checks 5142: all 16 displayed check/status rows pass, including the rerunfleet-tests,gate,linux-build, shader parity, render harness, perf gate, formatting, and header checks.- The PR is standalone on
master, mergeable, and clean. OpenGL runtime smoke remains cross-host debt and will be tagged separately; it is not a merge gate.
🤖 Reviewed by Codex (GPT-5), opus-class review-pr pass
Opus recheck not required (reviewed at opus class).
Summary
An image drawn on a canvas-draw layer keeps half its horizontal detail, because a canvas texel is two framebuffer pixels wide.
IRPrefab::CanvasDraw::queueFramebufferImage(IRCanvas.framebufferImagein Lua) draws the same loaded image straight into the main framebuffer at one sample per pixel, through a newIMAGE_TO_FRAMEBUFFERpass. It takes the canvas path's crop, mosaic, posterize and tint options and its depth constants, so canvas text still sits over it, a world voxel still occludes it, and the glitch pass and the recorder still see it.Screenshots
framebuffer_image_sample: top left, one probe image with one-pixel detail drawn through the canvas path and through the framebuffer path. Centre, a
BEHINDframebuffer image under a world cube and under canvas text, with twoFRONTimages over the cube. Top right, the mosaic, posterize and tint options on the framebuffer path.Existing shots: no visual change, 24 of 24 pairs identical against
origin/master(the 21 defaultIRShapeDebugshots,--voxel-text-sample,--text-size-sample,--canvas-image-sample).Test plan
fleet-build --target IRShapeDebugand--target IrredenEngineTest, macos-debug: both builtfleet-run IrredenEngineTest: 4035 tests passed, including the newframebuffer_image_test.cppandlua_framebuffer_image_test.cppfleet-run IRShapeDebug --framebuffer-image-sample --auto-screenshot 10: byte-identical to the committedmacos-debug/framebuffer_image_sample.png; in that shot the framebuffer tile reproduces the 192x96 probe with no mismatching pixelfleet-run IRShapeDebug --canvas-image-sample --auto-screenshot 10: byte-identical to its existing reference, so moving the filter into a shared include changed nothing on the canvas pathpython3 scripts/shader_parity_audit.py: clean, 162 glsl and 150 metal filescmake -P cmake/run_header_checks_standalone.cmake,lint_comment_refs.py,lint_instruction_refs.py,lint_creation_manifests.py,fleet-build --target format-changed: all passpython3 scripts/lint_instruction_size.py --against origin/master: exit 0 with two warnings (see notes)Reviewer notes
Notes for reviewer
.glslfiles and the refactored kernel GLSL are written as twins of the Metal sources and pass the parity audit; none has been compiled on a Linux or Windows host. Only a macOS reference is committed.kDepthBehindand hides aBEHINDframebuffer image; the design doc says to leave that canvas transparent under one. A full-frameBEHINDimage also writes depth below 1.0 everywhere, whichFRAMEBUFFER_GLITCH's depth effect reads as non-background. That interaction was not tested.IMAGE_TO_FRAMEBUFFERin the pipeline nothing is drawn and the queue stops growing at 256 draws.C_CanvasDrawQueuehas no such bound withoutCANVAS_DRAW; that predates this change.engine/prefabs/irreden/render/CLAUDE.mdandengine/script/CLAUDE.mdare over their byte budgets on master. Their rows were edited in place and grow by 120 and 103 bytes, inside the lint's warning band.clipFramebufferImagewrapsclipRectToCanvasand could live beside it intrixel_rect.hpp; theframebufferImageandimageLua lambdas share a prefix; the framebuffer quad-pass setup repeats what three other*_to_framebuffersystems do.🤖 Generated with Claude Code