HLSL/Cg do not allow texture fetching inside conditional blocks. To get around this I am first checking a variable and performing some computations, afterwards I set a float flag to 0.0
or 1.0
, depending on the computations. I'd like to trigger a texture fetch only if the flag is 1.0
or not null
. I kind of hoped this would do the trick:
float4 TU0_atlas_colour=pseudoBool*tex2Dlod(TU0_texture, float4(tileCoord, 0, mipLevel));
I want to know if pseudoBool
is 0
, will the texture fetch function still be called and produce overhead? I was hoping to prevent it from getting executed via this trick that usually works in plain C/C++.