directx - Overlapping registers in Hull shader? -
i doing hardware tessellation , managed basic subdivision effect, tried move on phong tessellation (which rounding edges). when want add outputs in patch constant function , write them, 1 of throws error.
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 tessellation factors 3 edges of triangle. output.edges[0] = inputpatch[0].dep; output.edges[1] = inputpatch[1].dep; output.edges[2] = inputpatch[2].dep; // set tessellation factor tessallating inside 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 error (setting normal) output.f3n1 = inputpatch[1].nor.xyz; output.f3n2 = inputpatch[2].nor.xyz; return output; }
the error thrown is: error x8000: d3d11 internal compiler error: invalid bytecode: components of input declaration register 1 overlap previous declaration same register. opcode #47 (count 1-based). error x8000: d3d11 internal compiler error: invalid bytecode: can't continue validation - aborting. can't seem figure out means (given first attempt @ hull shader).
if comment out, works, if set arbitary value that, works (for example: output.f3n0 = float3(0,1,0) ). tried changing semantics variables, did not help. glad if give me insight on this.
update: hull input follows, requested:
struct hullinputtype { float3 pos : position; float2 tex : texcoord0; float3 nor : texcoord1; float dep : texcoord2; };
okay, seems (float dep : texcoord2;) in hull shader input struct problem. because shader unit deals float4 registers, 2 float3 variables not have been joined, float2 , float joined float4 register. same 2 float2's, float2 , float3 can not joined, , not overlap. guess i'll sending depth (float dep) information (float2 tex) in float3 variable.
it interesting, though works someone. , in domain-to pixel shader not overlap registers in such way.
update: not work, error went away, can compile shader, if try use variable assigning input struct whole graphics rendering stops work (even untessellated calls). happens on hardware device, on warp works somehow.
update2: fixed it, sending float4s, not 1 bit. strange not have in vertex , pixel shaders, maybe glitch? or gpu hardware uncompatibility (nvidia gt525m).
Comments
Post a Comment