From 64a43b17a76d7a8269f55cbe67ef708cd464774c Mon Sep 17 00:00:00 2001 From: "Harsh Aggarwal (NVIDIA)" Date: Mon, 12 May 2025 13:05:34 +0530 Subject: cluster acceleration structure optix 6431 (#7028) * Add cluster geometry intrinsics for ray tracing - Added GetClusterID() method to HitObject class - Added CandidateClusterID() and CommittedClusterID() methods to RayQuery class - Added SPV_NV_cluster_acceleration_structure extension support - Added GL_NV_cluster_acceleration_structure extension support - Added test files for RayQuery and HitObject cluster methods Fixes #6431 * OpRayQueryGetIntersectionClusterIdNV - unrecognized spirv Disabling spirv backend for SPV_NV_cluster_acceleration_structure hlsl.meta.slang(18674): error 29100: unrecognized spirv opcode: OpRayQueryGetIntersectionClusterIdNV result:$$int = OpRayQueryGetIntersectionClusterIdNV &this $iCandidateOrCommitted; ^~~~~~ hlsl.meta.slang(18670): error 30019: expected an expression of type 'int', got 'void' return spirv_asm ^~~~~~~~~ ninja: build stopped: subcommand failed. * 6431 - Fix spirv opcode * Remove tests * Add relevant tests * Review - Simplify tests --- tests/cuda/optix-cluster.slang | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/cuda/optix-cluster.slang (limited to 'tests/cuda') diff --git a/tests/cuda/optix-cluster.slang b/tests/cuda/optix-cluster.slang new file mode 100644 index 000000000..151b9c7dd --- /dev/null +++ b/tests/cuda/optix-cluster.slang @@ -0,0 +1,17 @@ +//TEST:SIMPLE(filecheck=CHECK): -target cuda +//CHECK: __global__ void __closesthit__closestHitShaderA +//CHECK: optixGetClusterId +struct RayPayload +{ + float4 color; +}; + +[shader("closesthit")] +void closestHitShaderA(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attr) +{ + int clusterId = GetClusterID(); + float4 color = float4(0, 0, 0, 1); + if (clusterId >= 0) + color[clusterId] = 1; + payload.color = color; +} -- cgit v1.2.3