fix(vulkan-rt): work around NVIDIA descriptor-heap AS-read device-loss (#15) #16
No reviewers
Labels
No labels
claude:done
claude:in-progress
claude:ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics!16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-15"
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 #15.
Problem
Reading an acceleration structure through
VK_EXT_descriptor_heapaborts withVK_ERROR_DEVICE_LOSTon NVIDIA610.43.02— the driver fault isolated in #7. The engine side is correct and validation-clean; images/buffers through the same heap work, and bothtraceRayEXTand inlinerayQueryEXTfault identically on the AS read.Workaround
An acceleration structure can equally be reached by its device address via
OpConvertUToAccelerationStructureKHR, which reads no descriptor and so never touches the faulting heap path. glslang has no GLSL spelling for that conversion, so the engine rewrites the compiled SPIR-V at module-load time:VulkanShader(one fenced block inCrafter.Graphics-ShaderVulkan.cppm): everyOpLoadof anaccelerationStructureEXTout of the heap becomes a load of the TLAS device address from a synthesized push-constant block, followed byOpConvertUToAccelerationStructureKHR. Shaders with no acceleration structure are left untouched.RTPasspushes the active frame's TLAS device address into that push constant.Device::workaroundDescriptorHeapAS— true only on the NVIDIA proprietary driver.shaderInt64is enabled on the same condition.User GLSL (
raygen.glsl) and example code are unchanged; acceleration structures still bind into the heap normally. On every other driver the workaround is inert. It's removable wholesale (one block + the RTPass push + the flag + the feature toggle) once a fixed NVIDIA driver ships.Verification
VulkanTriangleray-traces correctly on native NVIDIA (RTX 4090), validation-layer-clean, no device loss (the validation layers run spirv-val on the rewritten module atvkCreateShaderModuleand report no errors).spirv-valon both the VulkanTriangle (SPIR-V 1.4) and Sponza raygen modules.There are no automated tests in the repo (
crafter-build testreports none); verification was by exercising the app directly.Screenshots
🤖 Generated with Claude Code