Repository navigation
Blend moving meshes on the GPU, in the occlusion culling pass - #258
Closed
BenjaFriend wants to merge 8 commits into
Closed
BenjaFriend wants to merge 8 commits into
BenjaFriend wants to merge 8 commits into
Conversation
…meshes Found with --profile: with the lighting test level's 3,136 rotating spheres, Graphics.PublishSnapshot cost 6.4 ms a frame in a Debug build (1.6 ms still), and FPS dropped by almost half. - Interpolate::BlendedWorld walks the parent chain once and keeps the two ends, where it walked it twice. A chain deeper than 8 uses the old code (BlendedWorldDeep). A test holds the two to the same matrices at every depth around the limit. - TransformUtil::LocalMatrix is written out: the same values as the three glm calls (a test checks it), without the matrix products. - The renderer publishes the view it culled with (PreCullView), and PublishSnapshot draws the published LocalToWorld of a mesh far outside it instead of blending. The view is one frame old: a mesh that comes into view that frame is drawn at the latest tick's place for that frame. Debug, rotating: PublishSnapshot 6.5 ms down to 1.8 ms. The simulation checksum is the same. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NN37Q2jpV81xZaX3ocojK
…e matrix A mesh that moved between the two ticks and has no Parent goes into the RenderSnapshot as its two Transform values (HasBlend, From, To) and the frame's factor (BlendAlpha), instead of a matrix made on the CPU. The renderer resolves it once a frame (OffscreenSubpass::ResolveWorlds, MeshDrawItem::ResolveWorld). No picture change: this is the first step of blending on the GPU (Plans/gpu-blend.md). MeshCuller::Cull takes the resolved matrices. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NN37Q2jpV81xZaX3ocojK
The cull compute shader makes the world matrix of each mesh that moves between two ticks, from the two ends of its Transform and the frame's blend factor, and tests it against the view volume (the CPU has no matrix for it). The G-buffer vertex shader reads its matrix from one storage buffer, by slot; the per mesh UBO holds only the slot. The CPU writes the matrix of a still mesh when its LocalToWorld version changes. - --gpu-blend on|off, [Engine] GpuBlend, a GPU Options checkbox. On by default; it needs occlusion culling, otherwise the CPU blends (as before). - Shader reflection tells a storage buffer from a uniform buffer. - OcclusionSlot has the two ends in place of the matrix. GPU and CPU blend match to 3/255 on 1,697 of 2 million pixels at the same tick; no validation layer messages. Plans/gpu-blend.md has the design and the numbers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NN37Q2jpV81xZaX3ocojK
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017NN37Q2jpV81xZaX3ocojK
Member
Author
|
Folded into #257 (same branch now). |
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.
Moving meshes are no longer blended on the CPU. The snapshot carries the two ends (
From,To) and the frame'sBlendAlpha;cull.compmakes the world matrix, tests the frustum, and the G-buffer vertex shader reads matrices from one storage buffer by slot. Design and measurements:Plans/gpu-blend.md.Stacked on #257. This branch contains #257's commits (one-pass blend, direct
LocalMatrix,PreCullView), so the diff against main shrinks when #257 merges. Merge #257 first.--gpu-blend on|off(also[Engine] GpuBlend, and a checkbox in GPU Options). On by default. Needs occlusion culling; otherwise the CPU blends as before.Testing
🤖 Generated with Claude Code
https://claude.ai/code/session_017NN37Q2jpV81xZaX3ocojK