glslang/Test/hlsl.hull.ctrlpt-1.tesc
steve-lunarg 194f0f39ec HLSL: require tessellation factors to be fixed size arrays
SPIR-V requires that tessellation factor arrays be size 4 (outer) or 2 (inner).
HLSL allows other sizes such as 3, or even scalars.  This commit converts
between them by forcing the IO types to be the SPIR-V size, and allowing
copies between the internal and IO types to handle these cases.
2017-03-30 14:37:02 -06:00

44 lines
883 B
GLSL

// ***
// per-control-point invocation of PCF from entry point return value
// ***
struct hs_in_t
{
float3 val : TEXCOORD0;
};
struct hs_pcf_t
{
float tfactor[3] : SV_TessFactor; // must turn into a size 4 array in SPIR-V
float flInFactor : SV_InsideTessFactor; // must turn into a size 2 array in SPIR-V
};
struct hs_out_t
{
float3 val : TEXCOORD0;
};
[ domain ("tri") ]
[ partitioning ("fractional_odd") ]
[ outputtopology ("triangle_cw") ]
[ outputcontrolpoints (3) ]
[ patchconstantfunc ( "PCF" ) ]
hs_out_t main (InputPatch <hs_in_t, 3> i , uint cpid : SV_OutputControlPointID)
{
hs_out_t o;
o.val = cpid;
return o;
}
hs_pcf_t PCF( const OutputPatch <hs_out_t, 3> pcf_out)
{
hs_pcf_t o;
o.tfactor[0] = pcf_out[0].val.x;
o.tfactor[1] = pcf_out[1].val.x;
o.tfactor[2] = pcf_out[2].val.x;
o.flInFactor = 4;
return o;
}