- Home /
Question by
Douvantzis · Apr 23, 2016 at 06:58 PM ·
cgcompile-errorhlslglslgles
No acceptable conversion when converting cg shader to glsl
I have a simple shader where at some point I perfrom logical operations component-wise between boolean vectors:
float2 x_ = ( (x >= 0) && (x < a) ) ? float2(0., 0.) : float2(0.5, 0.5);
This compiles ok in HLSL. However when Unity tries to convert it to GLSL, I get:
Shader error in 'Sprites/Advanced': '&&' : wrong operand types no operation '&&' exists that takes a left-hand operand of type 'vec2' and a right operand of type 'vec2' (or there is no acceptable conversion) at line 83 (on gles)
Is there an elegant way to perform logical operations per component so that it compiles to GLSL?
Comment