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!109
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-73"
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?
Resolves #73
Problem
vertexBuffer/indexBuffer/aabbBufferwere allocatedHOST_VISIBLE(system RAM). Their usage flags (SHADER_DEVICE_ADDRESS, plusSTORAGE_BUFFERon the index buffer) deliberately expose geometry for hit-shader fetch — the dominant RT shading pattern — so an app fetching geometry in closest-hit shaders reads vertex/index data from system RAM over PCIe everyvkCmdTraceRaysKHR. The BLAS build (and every refit) also read these as build inputs.Fix
New
VulkanBuffer::UploadDeviceLocalplaces the buffer in device-local memory and picks how at runtime via the #89 strategy (Device::PreferDirectDeviceWrite) — never unconditional staging:HOST_VISIBLE | DEVICE_LOCAL(DEVICE_LOCAL preferred), map transiently, memcpy, flush if non-coherent. No staging buffer.DEVICE_LOCAL+TRANSFER_DST, fill a transientHOST_VISIBLEstaging buffer,vkCmdCopyBuffer, thenDeferredClear()the staging buffer onto the fence-keyed deletion queue (#101/#102) so it outlives the copy submit.The geometry buffers become non-mapped (
Mapped==false) so the destination is free to be device-local-only. Same-size re-uploads reuse the allocation, keeping the device address stable across an in-place AS UPDATE refit. The compressedBuildpath now allocates vertex/index as pureDEVICE_LOCAL— the GPU decompressor fills them directly, with no host write.Correctness caveats addressed
DeferredClear()(#101/#102) — no lifetime hazard.memoryPropertyFlagsChosen).Tests
BLASBuildOptions(real hardware + GPU-assisted validation):Device::directWriteBudget, then validates a fresh staged build + an in-place UPDATE refit;All 19 project tests pass (
crafter-build test).🤖 Generated with Claude Code