Repository navigation
perf: 24-byte depth stream for shadow casters; crop the water probe to its screen rect - #251
Open
proggeramlug wants to merge 2 commits into
Conversation
added 2 commits
November 16, 2026 19:43
…ry arena Static meshes in the shared geometry arena are 96-byte Vertex3D; a shadow pass only needs position (and uv + alpha for cutouts). The arena now keeps a DepthVertex twin (position, uv, alpha; 24 bytes, 4:1 so base_vertex is unchanged) written on upload and copied on grow. Sun cascades and lamp shadow cubes draw arena geometry from the twin with two compact pipelines; skinned and non-arena buffers keep the full stream. Radeon 760M, High, fight at fixed resolution: shadow_pass 4.2 -> 2.9 ms, fight 28.9 -> 30.0 fps, worst window 24.9 -> 27.4. SCENESHOT views match (differences are wind and clouds only). Costs ~26 MB of extra VRAM for the forest arena. BLOOM_SKIP=shadow_compact restores the full stream for A/B.
Water samples the probe at screen_uv + n.xz * 0.08, so only the screen rect of the visible linked surfaces (plus a 0.25 NDC margin) is ever read. For a horizontal plane the mirrored view maps plane points to the same screen position, so the probe passes are scissored to that rect and cull against the cropped frustum. Instanced or unbounded water, and tilted planes, keep the full rect. Unit tests cover rect, planes and scissor. Radeon 760M, High fight: planar_probe_models ~4.1 -> ~3.8 ms; picture unchanged. BLOOM_SKIP=probe_crop disables it.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
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.
Two speed-ups that keep the picture, measured on an integrated Radeon 760M (High preset, fight perftest, fixed resolution). Stacked on #242; retarget to
mainonce that lands.1. Shadow casters read a 24-byte depth twin of the geometry arena
Static meshes in the shared arena are 96-byte
Vertex3D; a shadow pass needs only position (plus uv and alpha for cutouts). The arena now keeps aDepthVertextwin (24 bytes, a 4:1 ratio sobase_vertexis unchanged), written on upload and copied on grow. Sun cascades and lamp shadow cubes draw arena geometry from it through two compact pipelines; skinned and non-arena buffers keep the full stream.shadow_passCosts ~26 MB of VRAM for a forest arena.
BLOOM_SKIP=shadow_compactrestores the full stream for an A/B.2. Crop a horizontal planar probe to where its water is on screen
Water samples the probe at
screen_uv + n.xz * 0.08, so only the screen rect of the visible linked surfaces (plus a 0.25 NDC margin) is ever read. For a horizontal plane the mirrored view maps plane points to the same screen position, so the probe passes are scissored to that rect and cull against the cropped frustum. Instanced or unbounded water and tilted planes keep the full rect.planar_probe_models~4.1 → ~3.8 ms.BLOOM_SKIP=probe_cropdisables it.Verification
planar_reflection(rect, cropped planes, scissor);cargo test --lib planar_reflectionpasses.capabilities::checked_documentation_table_matches_runtime_definitions,visibility_shading::virtual_shading_reuses_the_authoritative_pbr_and_all_mrts); both compare text with LF line endings and are not touched here.Tried and dropped
The same 24-byte stream for the model depth prepass gained nothing (4.0 ms either way), so that pass is not vertex-fetch bound; it is not in this PR.