Jump to content
  • Advertisement
Sign in to follow this  
WhardieJones

HLSL bit operators

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

The SDK says that >> is an operator. I am trying to use it on an int like int h = c; h = h << 2; The HLSL compalins it doesn't know what << is. What is wrong?

Share this post


Link to post
Share on other sites
Advertisement
It "complains" - error message? is it saying that it doesn't understand the "<<" symbol, or is it saying it's incorrect/bad usage of it?

There isn't really an integer data type in HLSL9 - you have to wait for HLSL10 to get proper integer and bitwise operations. As such it will be emulating that operation as the equivalent floating point operation.

What SDK are you using? The HLSL compiler was one of the more rapidly changing components in the SDK - reproducing on the latest version would probably be a good idea if you haven't/aren't already.

hth
Jack

Share this post


Link to post
Share on other sites
Also, if you're using FXC10 from the Direct3D 10 preview in the Feb2006 DirectX 10 SDK, double check which shader version you're trying to compile for.

FXC10 supports older shader versions - but older shader versions don't support sophisticated integer operations like bitshifts.

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!