yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
64a43b17a
master
1//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage anyhit -entry main -target glsl -capability GL_EXT_ray_tracing -capability GL_NV_cluster_acceleration_structure 2 3//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -emit-spirv-directly -stage anyhit -entry main -target spirv-assembly -capability SPV_KHR_ray_tracing -capability SPV_NV_cluster_acceleration_structure 4 5// CHECK_GLSL: #extension GL_EXT_ray_tracing : require 6// CHECK_GLSL: #extension GL_NV_cluster_acceleration_structure : require 7__glsl_extension(GL_EXT_ray_tracing) 8__glsl_extension(GL_NV_cluster_acceleration_structure) 9 10layout(binding = 0) uniform accelerationStructureEXT as; 11 12//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outBuffer 13//TEST_INPUT:end 14 15// This test demonstrates the usage of cluster acceleration structure intrinsics 16// in ray tracing for the NVIDIA extension. 17 18void main() 19{ 20 // CHECK_GLSL-DAG: gl_ClusterIDNV 21 // CHECK_SPV-DAG: ClusterIDNV 22 23 // Get the cluster ID of the current hit 24 int clusterId = gl_ClusterIDNV; 25 26 // Check if the hit is part of a cluster 27 bool isClusterHit = (clusterId != gl_ClusterIDNoneNV); 28 29 // Skip hits for certain cluster IDs (example: skip cluster ID 5) 30 if (isClusterHit && clusterId == 5) 31 { 32 ignoreIntersectionEXT; 33 } 34}