Repository navigation
render: add framebuffer post effects (bloom, blur, colour grade) - #5143
Merged
Merged
Conversation
FRAMEBUFFER_POST_EFFECTS draws a thresholded bloom, a separable Gaussian
blur and a colour grade over the image presented for the main
framebuffer, into a twin output image the screen blit and the recorder
then present. One singleton, C_PostEffectsState, holds every parameter;
IRPrefab::PostEffects::setState and IRRender.setPostEffects{...} drive
it, and each effect is switched independently and off by default. With
every switch off the pass encodes no GPU work.
The pass runs after FRAMEBUFFER_GLITCH and reads its output on a tick
that pass drew one. IRPrefab::PresentedFrame::mainColor() names the
image actually presented, so FRAMEBUFFER_TO_SCREEN and VideoManager no
longer ask the glitch pass directly.
Every texture read is a whole-texel fetch, so the Metal and GLSL
shaders and the CPU twin in post_effects_math.hpp read the same texels.
Only the Metal side has been run; the GLSL side is unverified on
OpenGL.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…bouring edits Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Perf gateHead host slug: perf comparison: 973cca4 → 4b9196b-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 |
297.961 → 296.528 (-0.5%) |
| RENDER | ComputeLightVolume |
35.515 → 34.996 (-1.5%) |
| RENDER | ComputeSunShadow |
19.866 → 19.696 (-0.9%) |
| RENDER | CanvasToFramebuffer |
17.575 → 17.533 (-0.2%) |
| RENDER | BakeSunShadowMap |
10.404 → 10.046 (-3.4%) |
| UPDATE | FogRevealEval |
4.318 → 6.321 (+46.4%) ⚠ |
| UPDATE | PropagateTransform |
4.466 → 4.710 (+5.5%) |
| RENDER | ComputeVoxelAO |
4.413 → 4.244 (-3.8%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
981.501 → 984.359 (+0.3%) |
| RENDER | ComputeSunShadow |
39.727 → 39.142 (-1.5%) |
| RENDER | ComputeLightVolume |
32.335 → 30.294 (-6.3%) ↓ |
| RENDER | CanvasToFramebuffer |
16.231 → 16.470 (+1.5%) |
| RENDER | ComputeVoxelAO |
10.820 → 10.542 (-2.6%) |
| RENDER | BakeSunShadowMap |
8.796 → 8.890 (+1.1%) |
| RENDER | LightingToTrixel |
9.229 → 8.886 (-3.7%) |
| UPDATE | PropagateTransform |
4.292 → 6.791 (+58.2%) ⚠ |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
328.031 → 337.595 (+2.9%) |
| RENDER | ComputeSunShadow |
64.391 → 64.837 (+0.7%) |
| RENDER | LightingToTrixel |
36.422 → 36.867 (+1.2%) |
| RENDER | ComputeLightVolume |
33.720 → 33.862 (+0.4%) |
| RENDER | BakeSunShadowMap |
22.888 → 22.689 (-0.9%) |
| RENDER | CanvasToFramebuffer |
17.895 → 18.021 (+0.7%) |
| RENDER | FogToTrixel |
7.296 → 7.170 (-1.7%) |
| UPDATE | PropagateTransform |
6.223 → 6.472 (+4.0%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1495.587 → 1495.907 (+0.0%) |
| RENDER | ComputeSunShadow |
54.602 → 53.105 (-2.7%) |
| RENDER | ComputeLightVolume |
33.594 → 33.787 (+0.6%) |
| RENDER | CanvasToFramebuffer |
16.024 → 16.320 (+1.8%) |
| RENDER | BakeSunShadowMap |
8.899 → 8.702 (-2.2%) |
| RENDER | ComputeVoxelAO |
8.698 → 8.603 (-1.1%) |
| RENDER | LightingToTrixel |
7.329 → 7.488 (+2.2%) |
| UPDATE | PropagateTransform |
6.286 → 6.366 (+1.3%) |
jakildev
commented
Nov 17, 2026
jakildev
left a comment
Owner
Author
There was a problem hiding this comment.
Review — render: add framebuffer post effects (bloom, blur, colour grade)
Verdict: approve
The publication/lifetime/order contracts and backend-mirrored math are coherent; I found no merge-blocking defect.
Checked
- Reviewed the complete PR thread and detached head
a6cf01571699ea155c77c91890bf9b4a43626313, including the implementation, Metal/GLSL shader twins, Lua surface, tests, fixtures, and design contract. fleet-build --detach --target IrredenEngineTestcompleted successfully.fleet-run IrredenEngineTest --gtest_filter='*PostEffects*:*SystemNameEnumBound'passed all 36 selected tests.git diff --check origin/master...HEADpassed.- PR-relevant CI is green, including render harness, shader parity, performance, format, and header checks.
fleet-testsis red on the unrelated claim-race harness flake also reproduced on a recentmasterrun; this diff does not touch fleet scripts. The Linux build was still running at review time. - The OpenGL shaders remain unverified on this macOS-authored change and are routed to Windows smoke debt.
🤖 Reviewed by Codex GPT-5 (review-pr skill)
Opus recheck not required (reviewed at opus class).
16 of 18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
FRAMEBUFFER_POST_EFFECTS: a thresholded bloom, a separable Gaussian blur and a colour grade over the image presented for the main framebuffer, each switched independently and all off by default. A creation drives them per frame fromIRPrefab::PostEffects::setStateorIRRender.setPostEffects{...}; the screen blit and--auto-recordboth present the result. It runs after the glitch pass, and with every switch off it encodes no GPU work.The GLSL shaders are unverified on OpenGL. Only the Metal side was run (macOS host). Contract:
docs/design/post-effects.md.Screenshots
No visual change to existing shots: 21 of 21 pairs identical, IRShapeDebug.
post_effects_all (new,
--post-effects-test all): blur radius 2, screened bloom and a warm grade together.Clip recorded by
--auto-recordwith the same effects on:full clip (mp4)
4 more new shots: control, blur, bloom, grade
post_effects_off (control)
post_effects_blur (radius 6)
post_effects_bloom (threshold 0.55, 5 levels, additive)
post_effects_grade
Test plan
All on macOS Metal, Apple M4 Max, at this head unless a line says otherwise.
fleet-run IrredenEngineTest: 4056 tests passed, 0 failed.fleet-run IRShapeDebug --auto-screenshot 10onorigin/masterand on this branch: 28 of 28 captures byte-identical (cmp).fleet-run IRShapeDebug --post-effects-test standard-off --auto-screenshot 10: 28 of 28 captures byte-identical to the default run.--post-effects-test blurandgrade:[post-effects-probe] cpuTwin mismatchedTexels=0 cpuMaxDelta=0over 927048 texels.--post-effects-test bloom:darker=0 brighter=609544;off:published=false frameDraws=0.python3 scripts/render-verify.py --target IRShapeDebug --no-build(at b510942, before two behaviour-neutral line moves): the five newpost_effects_*rows pass at 100% match, max delta 0. The run exits 1 on 24 rows that are red on master too (see notes). At this head the five captures still equal the committed references byte for byte.fleet-run IRShapeDebug --post-effects-test all --auto-record 180 --config-preset scripts/fleet/clip-preset.lua: the recorded frames carry the blur, bloom and grade (clip above).python3 scripts/shader_parity_audit.py: clean, 167 glsl and 155 metal files.cmake -DPROJECT_ROOT=$PWD -P cmake/run_header_checks_standalone.cmake: header, save-inventory and GLSL reserved-word checks pass.Reviewer notes
Notes for reviewer
shader_parity_audit.pyonly pairs file names. The twins were written side by side with integer texel fetches only, but no GL driver has compiled them;post_effects_*references exist formacos-debugonly.IRPrefab::PresentedFrame::mainColor()now names the presented image;FRAMEBUFFER_TO_SCREENandVideoManagerread it instead of asking the glitch pass.ScreenBlitEncoder::drawGlitchOutputbecamedrawPresentedOutput, andSystem<FRAMEBUFFER_TO_SCREEN>::glitchPublished_/glitchOutput_becamepresented_.--auto-recordreads the presented main colour;--auto-screenshotreads the screen target, which also holds sprites and the on-screen GUI. Both show the effects.f_post_effects_blur_horizontal/_verticaloverir_post_effects_blur_body), so nothing varies per draw.render-verifyrows are master's. They are the yaw-180/270 shots of the default pass and its three off-path mirrors (16, including the newpost_effects_standard_off), sixsdf_baked_*yaw rows and twolod_scenerows. The default pass and all four of those extra runs produce byte-identical captures onorigin/master(a914699) and on this branch.engine/prefabs/irreden/render/CLAUDE.mdandengine/script/CLAUDE.mdwere already past their byte budgets on master; this adds 19 and 145 bytes andlint_instruction_size.py --against origin/masterannotates both, exit 0.framebufferPostEffectsGPU row: grade 0.07 ms, blur radius 6 0.41 ms, bloom 5 levels 0.71 ms, all three 0.84 ms. The host was also building; table in the design doc.fleet-pr-overlap --base master,VERDICT: overlap):#4921 creations/demos/shape_debug/main.cpp base-conflict (conflicts with master a914699df alone); every other shared path trial-merges clean (render: configure LOD zoom thresholds and hysteresis per camera #4921, engine/voxel: gate set pose writes on stored bounds or current transform #5081, render/metal: draw consecutive draws to one target in one render pass (#4994) #5100, render: size per-axis stores from content height (#4960) #5101, docs: capture overflow-rejection camera ordering in docs/design/per-axis-trixel-canvas-rotation.md (#5086) #5124, render: give the per-axis list walks their own one-entry kernels #5131, render: prototype event-cursor picks from completed images #5135, engine: add a native file-open dialog with Lua path grants #5140, video: keep every frame of a fixed-step recording #5141, render: draw images into the main framebuffer at pixel resolution #5142). render: draw images into the main framebuffer at pixel resolution #5142 adds a main-framebuffer producer; by this pass's contract it registers beforeFRAMEBUFFER_POST_EFFECTS. video: keep every frame of a fixed-step recording #5141 also editsvideo_manager.cppandengine/video/CLAUDE.md, where this PR changes which image the recorder reads.IRPrefab::PostEffectsaccessors and the Lua key/range checks repeat the glitch pass's shapes and could share helpers with it;readShadernow exists in three test files.🤖 Generated with Claude Code