glsl: Fix ir_quadop_vector validation
authorMichael Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Tue, 10 May 2022 07:48:53 +0000 (10:48 +0300)
committerMarge Bot <emma+marge@anholt.net>
Tue, 10 May 2022 23:53:33 +0000 (23:53 +0000)
Some glcts tests have failed due to incorrect processing of `ir_quadop_vector` in
`ir_validation`. e.g:
`GLES31.functional.shaders.builtin_functions.integer.imulextended.int_highp_geometry`

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6461
Fixes: 23cde71b ("glsl: Stop lowering ir_quadop_vector.")

Reviewed-by: Emma Anholt <emma@anholt.net>
Signed-off-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16420>

src/compiler/glsl/ir_validate.cpp

index c60c36c..89feaa7 100644 (file)
@@ -942,8 +942,14 @@ ir_validate::visit_leave(ir_expression *ir)
        *  - Number of operands must matche the size of the resulting vector.
        *  - Base type of the operands must match the base type of the result.
        */
-      assert(ir->type->is_vector());
       switch (ir->type->vector_elements) {
+      case 1:
+         assert(ir->operands[0]->type->is_scalar());
+         assert(ir->operands[0]->type->base_type == ir->type->base_type);
+         assert(ir->operands[1] == NULL);
+         assert(ir->operands[2] == NULL);
+         assert(ir->operands[3] == NULL);
+         break;
       case 2:
         assert(ir->operands[0]->type->is_scalar());
         assert(ir->operands[0]->type->base_type == ir->type->base_type);