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

Started by
0 comments, last by MJP 14 years, 3 months ago
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?
Advertisement
You can try explicitly binding the constant to a boolean register, like this:
bool drawLights : register(b0);

This topic is closed to new replies.

Advertisement