glsl: fix block member alignment validation for vec3
[mesa.git] / src / compiler / glsl / opt_tree_grafting.cpp
index 812f996fb813197b18a8a1ed001e35b7d47f946f..6b5d93af66162380fef12003d3cdf560ecb9acc6 100644 (file)
@@ -232,7 +232,7 @@ ir_tree_grafting_visitor::visit_enter(ir_call *ir)
 ir_visitor_status
 ir_tree_grafting_visitor::visit_enter(ir_expression *ir)
 {
-   for (unsigned int i = 0; i < ir->get_num_operands(); i++) {
+   for (unsigned int i = 0; i < ir->num_operands; i++) {
       if (do_graft(&ir->operands[i]))
         return visit_stop;
    }
@@ -267,7 +267,7 @@ ir_tree_grafting_visitor::visit_enter(ir_texture *ir)
    if (do_graft(&ir->coordinate) ||
        do_graft(&ir->projector) ||
        do_graft(&ir->offset) ||
-       do_graft(&ir->shadow_comparitor))
+       do_graft(&ir->shadow_comparator))
         return visit_stop;
 
    switch (ir->op) {
@@ -368,6 +368,20 @@ tree_grafting_basic_block(ir_instruction *bb_first,
           lhs_var->data.mode == ir_var_shader_shared)
          continue;
 
+      if (lhs_var->data.precise)
+         continue;
+
+      /* Do not graft sampler and image variables. This is a workaround to
+       * st/glsl_to_tgsi being unable to handle expression parameters to image
+       * intrinsics.
+       *
+       * Note that if this is ever fixed, we still need to skip grafting when
+       * any image layout qualifiers (including the image format) are set,
+       * since we must not lose those.
+       */
+      if (lhs_var->type->is_sampler() || lhs_var->type->is_image())
+         continue;
+
       ir_variable_refcount_entry *entry = info->refs->get_variable_entry(lhs_var);
 
       if (!entry->declaration ||