일부 하드웨어 테셀레이션을 수행하고 기본 세분화 효과를 얻으려고 했으므로 Phong 테셀레이션 (반올림 가장자리 용)으로 이동하려고했습니다. 이제 패치 상수 함수 (Patch Constant Function)에 여분의 출력을 추가하고 쓰기를 원하지만 그 중 하나는 오류를 던집니다.헐 (hull) 쉐이더의 겹쳐지는 레지스터?
struct ConstantOutputType
{
float edges[3] : SV_TessFactor;
float inside : SV_InsideTessFactor;
float3 f3B0 : POSITION0;
float3 f3B1 : POSITION1;
float3 f3B2 : POSITION2;
float3 f3N0 : NORMAL0;
float3 f3N1 : NORMAL1;
float3 f3N2 : NORMAL2;
};
ConstantOutputType PatchConstantFunction(InputPatch<HullInputType, 3> inputPatch, uint patchId : SV_PrimitiveID)
{
ConstantOutputType output = (ConstantOutputType)0;
// Set the tessellation factors for the three edges of the triangle.
output.edges[0] = inputPatch[0].dep;
output.edges[1] = inputPatch[1].dep;
output.edges[2] = inputPatch[2].dep;
// Set the tessellation factor for tessallating inside the triangle.
output.inside = (inputPatch[0].dep + inputPatch[1].dep + inputPatch[2].dep)/3.0f;
output.f3B0 = inputPatch[0].pos.xyz;
output.f3B1 = inputPatch[1].pos.xyz;
output.f3B2 = inputPatch[2].pos.xyz;
//output.f3N0 = inputPatch[0].nor.xyz; <=====This throws the error (setting the normal)
output.f3N1 = inputPatch[1].nor.xyz;
output.f3N2 = inputPatch[2].nor.xyz;
return output;
}
발생 오류이다 오류 X8000 : D3D11 내부 컴파일러 에러 잘못된 바이트 코드 같은 레지스터 이전 선언 레지스터 1 오버랩 입력 요소 선언. Opcode # 47 (개수는 1 기준). 오류 X8000 : D3D11 내부 컴파일러 오류 : 잘못된 바이트 코드 : 유효성 검사를 계속할 수 없습니다 - 중단합니다. 그게 무슨 뜻인지 알 수가 없어. (선체 쉐이더에 대한 나의 첫 시도라는 점을 감안할 때).
만약 내가 그것에 대해 임의의 값을 설정하면, 그것을 작품, 그것을 작품도 작동합니다 (예 : output.f3N0 = float3 (0,1,0)). 또한 변수에 대한 의미를 변경하려고 시도했지만 도움이되지 않았습니다. 누군가 내가 이것에 대해 약간의 통찰력을 줄 수 있다면 매우 기쁠 것입니다.
UPDATE : 헐 입력 요청에 따라, 다음과
가struct HullInputType
{
float3 pos : POSITION;
float2 tex : TEXCOORD0;
float3 nor : TEXCOORD1;
float dep : TEXCOORD2;
};
'HullInputType' 정의를 제공해주세요. – Drop
답장을 보내 주셔서 감사합니다. –
오류를 재현하지 못했습니다. 게시 된 코드를 기반으로, 나는 [헐 셰이더를 이와 같이] 만들었습니다 (http://pastebin.com/Eivr3hwj) (어딘가 의미가 없습니다). Visual Studio 2012 Update 3 및 Visual Studio 2013 preview Update 1과 함께 제공되는 HLSL 컴파일러로 컴파일됩니다.'fxc' 또는'D3DCompiler.dll' 버전은 무엇을 사용합니까? 처음에 나는'HullInputType'이 틀렸다고 생각했고 아마도 제대로 정렬되지 않았을 것입니다. 하지만 지금은 단지'fxc.exe' 버그라고 생각합니다 (많은 것들이 있습니다). 링크에서 내 코드를 컴파일하고 /하거나 컴파일러 버전을 변경 (업그레이드/다운 그레이드)하십시오. – Drop