glsl: Refactor AST-to-HIR code handling variable initializers
[mesa.git] / src / glsl / ir_rvalue_visitor.cpp
index 613b07c3029203f9908d219c355a29b6f2d1d0dc..ed6c7cb6a1a088e6fb1b2d31a5d15324a72983a9 100644 (file)
@@ -53,6 +53,7 @@ ir_rvalue_visitor::visit_leave(ir_texture *ir)
    handle_rvalue(&ir->coordinate);
    handle_rvalue(&ir->projector);
    handle_rvalue(&ir->shadow_comparitor);
+   handle_rvalue(&ir->offset);
 
    switch (ir->op) {
    case ir_tex:
@@ -83,7 +84,14 @@ ir_rvalue_visitor::visit_leave(ir_swizzle *ir)
 ir_visitor_status
 ir_rvalue_visitor::visit_leave(ir_dereference_array *ir)
 {
+   /* The array index is not the target of the assignment, so clear the
+    * 'in_assignee' flag.  Restore it after returning from the array index.
+    */
+   const bool was_in_assignee = this->in_assignee;
+   this->in_assignee = false;
    handle_rvalue(&ir->array_index);
+   this->in_assignee = was_in_assignee;
+
    handle_rvalue(&ir->array);
    return visit_continue;
 }