locked
fxc Hull Shader Internal Compiler Error

    Question

  • Hi,

    I get this error from the D3D11 shader compiler when I try to compile the attached (simplified) shader:

    error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Join phase declaring component(s) of input patch constant register vpc[1] which have not been output by previous fork phase(s) or other join phase(s).

    I actually get this error three times, presumably once for each of three join phases. I'm using the Windows 8 SDK and compiling with this command line:

    >fxc /T hs_5_0 /E MainHS test.fx

    As I note in a comment near the end of the shader file, there seems to be a complexity threshold past which I encounter this error. Is there a way I can work around this without compromising my shader's functionality?

    Thanks

    --Paul

    struct HSIn
    {
    	float3 v1 : IN0;
    	float3 v2 : IN1;
    };
    
    struct HSPCOut
    {
    	float ETF[3] : SV_TessFactor;
    	float ITF : SV_InsideTessFactor;
    	float3 v01 : OUT0;
    	float3 v10 : OUT1;
    	float3 v12 : OUT2;
    	float3 v21 : OUT3;
    	float3 v20 : OUT4;
    	float3 v02 : OUT5;
    	float3 vc : OUT6;
    };
    
    [domain("tri")]
    [partitioning("fractional_odd")]
    [outputtopology("triangle_cw")]
    [outputcontrolpoints(3)]
    [patchconstantfunc("MainHSPC")]
    [maxtessfactor(7.000000)]
    HSIn MainHS(InputPatch<HSIn, 3> In, uint CPID : SV_OutputControlPointID)
    {
    	return In[CPID];
    }
    
    HSPCOut MainHSPC(InputPatch<HSIn, 3> In, uint PID : SV_PrimitiveID)
    {
    	HSPCOut Out;
    	Out.ETF[0] = 1;
    	Out.ETF[1] = 1;
    	Out.ETF[2] = 1;
    	Out.ITF = 1;
    	float3 P0 = In[0].v1;
    	float3 P1 = In[1].v1;
    	float3 P2 = In[2].v1;
    	float3 N0 = normalize(In[0].v2);
    	float3 N1 = normalize(In[1].v2);
    	float3 N2 = normalize(In[2].v2);
    	Out.v01 = (2 * P0 + P1 - (dot(P1 - P0, N0) * N0)) / 3;
    	Out.v10 = (2 * P1 + P0 - (dot(P0 - P1, N1) * N1)) / 3;
    	Out.v12 = (2 * P1 + P2 - (dot(P2 - P1, N1) * N1)) / 3;
    	Out.v21 = (2 * P2 + P1 - (dot(P1 - P2, N2) * N2)) / 3;
    	Out.v20 = (2 * P2 + P0 - (dot(P0 - P2, N2) * N2)) / 3;
    	Out.v02 = (2 * P0 + P2 - (dot(P2 - P0, N0) * N0)) / 3;
    	// This is fine
    //	Out.vc = (Out.v01 + Out.v12 + Out.v20) / 3;
    	// This is broken
    	Out.vc = (Out.v01 + Out.v10 + Out.v12 + Out.v21 + Out.v20 + Out.v02) / 6;
    	return Out;
    }
    

    Wednesday, November 14, 2012 1:43 AM