-
Notifications
You must be signed in to change notification settings - Fork 437
Description
Describe the Issue
When using a shader with ray queries, that have SkipAABBsKHR
set (RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES
in HLSL) and its RayTraversalPrimitiveCullingKHR
emitted in SPIR-V, the following error appears:
Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-01091 ] Object 0: handle = 0xb400007394d724d0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xa7bb8db6 | vkCreateShaderModule(): The SPIR-V Capability (RayTraversalPrimitiveCullingKHR) was declared, but none of the requirements were met to use it. The Vulkan spec states: If pCode declares any of the capabilities listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-01091)
Note that this appears when exclusively using VK_KHR_ray_query
and not enabling/having VK_KHR_ray_tracing_pipeline
- hence not enabling the flag in VkPhysicalDeviceRayTracingPipelineFeaturesKHR
.
It appears the spec and this validation layer only have a Vulkan feature for Ray Tracing pipelines, but not for Ray Query shaders?
A possible workaround is passing VkPhysicalDeviceRayTracingPipelineFeaturesKHR
regardless of the VK_KHR_ray_tracing_pipeline
feature, but that seems wrong and I'm surprised the validation layer doesn't complain about feature structs being used without the appropriate extension being enabled.
Valid Usage ID
VUID-VkShaderModuleCreateInfo-pCode-01091
Environment
- OS: Any
- GPU: Any with Ray Query support
- SDK or header version if building from repo: 1.3.216.0
- Options enabled (synchronization, best practices, etc.): None.
Additional context
- https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_ray_query.html#_new_spir_v_capabilities Indicates that this capability is allowed within RayQuery shaders.
- https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html#rayquery The HLSL docs use this flag in a RayQuery example.
- Minimal example shader:
RaytracingAccelerationStructure as; float4 main(float4 input : SV_POSITION) : SV_Target0 { RayQuery<RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES> q; RayDesc ray; q.TraceRayInline(as, 0, 0xff, ray); q.Proceed(); if (q.CommittedStatus() == COMMITTED_TRIANGLE_HIT) { return 1.0; } else { return 0.0; } }