yum-mirror/slang

Making it easier to work with shaders

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

Yong HeEmit missing atomic64 capability, fix int-typed builtin used in both vs and fs. (#6314)0bc18d233

master
554 B19 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv
2
3// ViewIndex builtin should be declared twice, once for vertex and once for fragment shader.
4// Because the fragment shader builtin needs Flat, and vertex shader does not.
5
6// CHECK: OpDecorate %{{.*}} BuiltIn ViewIndex
7// CHECK: OpDecorate %{{.*}} BuiltIn ViewIndex
8
9[shader("vertex")]
10float4 vert(int _viewportIndex : SV_ViewID):SV_Position
11{
12    return float4(_viewportIndex);
13}
14
15[shader("fragment")]
16float4 frag(int _viewportIndex : SV_ViewID) : SV_Target
17{
18    return float4(_viewportIndex, 0, 0, 1);
19}