 9cee73e028
			
		
	
	
		9cee73e028
		
	
	
	
	
		
			
			This PR emulates per control point inputs to patch constant functions. Without either an extension to look across SIMD lanes or a dedicated stage, the emulation must use separate invocations of the wrapped entry point to obtain the per control point values. This is provided since shaders are wanting this functionality now, but such an extension is not yet available. Entry point arguments qualified as an invocation ID are replaced by the current control point number when calling the wrapped entry point. There is no particular optimization for the case of the entry point not having such an input but the PCF still accepting ctrl pt frequency data. It'll work, but anyway makes no so much sense. The wrapped entry point must return the per control point data by value. At this time it is not supported as an output parameter.
		
			
				
	
	
		
			44 lines
		
	
	
		
			797 B
		
	
	
	
		
			GLSL
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			797 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;
 | |
|     float flInFactor : SV_InsideTessFactor;
 | |
| }; 
 | |
| 
 | |
| 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;
 | |
| }
 |