perf(webgpu): range-flush only live TLAS metadata slots (#130) #149
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics!149
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-130"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
implementations/Crafter.Graphics-RenderingElement3D-WebGPU.cpp:162flushed the TLAS metadata mirror withmetadataBuffer.FlushDevice(). That buffer is padded tokNPadded = 65536slots, but onlyprimitiveCountentries are ever live — so every framewgpuWriteBufferpushed all 256 KB through the WASM→JS staging path (~100–250× waste for a few-hundred-instance scene). The Vulkan parallel already sizes its flush toprimitiveCount, so this was WebGPU-specific.Fix
Switch to the existing
FlushDeviceRange(0, 0, primitiveCount * sizeof(std::uint32_t))overload — the same one theinstanceBufferpartial-write loop directly above already uses — so only the live slots are uploaded.Testing
--target=wasm32-wasip1): the WebGPU implementation file compiles cleanly.crafter-build test --jobs=1: 24 passed. (Parallel runs hit unrelated git-pull contention on the shared external-dep cache; serializing avoids it.)Resolves #130