diff options
| author | Dario Mylonopoulos <32958057+ramenguy99@users.noreply.github.com> | 2025-03-21 18:21:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-22 01:21:04 +0800 |
| commit | 969d101aff074675de32bdbe6b97baf744634f78 (patch) | |
| tree | d82e01e35cdf373564c5ff5c19f149a7b04bf142 /tests | |
| parent | 844d8d2212d11f3d28a55c81f234c99db2c26250 (diff) | |
Support spirv ops added by multiple extensions (#6615)
* spirv: add support for ops added by multiple extensions
Some spirv ops are added by multiple extensions and capabilities. This
commit adds support to avoid emitting unnecessary extensions and
capabilities if one of the options is already required by some other op.
* spirv: allow OpRaytracingAccelerationStructure to use multiple extensions
This Op is provided by both SPV_KHR_ray_tracing and SPV_KHR_ray_query
and the respective capabilities. Use one if already available and
otherwise fall back to SPV_KHR_ray_tracing.
* tests/vkray: add negative checks for RayTracingKHR and RayQueryKHR
- Add new rayquery-compute.slang to test that only RayQueryKHR is needed
in compute shaders.
- Add checks for RayTracingKHR and RayQueryKHR capabilities and
extensions in raygen.slang
---------
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/vkray/raygen.slang | 4 | ||||
| -rw-r--r-- | tests/vkray/rayquery-compute.slang | 19 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/vkray/raygen.slang b/tests/vkray/raygen.slang index 28bad734a..653435a65 100644 --- a/tests/vkray/raygen.slang +++ b/tests/vkray/raygen.slang @@ -117,6 +117,10 @@ void main() outputImage[int2(gl_LaunchIDNV.xy)] = float4(color, 1.0); } +// CHECK_SPV: OpCapability RayTracingKHR +// CHECK_SPV-NOT: OpCapability RayQueryKHR +// CHECK_SPV: OpExtension "SPV_KHR_ray_tracing" +// CHECK_SPV-NOT: OpExtension "SPV_KHR_ray_query" // CHECK_SPV: %{{.*}} = OpVariable %_ptr_RayPayload{{NV|KHR}}_ReflectionRay{{.*}} RayPayload // CHECK_SPV: OpTraceRayKHR // CHECK_SPV: OpTraceRayKHR diff --git a/tests/vkray/rayquery-compute.slang b/tests/vkray/rayquery-compute.slang new file mode 100644 index 000000000..2de53cdcc --- /dev/null +++ b/tests/vkray/rayquery-compute.slang @@ -0,0 +1,19 @@ +// rayquery-compute.slang +//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry main -target spirv-assembly -emit-spirv-directly + +RaytracingAccelerationStructure accelerationStructure; + +[numthreads(1, 1, 1)] +void main(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + RayQuery<RAY_FLAG_NONE> rayQuery; + + uint instanceInclusionMask = 0x00; + RayDesc rayDesc; + rayQuery.TraceRayInline(accelerationStructure, RAY_FLAG_NONE, instanceInclusionMask, rayDesc); +} + +// CHECK: OpCapability RayQueryKHR +// CHECK-NOT: OpCapability RayTracingKHR +// CHECK: OpExtension "SPV_KHR_ray_query" +// CHECK-NOT: OpExtension "SPV_KHR_ray_tracing" |
