• Advertisement
Sign in to follow this  

What does this shader compiler error mean?

This topic is 3290 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm trying to compile a vertex shader but I get this error about problems when writing to output registers, but I can't figure out what the problem is nor can I find any documentation that explains the meaning of this error code. The standalone compiler (fxc) gives this error: error X5467: Dest register type for LRP must be temp (r#). And the line that produces this error is: Out.Depth.x = Depth*FarZMult; Here is the entire shader source: float4x4 ViewProjMatrix : register(c0); float4 EyePos : register(c4); float4 EyeDir : register(c5); float4 NearPlane : register(c6); float FarZMult : register(c7); float4 ChunkPos : register(c16); float4 ChunkRange : register(c17); float4 PosLow[216] : register(c18); // ----------------------------------------------------------------------------------------- // vertex shader input channels. // ----------------------------------------------------------------------------------------- struct VSInput { float4 Pos1 : COLOR0; float4 NormalAndDitherFactor1 : COLOR1; float4 LightComponentsAndMaterial1 : COLOR2; ///////////////////////////////////////////////////////////////////////////////////////// float4 Pos2 : COLOR0; float4 NormalAndDitherFactor2 : COLOR1; float4 LightComponentsAndMaterial2 : COLOR2; }; // ----------------------------------------------------------------------------------------- // vertex shader output channels. // ----------------------------------------------------------------------------------------- struct VSOutput { float4 Pos : POSITION; float Depth : TEXCOORD0; float4 NormalAndDitherFactor : COLOR0; float4 LightComponentsAndMaterial : COLOR1; }; // ----------------------------------------------------------------------------------------- // vertex shader function (input channels). // ----------------------------------------------------------------------------------------- VSOutput main(VSInput In) { VSOutput Out = (VSOutput)0; ///////////////////////////////////////////////////////////////////////////////////////// float3 Pos1, Pos2; float4 Pos; float3 Normal1, Normal2; /////////////////////// /////// Unpack Position 1 ////////////////////////////////////// int PosLowIndex = D3DCOLORtoUBYTE4(In.Pos1.w); Pos1 = ChunkPos + ChunkPos.w*(In.Pos1 + PosLow[PosLowIndex]); /////////////////////// /////// Unpack Position 2 ////////////////////////////////////// PosLowIndex = D3DCOLORtoUBYTE4(In.Pos2.w); Pos2 = ChunkPos + ChunkPos.w*(In.Pos2 + PosLow[PosLowIndex]); ///////////////////////////////////////////////////////////////////////////////////////// float Dist = distance(EyePos.xyz, Pos1.xyz); float Ratio = (Dist - ChunkRange.z)/ChunkRange.w; // change to multiply float Ratio2 = saturate(Ratio); float Ratio1 = 1.0f - Ratio2; ////////////////////////////// transform Position /////////////////////////////////////// Pos.xyz = Pos1*Ratio1 + Pos2*Ratio2; Pos.w = 1.0f; Out.Pos = mul(ViewProjMatrix, Pos); ////////////////////////// Compute distance to near plane /////////////////////////////// float Depth = Pos.x*NearPlane.x + Pos.y*NearPlane.y + Pos.z*NearPlane.z + NearPlane.w; Out.Depth.x = Depth*FarZMult; //////////////////////// Pass on Normal Vector And Dither Factor //////////////////////// Out.NormalAndDitherFactor = Ratio1*In.NormalAndDitherFactor1 + Ratio2*In.NormalAndDitherFactor2; /////////////////////// Pass on Light Components and Material /////////////////////////// Out.LightComponentsAndMaterial.xyz = In.LightComponentsAndMaterial1.xyz*Ratio1 + In.LightComponentsAndMaterial2.xyz*Ratio2; Out.LightComponentsAndMaterial.w = In.LightComponentsAndMaterial1.w; ///////////////////////////////////////////////////////////////////////////////////////// return Out; }

Share this post


Link to post
Share on other sites
Advertisement
I've found the problem. As you can see in the code above, I had used the wrong input register numbers in the VSInput struct, COLOR0, COLOR1, COLOR2 and then again COLOR0, COLOR1, COLOR2. Should have been 0, 1, 2, 3, 4, 5.

The reason I'm using all colors for input is because all values are compressed to bytes. I'm rendering scenes with millions of vertices, streamed from the hard-disk. I need to save a lot of both video and system mem and increase data transfer speed from hard-disk.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement