nir/spirv: Use a C99-style initializer for structure fields
[mesa.git] / src / glsl / opt_rebalance_tree.cpp
index daabdc9fa9976677f6994f4954b048701ee982e8..095f2d7d2f079b7e7a57212de23f3b70388d5eca 100644 (file)
@@ -217,7 +217,9 @@ is_reduction(ir_instruction *ir, void *data)
     * constant fold once split up. Handling matrices will need some more
     * work.
     */
-   if (expr->type->is_matrix()) {
+   if (expr->type->is_matrix() ||
+       expr->operands[0]->type->is_matrix() ||
+       (expr->operands[1] && expr->operands[1]->type->is_matrix())) {
       ird->is_reduction = false;
       return;
    }
@@ -269,11 +271,13 @@ update_types(ir_instruction *ir, void *)
    if (!expr)
       return;
 
-   expr->type =
+   const glsl_type *const new_type =
       glsl_type::get_instance(expr->type->base_type,
-                              MAX2(expr->operands[0]->type->components(),
-                                   expr->operands[1]->type->components()),
+                              MAX2(expr->operands[0]->type->vector_elements,
+                                   expr->operands[1]->type->vector_elements),
                               1);
+   assert(new_type != glsl_type::error_type);
+   expr->type = new_type;
 }
 
 void