Jump to content
  • Advertisement
Sign in to follow this  
blaze02

Easy PS question, I think

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

float4 retcolor; float4 texcolor; retcolor = float4(0, 0, 0, 0); texcolor = float4(1, 1, 1, 1); retcolor.r = retcolor.r / texcolor.b; //error on this line error (X4532): cannot map expression to pixel shader instruction set Why does this generate a pixel shader error during compilation? Can I not do var-var division? Also, is there a good place to learn HLSL? I don't understand all the constraints on registers, # of operations, and stuff like that. Any good sites? Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
Can't think what this would be off the top of my head. What pixel shader version are you using ? The only thing I could think is that you cannot read from an output register, but you'd hope the compiler would deal with that for you.

Share this post


Link to post
Share on other sites
I was using ps_1_1.

I switched to ps_2_0 and it works. Thanks for telling me to check that.

So are there any good HLSL tutorials. I want to know the actual syntax so I don't fluster with "color.argb /= othercolor.rrrr" and all the other stupid stuff you can do. Did you know that matrix-vector multiplication is row-major or column-major DEPENDING on which one is first? (i.e. Matrix * vector is different that vector * Matrix). Where can I learn this stuff?

Haha, thanks again. I'll be content for a while using ps2.0, I'll worry about lowering the requirements later if I need to.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by blaze02
Why does this generate a pixel shader error during compilation? Can I not do var-var division?

I was using ps_1_1.

I switched to ps_2_0 and it works. Thanks for telling me to check that.


Because pixel shader instruction set does not contain a div instruction and division is handled by reciprocal multiplication (x / y = x * 1/y). Since [R]e[C]i

rocal instruction was introduced in PS 2.0, 1.1 cannot handle such an operation.

Cheers.

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!