yum-mirror/slang

Making it easier to work with shaders

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

pdeayton-nvGenerate OpExecutionMode PointMode for tessellation shaders (#7662)4f54cccf0

master
1.4 KiB60 linesraw
1//TEST:SIMPLE(filecheck=SPIRV_POINT):-target spirv -stage hull -entry hullMain_point
2//TEST:SIMPLE(filecheck=SPIRV_TRICW):-target spirv -stage hull -entry hullMain_triangle_cw
3//TEST:SIMPLE(filecheck=SPIRV_TRICCW):-target spirv -stage hull -entry hullMain_triangle_ccw
4
5// SPIRV_POINT: OpExecutionMode %hullMain_point PointMode
6// SPIRV_TRICW: OpExecutionMode %hullMain_triangle_cw VertexOrderCw
7// SPIRV_TRICCW: OpExecutionMode %hullMain_triangle_ccw VertexOrderCcw
8
9struct Out {
10    float x;
11};
12
13struct PatchConst {
14    float EdgeTessFactor[4] : SV_TessFactor;
15    float InsideTessFactor[2] : SV_InsideTessFactor;
16};
17
18PatchConst patchConst() {
19    PatchConst o;
20    o.EdgeTessFactor[0] = 1;
21    o.EdgeTessFactor[1] = 1;
22    o.EdgeTessFactor[2] = 1;
23    o.EdgeTessFactor[3] = 1;
24    o.InsideTessFactor[0] = 1;
25    o.InsideTessFactor[1] = 1;
26    return o;
27}
28
29[domain("quad")]
30[partitioning("integer")]
31[outputtopology("point")]
32[outputcontrolpoints(4)]
33[patchconstantfunc("patchConst")]
34Out hullMain_point() {
35    Out o;
36    o.x = 0;
37    return o;
38}
39
40[domain("quad")]
41[partitioning("integer")]
42[outputtopology("triangle_cw")]
43[outputcontrolpoints(4)]
44[patchconstantfunc("patchConst")]
45Out hullMain_triangle_cw() {
46    Out o;
47    o.x = 0;
48    return o;
49}
50
51[domain("quad")]
52[partitioning("integer")]
53[outputtopology("triangle_ccw")]
54[outputcontrolpoints(4)]
55[patchconstantfunc("patchConst")]
56Out hullMain_triangle_ccw() {
57    Out o;
58    o.x = 0;
59    return o;
60}