Jump to content
  • Advertisement
Sign in to follow this  
Shawn19841006

fxc option /Gfp, prefer flow control doesn't work for ps_2_b

This topic is 3223 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 all I am rewriting a shader of ps_3_0 to ps_2_b. The main diffculty is that it uses too many float constant registers. I found that the compiler uses only cmp instruction for branch for ps_2_b, so that a bool constant is compiled into a float constant. I need to force the compiler to use if instruction so that the bool constant can be bool constant. I tried to use /Gfp for ps_3_0 and it works fine, but for ps_2_b the compiler just won't change cmp to if. It's so annoying. Another solution would be to compile the shader using ps_3_0 profile and set /Gfp, then change the outputed assembly code to fit into ps_2_b. But this seems to be a dirty way. Any suggestion?

Share this post


Link to post
Share on other sites
Advertisement
You can try explicitly binding the constant to a boolean register, like this:

bool drawLights : register(b0);

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!