summaryrefslogtreecommitdiff
path: root/tests/cuda/optix-cluster.slang
blob: 151b9c7dd9e27a2d075efd84cca010d0c61169c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}