The GLSL IR ir_binop_logic_* operations match the source language operators in that they only operate on scalars.
In talking to Ilia, I realized that the vectorizer pass doesn't know about that, and so it will happily vectorize the vertex shader in the piglit test below. The i965 driver emits perfectly fine code for this and passes the test, but ir_validate asserts that the operands to && are scalar booleans. Should we relax this restriction and let the logical and/or/xor/not operations operate per-component? Perhaps a small GLSL extension codifying this and allowing it in the source language should be in order? Sounds like something like this would simplify some code Ilia's working on. [require] GLSL >= 1.30 [vertex shader] in vec4 vertex; out vec4 color; uniform bvec4 a, b; void main() { gl_Position = vertex; color.x = float(a.x && b.x); color.y = float(a.y && b.y); color.z = float(a.z && b.z); color.w = float(a.w && b.w); } [fragment shader] in vec4 color; out vec4 frag_color; void main() { frag_color = color; } [vertex data] vertex/float/2 -1.0 -1.0 1.0 -1.0 1.0 1.0 -1.0 1.0 [test] uniform ivec4 a 1 1 1 1 uniform ivec4 b 1 0 0 1 draw arrays GL_TRIANGLE_FAN 0 4 probe all rgba 1.0 0.0 0.0 1.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev