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