glsl-optimizer
glsl-optimizer copied to clipboard
all( ) and && operator inside
Hi,
I have something like that in my shader :
bool InRect( vec2 uv ){
return all( greaterThan( uv , vec2(1.0/1024.0) ) && lessThan( uv , vec2(1023.0/1024.0) ) );
}
greaterThan and lessThan returns bvec2. So ( bvec2 && bvec2 ) return bvec2 too. Thats why I used all( bvec2 ).
glsl-optimizer sees ( bvec2 && bvec2 ) as regular bool && bool so the return type is bool. And all() doesn't allow to bool as an input, so the whole shader optimalization is broken.
BTW, is my solution enought good for testing for uv beeing inside rectangle ?