Repository navigation
perf: 24-byte depth stream for shadow casters; crop the water probe to its screen rect - #251
Conversation
…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
|
|
Merged to main the part that still applies: the planar-probe crop (069ed82, cherry-picked as 948de23); #242 below it is merged too. The 24-byte shadow depth twin was not merged: since #267 arena vertices are 64 bytes (96 on OpenGL), so the 4:1 index ratio (96/24) no longer holds. It needs a twin stride that divides 64 and 96 (e.g. 32 bytes) and a fresh measurement on the 760M. |
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.