yum-mirror/slang

Making it easier to work with shaders

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

Yong HeLower varying parameters as pointers instead of SSA values. (#5919)c43f6fa55

master
822 B32 linesraw
1// gh-841.slang
2
3//TEST:CROSS_COMPILE(filecheck=SPV): -profile ps_5_0 -entry main -target spirv-assembly
4//TEST:CROSS_COMPILE(filecheck=GLSL): -profile ps_5_0 -entry main -target glsl
5
6// GitHub issue #841: failing to emit `flat` modifier in output GLSL when required
7
8struct RasterVertex
9{
10  // location 0
11	float4 c : COLOR;
12
13  // Make sure that the input value in location 1 is decorated as Flat
14  // SPV-DAG: OpDecorate [[VAL:%[_A-Za-z0-9]+]] Location 1
15  // SPV-DAG: [[VAL]] = OpVariable {{.*}} Input
16  // SPV-DAG: OpDecorate [[VAL]] Flat
17  //
18  // Likewise for GLSL
19  // GLSL:      flat layout(location = 1)
20  // GLSL-NEXT: in uint {{[[:alnum:]_]+}};
21  //
22  // location 1
23	uint u : FLAGS;
24};
25
26float4 main(RasterVertex v) : SV_Target
27{
28	float4 result = v.c;
29	if((v.u & 1) != 0)
30	    result += 1.0;
31   return result;
32}