2017-10-12 4 views
0

tessellation을 이해하기 위해 만든 간단한 선체 쉐이더 코드가 있습니다. 이 코드에서는 잘못된 부분을 찾을 수 없지만 컴파일 함수는 항상 false를 반환합니다.HLSL 헐 쉐이더 코드를 컴파일 할 수 없음

내 입력과 출력 구조 :

[domain("tri")] // indicates a triangle patch (3 verts) 
[partitioning("fractional_odd")] // fractional avoids popping 
// vertex ordering for the output triangles 
[outputtopology("triangle_cw")] 
[outputcontrolpoints(3)] 
// name of the patch constant hull shader 
[patchconstantfunc("ConstantsHS")] 
//[maxtessfactor(7.0)] 


cbuffer TessellationBuffer 
{ 
    float tessellationAmount; 
    float3 padding; 
}; 

struct VS_CONTROL_POINT_OUTPUT 
{ 
    float3 vWorldPos : POSITION; 
    float2 vTexCoord : TEXCOORD0; 
    float3 vNormal : NORMAL0; 
}; 

struct HS_CONTROL_POINT_OUTPUT 
{ 
    float3 vWorldPos : POSITION; 
    float2 vTexCoord : TEXCOORD0; 
    float3 vNormal : NORMAL0; 
}; 

struct HS_CONSTANT_DATA_OUTPUT 
{ 
    float Edges[3] : SV_TessFactor; 
    float Inside : SV_InsideTessFactor; 
}; 

내 기능 : 어떤 도움

HS_CONTROL_POINT_OUTPUT HS(InputPatch<VS_CONTROL_POINT_OUTPUT, 3> inputPatch, uint uCPID : SV_OutputControlPointID, uint patchId : SV_PrimitiveID) 
{ 
    HS_CONTROL_POINT_OUTPUT Output; 
    Output.vWorldPos = inputPatch[uCPID].vWorldPos; 
    Output.vTexCoord = inputPatch[uCPID].vTexCoord; 
    Output.vNormal = inputPatch[uCPID].vNormal; 

    return Output; 
}; 

HS_CONSTANT_DATA_OUTPUT ConstantsHS(InputPatch<VS_CONTROL_POINT_OUTPUT, 3> inputPatch, uint PatchID : SV_PrimitiveID ) 
{ 
    HS_CONSTANT_DATA_OUTPUT Output; 

    Output.Edges[0] = tessellationAmount; 
    Output.Edges[1] = tessellationAmount; 
    Output.Edges[2] = tessellationAmount; 
    Output.Inside = tessellationAmount; 
    return Output; 
}; 

덕분에 여기 내 코드입니다.

답변

1

속성은 다음과 같은 엔트리 포인트를 설정할 수있다, 당신의 선체 쉐이더가 유효 : 보조 노트에

[domain("tri")] // indicates a triangle patch (3 verts) 
[partitioning("fractional_odd")] // fractional avoids popping 
// vertex ordering for the output triangles 
[outputtopology("triangle_cw")] 
[outputcontrolpoints(3)] 
// name of the patch constant hull shader 
[patchconstantfunc("ConstantsHS")] 
//[maxtessfactor(7.0)] 
HS_CONTROL_POINT_OUTPUT HS(InputPatch<VS_CONTROL_POINT_OUTPUT, 3> inputPatch, uint uCPID : SV_OutputControlPointID, uint patchId : SV_PrimitiveID) 

, 명령 행 도구 FXC.exe는 것이다 오류 메시지가 인쇄를 할 것이다 올바른 방향으로 넣어 : error X3000: syntax error: unexpected token 'cbuffer'

그리고 난 당신이 언급하는 기능을하는지 모르는 오전, 그것은 실패 할 경우 에러 메시지와 함께 당신을 위해 또한 출력 방울을 HRESULT 아닌 부울 반환하고 D3DCompile.

+0

작동합니다. 감사합니다. 나는이 명령을 몰랐다. 내 함수는 D3DCompile에 대한 호출이며 오류 버퍼를 인쇄하지 않습니다. – mondlicht

관련 문제