Jump to content
  • Advertisement
Sign in to follow this  

HLSL ps_3_0 compilation problem

This topic is 4754 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

Hi there, I've written a pixel shader for SM 3.0 hardware that uses all 10 allowed input registers. The problem is that the HLSL compiler fails to compile it for ps_3_0 telling me register v10 exceeds the maximum input register allowed v9. I used the compile target ps_3_sw and looked at the code. It seems the compiler uses input registers from v1 to v10. Shouldn't it be v0 to v9? I copied the shader assembler code and corrected it manually. The resulting code ran fine on my GF6. Is it me or the compiler? Is there anyone with the same problems? Markus

Share this post

Link to post
Share on other sites
Could somebody check this test case as I want to be sure there's nothing wrong with my installation? The example should compile as is as SM 2.0. When setting VS_TARGET to vs_3_0 and PS_TARGET to ps_3_0 it gives an error stating register v10 is not available.

BTW: What's the right place to send bug reports to Microsoft regarding this issue? directx@microsoft.com ?


float4x4 worldViewProj : WorldViewProjection;

struct vertexInput
float3 position : POSITION;
float4 texCoordDiffuse : TEXCOORD0;

struct vertexOutput
float4 hPosition : POSITION;
float4 tex0 : COLOR0;
float4 tex1 : COLOR1;
float4 tex2 : TEXCOORD0;
float4 tex3 : TEXCOORD1;
float4 tex4 : TEXCOORD2;
float4 tex5 : TEXCOORD3;
float4 tex6 : TEXCOORD4;
float4 tex7 : TEXCOORD5;
float4 tex8 : TEXCOORD6;
float4 tex9 : TEXCOORD7;

float f1=1.4;
float f2=2.4;
float f3=3.4;
float f4=4.4;
float f5=5.4;
float f6=6.4;
float f7=7.4;
float f8=8.4;
float f9=9.4;

vertexOutput VS_TransformAndTexture(vertexInput IN)
vertexOutput OUT;
OUT.hPosition = mul( float4(IN.position.xyz , 1.0) , worldViewProj);
OUT.tex0 = IN.texCoordDiffuse;
OUT.tex1 = f1*IN.texCoordDiffuse;
OUT.tex2 = f2*IN.texCoordDiffuse;
OUT.tex3 = f3*IN.texCoordDiffuse;
OUT.tex4 = f4*IN.texCoordDiffuse;
OUT.tex5 = f5*IN.texCoordDiffuse;
OUT.tex6 = f6*IN.texCoordDiffuse;
OUT.tex7 = f7*IN.texCoordDiffuse;
OUT.tex8 = f8*IN.texCoordDiffuse;
OUT.tex9 = f9*IN.texCoordDiffuse;

return OUT;

#define VS_TARGET vs_2_0
#define PS_TARGET ps_2_0

float4 PS_Textured( vertexOutput IN): COLOR
return IN.tex0+IN.tex1+IN.tex2+IN.tex3+IN.tex4+IN.tex5+IN.tex6+IN.tex7+IN.tex8+IN.tex9;

technique test
pass p0
VertexShader = compile VS_TARGET VS_TransformAndTexture();

PixelShader = compile PS_TARGET PS_Textured();

technique test_assembly
pass p0
VertexShader = compile vs_3_0 VS_TransformAndTexture();

PixelShader = asm {
dcl_texcoord0 v1
dcl_texcoord1 v2
dcl_texcoord2 v3
dcl_texcoord3 v4
dcl_texcoord4 v5
dcl_texcoord5 v6
dcl_texcoord6 v7
dcl_texcoord7 v8
dcl_texcoord8 v9
dcl_texcoord9 v0
mov r0, v1
add r0, r0, v2
add r0, r0, v3
add r0, r0, v4
add r0, r0, v5
add r0, r0, v6
add r0, r0, v7
add r0, r0, v8
add r0, r0, v9
add oC0, r0, v0

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!