You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
We are trying to confirm if SPV_EXT_opacity_micromap + RayTracingOpacityMicromapEXT are missing in one of our SPIR-V shaders, that cause crashes on specific hardware that uses opacity micromaps in acceleration structures. However, trying to simply add it with the [[vk::ext_extension]] attribute causes a very simple shader to suddenly stop compiling.
Commenting out [[vk::ext_extension("SPV_EXT_opacity_micromap")]] makes the shader compile successfully again, with the RAY_FLAG_FORCE_OMM_2_STATE = 1024 constant used in the ray query flags.
Actual Behavior
fatal error: generated SPIR-V is invalid: In Logical addressing, variables can only allocate a pointer to the StorageBuffer or Workgroup storage classes
%58 = OpVariable %_ptr_Function__ptr_Uniform_type_ByteAddressBuffer Function
note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible
Compiler returned: 5
Environment
DXC version 1.8.2505 and trunk on Godbolt (libdxcompiler.so: 1.10(1-11951229)(1.9.0.10001)).
Well I see quite a big oopsie in the GodBolt example. I copied it from one of my earlier DXIL reports and it still erroneously uses ResourceDescriptorHeap while targeting SPIR-V. When I remove that, this error is gone:
I'll double-check why this same error was raised in our bigger production shaders and get back here shortly. We surely don't use ResourceDescriptorHeap in our Vulkan-targeted shaders there either 😅
EDIT: Wondering why it was at least compiling without ext_extension(), it turns out that ResourceDescriptorHeap was made to compile for SPIR-V/Vulkan based on SPV_EXT_descriptor_indexing and VK_EXT_mutable_descriptor_type: #6650
Now that I look at the diff more closely, when adding this extension the shader becomes a lot larger with dead code. We've seen similar issues before, where enabling new extensions prevents the optimize from running, leaving invalid SPIR-V in the end. SPV_EXT_opacity_micromap is simply not in the list that allows DCE to run and that ResourceDescriptorHeap was triggering it.
Perhaps I should see what code on our end triggers the invalid SPIR-V to show up without DCE as well.
[[vk::binding(0, 0)]] ByteAddressBuffer g_ByteAddressBuffer[];
[[vk::ext_extension("SPV_EXT_opacity_micromap")]] // Add an extension that disables DCE
[numthreads(8, 8, 1)] voidmain(uint2 dispatchThreadId : SV_DispatchThreadID) {
ByteAddressBuffer bab = g_ByteAddressBuffer[NonUniformResourceIndex(dispatchThreadId.x)];
uint test = bab.Load(0);
}
And a different validation error occurs on errant OpStores that other optimizers likely filter out, when applying the same code pattern to textures and TLASes:
[[vk::binding(0, 0)]] RWTexture2D<uint> g_tex[];
[[vk::ext_extension("SPV_EXT_opacity_micromap")]] // Add an extension that disables DCE
[numthreads(8, 8, 1)] voidmain(uint2 dispatchThreadId : SV_DispatchThreadID) {
RWTexture2D<uint> tex = g_tex[NonUniformResourceIndex(dispatchThreadId.x)];
uint test = tex.Load(0);
}
fatal error: generated SPIR-V is invalid: [VUID-StandaloneSpirv-OpTypeImage-06924] Cannot store to OpTypeImage, OpTypeSampler, OpTypeSampledImage, or OpTypeAccelerationStructureKHR objects
OpStore %29 %9
Activity
MarijnS95 commentedon Mar 5, 2026
Well I see quite a big oopsie in the GodBolt example. I copied it from one of my earlier DXIL reports and it still erroneously uses
ResourceDescriptorHeapwhile targeting SPIR-V. When I remove that, this error is gone:https://godbolt.org/z/9cs1vzh97
I'll double-check why this same error was raised in our bigger production shaders and get back here shortly. We surely don't use
ResourceDescriptorHeapin our Vulkan-targeted shaders there either 😅EDIT: Wondering why it was at least compiling without
ext_extension(), it turns out thatResourceDescriptorHeapwas made to compile for SPIR-V/Vulkan based onSPV_EXT_descriptor_indexingandVK_EXT_mutable_descriptor_type: #6650MarijnS95 commentedon Mar 5, 2026
Now that I look at the diff more closely, when adding this extension the shader becomes a lot larger with dead code. We've seen similar issues before, where enabling new extensions prevents the optimize from running, leaving invalid SPIR-V in the end.
SPV_EXT_opacity_micromapis simply not in the list that allows DCE to run and thatResourceDescriptorHeapwas triggering it.Perhaps I should see what code on our end triggers the invalid SPIR-V to show up without DCE as well.
MarijnS95 commentedon Mar 5, 2026
Just in case, with this extension disabling DCE it's specifically "storing" a
(RW)ByteAddressBuffer"to the stack" that triggers the error:https://godbolt.org/z/jb4nYrddc
And a different validation error occurs on errant
OpStores that other optimizers likely filter out, when applying the same code pattern to textures and TLASes:https://godbolt.org/z/T1r31TPaP
Optimize `SPV_EXT_opacity_micromap` and `SPV_EXT_shader_invocation_re…