HLSL: handle PCF input to DS in arbitrary argument position

In the hull shader, the PCF output does not participate in an argument list,
so has no defined ordering.  It is always put at the end of the linkage.  That
means the DS input reading PCF data must be be at the end of the DS linkage
as well, no matter where it may appear in the argument list.  This change
makes sure that happens.

The detection is by looking for arguments that contain tessellation factor
builtins, even as a struct member.  The whole struct is taken as the PCF output
if any members are so qualified.
This commit is contained in:
steve-lunarg
2017-04-03 09:27:53 -06:00
parent fa84001ad7
commit f38cca3ccf
4 changed files with 476 additions and 1 deletions

35
Test/hlsl.domain.2.tese Normal file
View File

@@ -0,0 +1,35 @@
// This will test having the PCF input to the domain shader not be given at the end of
// the argument list. We must move it to the end of the linkage in this case.
struct ds_in_t
{
float4 pos : POSITION;
float3 norm : TEXCOORD0;
};
struct pcf_in_t
{
float flTessFactor [3] : SV_TessFactor;
float flInsideTessFactor : SV_InsideTessFactor;
float foo : PCF_FOO;
};
struct gs_in_t
{
float4 pos : POSITION;
float3 norm : TEXCOORD0;
};
[domain ( "tri" )]
gs_in_t main (pcf_in_t pcf_data, const OutputPatch <ds_in_t, 3> i, float3 tesscoord : SV_DomainLocation)
{
gs_in_t o;
o.pos = i[0].pos + tesscoord.x;
o.norm = i[0].norm + tesscoord.y;
tesscoord.z;
return o;
}