yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Harsh Aggarwal (NVIDIA)Fix intrinsic LoadLocalRootTableConstant for optix (#7949)e595743b5

master
604 B19 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target cuda
2//TEST:SIMPLE(filecheck=CHECK-PTX): -target ptx -Xnvrtc -I"./external/optix-dev/include/" -entry closestHitShaderA
3//CHECK: __global__ void __closesthit__closestHitShaderA
4//CHECK: optixGetClusterId
5struct RayPayload
6{
7    float4 color;
8};
9
10[shader("closesthit")]
11void closestHitShaderA(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attr)
12{
13    //CHECK-PTX:_optix_get_cluster_id 
14    int clusterId = GetClusterID();
15    float4 color = float4(0, 0, 0, 1);
16    if (clusterId >= 0)
17        color[clusterId] = 1;
18    payload.color = color;
19}