BuildTLAS reallocated the host-visible instanceBuffer and metadataBuffer on every topology change. They only ever need to hold at least primitiveCount entries (the AS build reads exactly primitiveCount via tlasRangeInfo, and the copy loop writes [0, primitiveCount)), so a shrink — or any growth that still fits the previous capacity — can reuse the existing allocation. Gate the two Resize calls on a high-water-mark check, removing two of the four reallocations on a count change. The AS storage + scratch rebuild below is unchanged: it is tied to the AS itself and dominates this path regardless. Adds tests/TLASHighWaterMark driving the real hardware AS-build path: it asserts a shrink (and within-capacity growth) reuses the buffers while a growth past the high-water reallocates, that builtInstanceCount still tracks the live count, and that feeding an oversized instance buffer to the build produces zero Vulkan validation errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| BLASBuildOptions | ||
| FontAdvanceCache | ||
| FontAtlasDirtyRect | ||
| FrameLoopSync | ||
| InputFieldHitTest | ||
| MemoryTypeFallback | ||
| MouseScroll | ||
| PushConstantRewrite | ||
| ShapeTextCache | ||
| TLASHighWaterMark | ||
| UIClipFlag | ||
| UIFusedShader | ||
| UploadStrategy | ||
| VulkanBufferFlushGate | ||