summaryrefslogtreecommitdiffstats
path: root/HLSL2GLSLConverter/testshaders/TessTestTriDX.hsh
blob: 6280ebd56afd269ddcc7225c2e2698c524910a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
struct VSOutput
{
	float4 f4Position : SV_Position;
	float3 f3Color	: COLOR;
};

// Output patch constant data.
struct HS_CONSTANT_DATA_OUTPUT
{
    float Edges[3]  : SV_TessFactor;
};

HS_CONSTANT_DATA_OUTPUT ConstantHS( InputPatch<VSOutput, 1> p, 
                                    uint BlockID : SV_PrimitiveID,
                                    out float Inside : SV_InsideTessFactor)
{
    HS_CONSTANT_DATA_OUTPUT Factors;
    Factors.Edges[0] = 2.5 + float(BlockID);
    Factors.Edges[1] = 4.5 + p[0].f4Position.x * 1.53;
    Factors.Edges[2] = 5.5 - p[0].f4Position.y * 2.53;
    Inside = 6.2 + p[0].f4Position.x * 1.53;
    return Factors;
}

struct HSOutput
{
    float4 Position : POS;
    float3 Color : COL;
};

[domain("tri")]
[partitioning("fractional_odd")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(1)]
[patchconstantfunc("ConstantHS")]
[maxtessfactor( (float)(32.f+2.f) )]
HSOutput main(InputPatch<VSOutput, 1> inputPatch, uint uCPID : SV_OutputControlPointID)
{
    HSOutput Out;
    Out.Position = inputPatch[uCPID].f4Position;
    Out.Color = inputPatch[uCPID].f3Color;
    return Out;
}