yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaHandling SV_ClipDistance system semantic on GLSL/VK (#2942)4eef0424a

master
737 B35 linesraw
1// sv-clip-distance-split.slang
2
3//TEST:SIMPLE(filecheck=CHECK): -profile sm_5_0 -stage vertex -entry mainVertex -target glsl
4
5//CHECK: out float  gl_ClipDistance[3];
6//CHECK: gl_ClipDistance[0] =
7//CHECK: gl_ClipDistance[1] =
8//CHECK: gl_ClipDistance[2] =
9
10struct VertexInput 
11{
12    float3 position : POSITION; 
13};
14
15struct VertexOutput
16{ 
17    float4 position : SV_Position; 
18    
19    float clip0 : SV_ClipDistance0;
20    float clip1 : SV_ClipDistance1; 
21}; 
22
23VertexOutput mainVertex(VertexInput vi, out float outClip : SV_ClipDistance2) 
24{ 
25    VertexOutput vo;
26
27    vo.position = float4(vi.position, 1);
28    vo.clip0 = vi.position.x / 10;
29    vo.clip1 = vi.position.z * 2;
30    
31    outClip = vi.position.y + 1;
32    
33    return vo; 
34} 
35