Repository navigation
Draw custom opaque materials inside the main HDR pass - #206
Merged
Merged
Conversation
Game-compiled opaque materials were drawn in a render pass of their own, with Load and Store on all four G-buffer targets and depth. An immediate-mode GPU does not notice; a tile-based one reloads and stores every target for it. The main HDR pass now dispatches them before it ends. The separate pass remains only for frames whose main pass is skipped by a diagnostic. Measured with The Deep (a water material on 12 sea tiles plus a sky dome): - iPad Pro A12Z, 2049x1536 render: GPU time 62.0 -> 58.7 ms a frame - macOS, 3200x1800: 15.3 -> 14.5 ms a frame Golden suite unchanged; the game's frame is pixel-equivalent before and after. Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
What
Game-compiled opaque materials (
compileMaterial+drawMeshWithMaterial) were drawn inbloom_material_pass, a render pass of their own withLoad/Storeon all four G-buffer targets and depth. The main HDR pass now dispatches them before it ends (dispatch_opaque_materials). The separate pass stays as the fallback for frames whose main pass is skipped byBLOOM_SKIP=hdr_pass.Why
A second pass over the same targets costs nothing on an immediate-mode GPU. A tile-based GPU reloads and stores every attachment for it.
Measured (The Deep: a water material on 12 sea tiles and a sky dome)
BLOOM_GPU_TIMEI found it by elimination on the device: simplifying the shader, sorting draws front to back and turning SSR off each left the 62 ms unchanged.
Checks
cargo test --releaseinnative/shared: golden suite unchanged; onlyvisibility_shading_matches_forward_referencefails, as onmain.Not covered
Planar-reflection dispatch used to run between the scene and the material pass and now runs after both. Materials sample the previous frame's reflection target, so I expect no change, but no golden test exercises a planar reflection with a custom material.