Jump to content

  • Log In with Google      Sign In   
  • Create Account


error X3025 and D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 ozkill   Members   -  Reputation: 107

Like
0Likes
Like

Posted 31 July 2012 - 12:05 AM

Hi.

i tried to compile shader effect. and i met error "error X3025: global variables are implicitly constant, enable compatibility mode to allow modification"
but when i try to compile with flag D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY, works well.
If i use this flag, no error and no trouble. When i googling, can find many same troubles and same solutions.
Well... OK. however it's works.

but i confused.
according to MSDN, D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY flag compile to higher level than ps_1_x. that's all. it just control shader level.
But as a result, It really be involved in semantic and syntax.

Why this happen?
Moreover, I never use ps_1_x.
Why Why Why Why this happen?

thank you.

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 24193

Like
1Likes
Like

Posted 31 July 2012 - 12:35 AM

You're modifying a uniform shader variable, which is pretty bad practice, hence why they decided to turn it into an error.

Can you post the code?

If you just want to make the error go away without understanding why your code is bad, try adding the static keyword on the front of the variable.

#3 ozkill   Members   -  Reputation: 107

Like
0Likes
Like

Posted 31 July 2012 - 01:57 AM

thank you for reply.
but i understand why that error happen.
I want to know why this error does not appear with D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY flag.
i want to know correlation between error X3025 and ps_1_x.

#4 Hodgman   Moderators   -  Reputation: 24193

Like
0Likes
Like

Posted 31 July 2012 - 03:25 AM

It is possible for the compiler to let you modify uniform variables, but they decided to turn it into an error, because it's not good practice and the modifications are only local (they don't affect other pixels, or persist after the current pixel is finished).

e.g. if you wrote some code like this:
uniform float myValue;
float4 ps_main( ... )
{
  myValue = myValue * 2;
  return myValue.xxxx;
}
Then the compiler can choose to transform it into this valid code:
uniform float myValue;
static float myMutableValue;
float4 ps_main( ... )
{
  myMutableValue = myValue;
  myMutableValue = myMutableValue * 2;
  return myMutableValue.xxxx;
}
And in the old version, the compiler did used to do this. In the new version, they decided that you should do this yourself, instead of it being automatic.

The backwards compatibility flag tells the compiler to revert to the old behaviour, so you can compile old shaders.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS