yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
634e3960c
master
1//TEST:SIMPLE(filecheck=SPIRV): -entry main -stage vertex -target spirv -emit-spirv-directly 2//TEST:SIMPLE(filecheck=GLSL): -entry main -stage vertex -target glsl 3//TEST:SIMPLE(filecheck=METAL): -entry main -stage vertex -target metal 4//TEST:SIMPLE(filecheck=WGSL): -entry main -stage vertex -target wgsl 5 6struct VSInput 7{ 8 uint vertexID : SV_VulkanVertexID; 9 uint instanceID : SV_VulkanInstanceID; 10}; 11 12struct VSOutput 13{ 14 float4 position : SV_POSITION; 15}; 16 17[shader("vertex")] 18VSOutput main(VSInput input) 19{ 20 VSOutput output; 21 output.position = float4(input.vertexID + input.instanceID); 22 23 // SPIRV-DAG: BuiltIn InstanceIndex 24 // SPIRV-DAG: BuiltIn VertexIndex 25 // SPIRV-NOT: BuiltIn BaseInstance 26 // SPIRV-NOT: BuiltIn BaseVertex 27 28 // GLSL-NOT: GL_ARB_shader_draw_parameters 29 // GLSL-DAG: gl_VertexIndex 30 // GLSL-NOT: gl_BaseVertex 31 // GLSL-DAG: gl_InstanceIndex 32 // GLSL-NOT: gl_BaseInstance 33 34 // METAL-DAG: vertex_id 35 // METAL-DAG: instance_id 36 37 // WGSL-DAG: vertex_index 38 // WGSL-DAG: instance_index 39 40 return output; 41} 42