I am using DX9 and targeting Shader Model 2.
All my shader files include a common shader file, which looks like this:
float4x4 auWorldMat : register(c0);
float4x4 auWorldInvTransMat : register(c4);
float4x4 auViewMat : register(c8);
float4x4 auProjMat : register(c12);
float4x4 auViewProjMat : register(c16);
float3 auCameraPosition : register(c20);
float auTimeDt : register(c21);
float auTimeAbs : register(c22);
float4 auMat_EmissiveColor : register(c23);
float4 auMat_AmbientColor : register(c24);
float4 auMat_DiffuseColor : register(c25);
float4 auMat_SpecularColor : register(c26);
float3 auLight0_Position : register(c30);
float3 auLight0_Direction : register(c31);
float4 auLight0_AttenAndRange : register(c32);
float4 auLight0_AmbientColor : register(c33);
float4 auLight0_DiffuseColor : register(c34);
etc...
My engine sets these values every frame per SetVertexShaderConstantF or SetPixelShaderConstantF().
Unfortunately I just run into the following problem:
I have a pixel shader, that reads auLight0_DiffuseColor, which gives the following compile error:
error X5200: (Second source param) Invalid register number: 34. Max allowed for this type is 31.
, which apparently only has 32 c# input registers.[/quote]
Apparently SM2.0 PS only support 32 c# input registers.
So what would be the best way to fix this problem?
Upgrade to SM3.0 (my game should also run on old hardware (Win XP). Is SM3.0 standard even for old machines?)
Or should I put all values that are read exclusively by the PS into the first c# registers and move Vertex Shader specific variables (like
world matrix, proj matrix etc.) into the higher registers?
Thanks!