yum-mirror/slang

Making it easier to work with shaders

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

Jay KwakLegalize array size of SV_TessFactor and SV_InsideTessFactor (#6409)73a8d74bd

master
1.2 KiB47 linesraw
1//TEST:SIMPLE(filecheck=CHK):-target glsl -entry hullMain -stage hull -allow-glsl
2//TEST:SIMPLE(filecheck=CHK):-target spirv-asm -entry hullMain -stage hull -allow-glsl
3
4// Tessllation outsie factor must be an array of size 4 or less
5// Tessllation inside factor must be an array of size 2 or less
6
7struct HsOut
8{
9    float2 pos;
10    float2 hm;
11};
12
13struct HscOut
14{
15    //CHK: error 30024: Cannot convert array of size 5 to array of size 4 as this would truncate data
16    float EdgeTessFactor[5] : SV_TessFactor;
17
18    //CHK: error 30024: Cannot convert array of size 3 to array of size 2 as this would truncate data
19    float InsideTessFactor[3] : SV_InsideTessFactor;
20};
21
22[domain("tri")]
23[partitioning("integer")]
24[outputtopology("triangle_ccw")]
25[outputcontrolpoints(4)]
26[patchconstantfunc("constants")]
27HsOut hullMain()
28{
29    HsOut o;
30    o.pos = 1;
31    o.hm = 2;
32    return o;
33}
34
35HscOut constants()
36{
37    HscOut o;
38    o.EdgeTessFactor[0] = 1;
39    o.EdgeTessFactor[1] = 2;
40    o.EdgeTessFactor[2] = 3;
41    o.EdgeTessFactor[3] = 4;
42    o.EdgeTessFactor[4] = 5;
43    o.InsideTessFactor[0] = 0.5;
44    o.InsideTessFactor[1] = 0.3;
45    o.InsideTessFactor[2] = 0.2;
46    return o;
47}