Merge pull request #3031 from rg3igalia/sub-group-size-arb-flat-fix
[platform/upstream/glslang.git] / Test / hlsl.color.hull.tesc
1 /////////////
2 // GLOBALS //
3 /////////////
4 cbuffer TessellationBuffer : register(b0)
5 {
6     float tessellationAmount;
7     float3 padding;
8 };
9
10
11 //////////////
12 // TYPEDEFS //
13 //////////////
14 struct HullInputType
15 {
16     float3 position : POSITION;
17     float4 color : COLOR;
18 };
19
20 struct ConstantOutputType
21 {
22     float edges[3] : SV_TessFactor;
23     float inside : SV_InsideTessFactor;
24 };
25
26 struct HullOutputType
27 {
28     float3 position : POSITION;
29     float4 color : COLOR;
30 };
31
32
33 ////////////////////////////////////////////////////////////////////////////////
34 // Patch Constant Function
35 ////////////////////////////////////////////////////////////////////////////////
36 ConstantOutputType ColorPatchConstantFunction(InputPatch<HullInputType, 3> inputPatch, uint patchId : SV_PrimitiveID)
37 {
38     ConstantOutputType output;
39
40
41         // Set the tessellation factors for the three edges of the triangle.
42     output.edges[0] = tessellationAmount;
43     output.edges[1] = tessellationAmount;
44     output.edges[2] = tessellationAmount;
45
46         // Set the tessellation factor for tessallating inside the triangle.
47     output.inside = tessellationAmount;
48
49     return output;
50 }
51
52
53 ////////////////////////////////////////////////////////////////////////////////
54 // Hull Shader
55 ////////////////////////////////////////////////////////////////////////////////
56 [domain("tri")]
57 [partitioning("integer")]
58 [outputtopology("triangle_cw")]
59 [outputcontrolpoints(3)]
60 [patchconstantfunc("ColorPatchConstantFunction")]
61
62 HullOutputType main(InputPatch<HullInputType, 3> patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID)
63 {
64     HullOutputType output;
65
66     // Set the position for this control point as the output position.
67     output.position = patch[pointId].position;
68
69         // Set the input color as the output color.
70     output.color = patch[pointId].color;
71
72     return output;
73 }
74