From d64f5f2699f806215c97d75555046971057ece63 Mon Sep 17 00:00:00 2001 From: Natalie Chouinard Date: Fri, 17 May 2024 09:33:42 -0400 Subject: [PATCH] [SPIR-V] Enable rayquery tests (#6627) These tests were previously marked as "unsupported" because they were misconfigured at the time they were added and never run. Minor changes have been made to make them passing tests. Note that rayquery_assign.cs.hlsl has been removed because it no longer produces an error. A similar non-erroring check exists in rayquery_init_expr.hlsl Related to #6616 --- .../{unsupported => }/rayquery_equal.cs.hlsl | 7 ++++--- .../{unsupported => }/rayquery_init_ds.hlsl | 10 +++++---- .../{unsupported => }/rayquery_init_gs.hlsl | 10 +++++---- .../{unsupported => }/rayquery_init_hs.hlsl | 13 ++++++------ .../{unsupported => }/rayquery_init_ps.hlsl | 10 ++++----- .../rayquery_init_rahit.hlsl | 16 +++++++------- .../rayquery_init_rcall.hlsl | 14 +++++++------ .../rayquery_init_rchit.hlsl | 16 +++++++------- .../{unsupported => }/rayquery_init_rgen.hlsl | 16 +++++++------- .../{unsupported => }/rayquery_init_rint.hlsl | 21 ++++++++++++------- .../rayquery_init_rmiss.hlsl | 14 +++++++------ .../{unsupported => }/rayquery_init_vs.hlsl | 15 +++++++------ .../rayquery_tryAllOps.cs.hlsl | 5 +++-- .../unsupported/rayquery_assign.cs.hlsl | 9 -------- 14 files changed, 95 insertions(+), 81 deletions(-) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_equal.cs.hlsl (75%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_ds.hlsl (84%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_gs.hlsl (73%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_hs.hlsl (82%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_ps.hlsl (69%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_rahit.hlsl (74%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_rcall.hlsl (73%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_rchit.hlsl (75%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_rgen.hlsl (70%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_rint.hlsl (71%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_rmiss.hlsl (73%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_init_vs.hlsl (74%) rename tools/clang/test/CodeGenSPIRV/{unsupported => }/rayquery_tryAllOps.cs.hlsl (97%) delete mode 100644 tools/clang/test/CodeGenSPIRV/unsupported/rayquery_assign.cs.hlsl diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_equal.cs.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_equal.cs.hlsl similarity index 75% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_equal.cs.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_equal.cs.hlsl index 8e8b83a04..dbbf65d19 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_equal.cs.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_equal.cs.hlsl @@ -1,4 +1,5 @@ -// RUN: %dxc -T cs_6_5 -E main -fspv-target-env=vulkan1.2 +// RUN: %dxc -T cs_6_5 -E main -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + RaytracingAccelerationStructure g_topLevel : register(t0, space0); RWTexture2D g_output : register(u1, space0); @@ -17,11 +18,11 @@ void main(uint2 launchIndex: SV_DispatchThreadID) RayQuery q; q.TraceRayInline(g_topLevel, 0, 0xff, ray); -// CHECK: [[rayquery:%\d+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function q.Proceed(); // CHECK: OpRayQueryProceedKHR %bool [[rayquery]] if(q.CommittedStatus() == COMMITTED_TRIANGLE_HIT) -// CHECK: [[status:%\d+]] = OpRayQueryGetIntersectionTypeKHR %uint [[rayquery]] %uint_1 +// CHECK: [[status:%[0-9]+]] = OpRayQueryGetIntersectionTypeKHR %uint [[rayquery]] %uint_1 // CHECK: OpIEqual %bool [[status]] %uint_1 { T += float3(1, 0, 1); diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_ds.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_ds.hlsl similarity index 84% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_ds.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_ds.hlsl index 17ab72ad8..dd621450c 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_ds.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_ds.hlsl @@ -1,4 +1,5 @@ -// RUN: %dxc -T ds_6_5 -E main -fspv-target-env=vulkan1.2 +// RUN: %dxc -T ds_6_5 -E main -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR // CHECK: OpExtension "SPV_KHR_ray_query" @@ -52,11 +53,12 @@ void doInitialize(RayQuery query, RayDesc ray) RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); return v; diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_gs.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_gs.hlsl similarity index 73% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_gs.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_gs.hlsl index 30b8d5add..c0dcd1758 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_gs.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_gs.hlsl @@ -1,4 +1,5 @@ -// RUN: %dxc -T gs_6_5 -E main -fspv-target-env=vulkan1.2 +// RUN: %dxc -T gs_6_5 -E main -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR // CHECK: OpExtension "SPV_KHR_ray_query @@ -29,11 +30,12 @@ void main(line Empty e[4], inout PointStream OutputStream0) { RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); Out output = (Out)0; diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_hs.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_hs.hlsl similarity index 82% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_hs.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_hs.hlsl index 726b3ba03..53ce35973 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_hs.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_hs.hlsl @@ -1,6 +1,6 @@ -// RUN: %dxc -T hs_6_5 -E main -fspv-target-env=vulkan1.2 +// RUN: %dxc -T hs_6_5 -E main -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR -// CHECK: OpCapability RayTraversalPrimitiveCullingKHR // CHECK: OpExtension "SPV_KHR_ray_query" #define MAX_POINTS 3 @@ -56,19 +56,20 @@ void doInitialize(RayQuery query, query.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_NON_OPAQUE,0xFF,ray); } +[outputtopology("triangle_ccw")] [outputcontrolpoints(MAX_POINTS)] [patchconstantfunc("mainConstant")] CONTROL_POINT main(InputPatch ip, uint cpid : SV_OutputControlPointID) { // CHECK: %rayQueryKHR = OpTypeRayQueryKHR // CHECK: %_ptr_Function_rayQueryKHR = OpTypePointer Function %rayQueryKHR -// CHECK: [[rayquery:%\d+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_517 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_257 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_259 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_259 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); CONTROL_POINT result; return result; diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_ps.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_ps.hlsl similarity index 69% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_ps.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_ps.hlsl index dfb4ea6d2..2efc6d682 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_ps.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_ps.hlsl @@ -1,6 +1,5 @@ -// RUN: %dxc -E main -T ps_6_5 -fspv-target-env=vulkan1.2 +// RUN: %dxc -E main -T ps_6_5 -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s -// RUN: %dxc -T gs_6_5 -E main // CHECK: OpCapability RayQueryKHR // CHECK: OpExtension "SPV_KHR_ray_query @@ -23,11 +22,12 @@ uint4 main() : SV_Target { RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); return float4(1.0, 0.0, 0.0, 1.0); } \ No newline at end of file diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rahit.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_rahit.hlsl similarity index 74% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rahit.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_rahit.hlsl index 79c3209c1..a19ee38cb 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rahit.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_rahit.hlsl @@ -1,8 +1,9 @@ -// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -// CHECK: OpCapability RayTracingKHR +// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR -// CHECK: OpExtension "SPV_KHR_ray_tracing" +// CHECK: OpCapability RayTracingKHR // CHECK: OpExtension "SPV_KHR_ray_query" +// CHECK: OpExtension "SPV_KHR_ray_tracing" RaytracingAccelerationStructure AccelerationStructure : register(t0); RayDesc MakeRayDesc() @@ -23,7 +24,7 @@ struct Payload { float4 color; }; -// CHECK: OpTypePointer HitAttributeNV %Attribute + struct Attribute { float2 bary; @@ -34,9 +35,10 @@ void main(inout Payload MyPayload, in Attribute MyAttr) { Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) }; RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); } diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rcall.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_rcall.hlsl similarity index 73% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rcall.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_rcall.hlsl index a5cd85b2d..b38377db9 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rcall.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_rcall.hlsl @@ -1,8 +1,9 @@ -// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -// CHECK: OpCapability RayTracingKHR +// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR -// CHECK: OpExtension "SPV_KHR_ray_tracing" +// CHECK: OpCapability RayTracingKHR // CHECK: OpExtension "SPV_KHR_ray_query" +// CHECK: OpExtension "SPV_KHR_ray_tracing" RaytracingAccelerationStructure AccelerationStructure : register(t0); RayDesc MakeRayDesc() @@ -27,11 +28,12 @@ struct Payload [shader("miss")] void main(inout Payload MyPayload) { Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) }; +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); } diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rchit.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_rchit.hlsl similarity index 75% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rchit.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_rchit.hlsl index 806754f37..5db958e99 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rchit.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_rchit.hlsl @@ -1,8 +1,9 @@ -// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -// CHECK: OpCapability RayTracingKHR +// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR -// CHECK: OpExtension "SPV_KHR_ray_tracing" +// CHECK: OpCapability RayTracingKHR // CHECK: OpExtension "SPV_KHR_ray_query" +// CHECK: OpExtension "SPV_KHR_ray_tracing" RaytracingAccelerationStructure AccelerationStructure : register(t0); RayDesc MakeRayDesc() @@ -23,7 +24,7 @@ struct Payload { float4 color; }; -// CHECK: OpTypePointer HitAttributeNV %Attribute + struct Attribute { float2 bary; @@ -32,11 +33,12 @@ struct Attribute [shader("closesthit")] void main(inout Payload MyPayload, in Attribute MyAttr) { Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) }; +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); } diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rgen.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_rgen.hlsl similarity index 70% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rgen.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_rgen.hlsl index 7cc122601..eedbd89d5 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rgen.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_rgen.hlsl @@ -1,8 +1,9 @@ -// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -// CHECK: OpCapability RayTracingKHR +// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR -// CHECK: OpExtension "SPV_KHR_ray_tracing" +// CHECK: OpCapability RayTracingKHR // CHECK: OpExtension "SPV_KHR_ray_query" +// CHECK: OpExtension "SPV_KHR_ray_tracing" // CHECK: %accelerationStructureNV = OpTypeAccelerationStructureKHR // CHECK-NOT: OpTypeAccelerationStructureKHR @@ -33,11 +34,12 @@ void main() { Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) }; RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); -// CHECK: OpTraceNV {{%\d+}} %uint_0 %uint_255 %uint_0 %uint_1 %uint_0 {{%\d+}} {{%\d+}} {{%\d+}} {{%\d+}} %uint_0 +// CHECK: OpTraceRayKHR {{%[0-9]+}} %uint_0 %uint_255 %uint_0 %uint_1 %uint_0 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 %myPayload TraceRay(AccelerationStructure, 0x0, 0xff, 0, 1, 0, ray, myPayload); } diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rint.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_rint.hlsl similarity index 71% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rint.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_rint.hlsl index b9d762a9f..90a034121 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rint.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_rint.hlsl @@ -1,8 +1,9 @@ -// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -// CHECK: OpCapability RayTracingKHR +// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR -// CHECK: OpExtension "SPV_KHR_ray_tracing" +// CHECK: OpCapability RayTracingKHR // CHECK: OpExtension "SPV_KHR_ray_query" +// CHECK: OpExtension "SPV_KHR_ray_tracing" RaytracingAccelerationStructure AccelerationStructure : register(t0); RayDesc MakeRayDesc() @@ -24,15 +25,21 @@ struct CallData float4 data; }; -[shader("callable")] +struct Attribute +{ + float2 bary; +}; + +[shader("intersection")] void main() { RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); Attribute myHitAttribute = { float2(0.0f,0.0f) }; diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rmiss.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_rmiss.hlsl similarity index 73% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rmiss.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_rmiss.hlsl index a5cd85b2d..77af5c2c6 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_rmiss.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_rmiss.hlsl @@ -1,8 +1,9 @@ -// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -// CHECK: OpCapability RayTracingKHR +// RUN: %dxc -T lib_6_3 -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR -// CHECK: OpExtension "SPV_KHR_ray_tracing" +// CHECK: OpCapability RayTracingKHR // CHECK: OpExtension "SPV_KHR_ray_query" +// CHECK: OpExtension "SPV_KHR_ray_tracing" RaytracingAccelerationStructure AccelerationStructure : register(t0); RayDesc MakeRayDesc() @@ -29,9 +30,10 @@ void main(inout Payload MyPayload) { Payload myPayload = { float4(0.0f,0.0f,0.0f,0.0f) }; RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_1 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_FORCE_OPAQUE, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_3 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); } diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_vs.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_init_vs.hlsl similarity index 74% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_vs.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_init_vs.hlsl index 3984bb5bb..83aed5f2a 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_init_vs.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_init_vs.hlsl @@ -1,8 +1,7 @@ -// RUN: %dxc -T vs_6_5 -E main -fspv-target-env=vulkan1.2 -// CHECK: OpCapability RayQueryKHR -// CHECK: OpCapability RayTraversalPrimitiveCullingKHR -// CHECK: OpExtension "SPV_KHR_ray_query" +// RUN: %dxc -T vs_6_5 -E main -fspv-target-env=vulkan1.2 -spirv %s | FileCheck %s +// CHECK: OpCapability RayQueryKHR +// CHECK: OpExtension "SPV_KHR_ray_query" RaytracingAccelerationStructure AccelerationStructure : register(t0); RWByteAddressBuffer log : register(u0); @@ -33,13 +32,13 @@ void main() { // CHECK: %rayQueryKHR = OpTypeRayQueryKHR // CHECK: %_ptr_Function_rayQueryKHR = OpTypePointer Function %rayQueryKHR -// CHECK: [[rayquery:%\d+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function RayQuery q; RayDesc ray = MakeRayDesc(); -// CHECK: [[accel:%\d+]] = OpLoad %accelerationStructureNV %AccelerationStructure -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_517 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: [[accel:%[0-9]+]] = OpLoad %accelerationStructureNV %AccelerationStructure +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_517 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 q.TraceRayInline(AccelerationStructure,RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES, 0xFF, ray); -// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_5 %uint_255 {{%\d+}} %float_0 {{%\d+}} %float_9999 +// CHECK: OpRayQueryInitializeKHR [[rayquery]] [[accel]] %uint_5 %uint_255 {{%[0-9]+}} %float_0 {{%[0-9]+}} %float_9999 doInitialize(q, ray); } diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_tryAllOps.cs.hlsl b/tools/clang/test/CodeGenSPIRV/rayquery_tryAllOps.cs.hlsl similarity index 97% rename from tools/clang/test/CodeGenSPIRV/unsupported/rayquery_tryAllOps.cs.hlsl rename to tools/clang/test/CodeGenSPIRV/rayquery_tryAllOps.cs.hlsl index 82c5b4f52..b6569fe59 100644 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_tryAllOps.cs.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rayquery_tryAllOps.cs.hlsl @@ -1,4 +1,5 @@ -// RUN: dxc -T cs_6_5 -E CS -fspv-target-env=vulkan1.2 +// RUN: %dxc -T cs_6_5 -E CS -fspv-target-env=vulkan1.2 -O0 -spirv %s | FileCheck %s + // CHECK: OpCapability RayQueryKHR // CHECK: OpExtension "SPV_KHR_ray_query" @@ -28,7 +29,7 @@ void CS() q.TraceRayInline(AccelerationStructure,RAY_FLAG_NONE,0xFF,ray); float4x3 mat4x3; float3x4 mat3x4; -// CHECK: [[rayquery:%\d+]] = OpVariable %_ptr_Function_rayQueryKHR Function +// CHECK: [[rayquery:%[0-9]+]] = OpVariable %_ptr_Function_rayQueryKHR Function // CHECK: OpRayQueryProceedKHR %bool [[rayquery]] while(q.Proceed()) { diff --git a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_assign.cs.hlsl b/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_assign.cs.hlsl deleted file mode 100644 index 4512f49d0..000000000 --- a/tools/clang/test/CodeGenSPIRV/unsupported/rayquery_assign.cs.hlsl +++ /dev/null @@ -1,9 +0,0 @@ -// RUN: %dxc -T cs_6_5 -E CS -fspv-target-env=vulkan1.2 -// CHECK: error: store value of type 'RayQuery' is unsupported - -[numThreads(1,1,1)] -void CS() -{ - RayQuery q; - RayQuery b = q; -}