glslang/Test/hlsl.hull.5.tesc
LoopDawg 4a145dbf45 HLSL: handle split InputPatch templat type in patch constant functions
InputPatch parameters to patch constant functions were not using the
internal (temporary) variable type.  That could cause validation errors
if the input patch had a mixture of builtins and user qualified members.

This uses the entry point's internal form.

There is currently a limitation: if an InputPatch is used in a PCF,
it must also have appeared in the main entry point's parameter list.
That is not a limitation of HLSL.  Currently that situation is detected
and an "implemented" error results.  The limitation can be addressed,
but isn't yet in the current form of the PR.
2017-09-14 16:50:37 -06:00

44 lines
1.0 KiB
GLSL

// Test mixed InputPatch structure: user and builtin members. Hull shaders involve extra
// logic in this case due to patch constant function call synthesis.
// This example tests the PCF EP having an InputPatch, but the main EP does not.
struct HS_Main_Output
{
float4 m_Position : SV_POSITION ;
};
struct HS_Output
{
float fTessFactor [ 3 ] : SV_TessFactor ;
float fInsideTessFactor : SV_InsideTessFactor ;
};
struct HS_Input
{
float4 m_Position : SV_POSITION;
float4 m_Normal : TEXCOORD2;
};
HS_Output HS_ConstFunc ( InputPatch < HS_Input , 3 > I )
{
HS_Output O = (HS_Output)0;
O.fInsideTessFactor = I [ 0 ].m_Position.w + I [ 0 ].m_Normal.w;
return O;
}
[ domain ( "tri" ) ]
[ partitioning ( "fractional_odd" ) ]
[ outputtopology ( "triangle_cw" ) ]
[ patchconstantfunc ( "HS_ConstFunc" ) ]
[ outputcontrolpoints ( 3 ) ]
HS_Main_Output main( uint cpid : SV_OutputControlPointID )
{
HS_Main_Output output = ( HS_Main_Output ) 0 ;
output.m_Position = 0;
return output ;
}