mesa: remove support for GL_APPLE_client_storage extension
[mesa.git] / src / glsl / ir_hv_accept.cpp
index 46bc5b17fe3f25f6145fb999f25eb2c1f8d58947..d33fc85bf0a6b09a2b5e05565207db66b4b3a83f 100644 (file)
 /**
  * Process a list of nodes using a hierarchical vistor
  *
+ * \warning
  * This function will operate correctly if a node being processed is removed
- * from the list.  If nodes are inserted before the current node, they will be
- * processed next.
+ * from the list.  However, if nodes are added to the list after the node being
+ * processed, some of the added nodes may not be processed.
  */
 ir_visitor_status
 visit_list_elements(ir_hierarchical_visitor *v, exec_list *l)
@@ -170,9 +171,11 @@ ir_texture::accept(ir_hierarchical_visitor *v)
    if (s != visit_continue)
       return (s == visit_continue_with_parent) ? visit_continue : s;
 
-   s = this->coordinate->accept(v);
-   if (s != visit_continue)
-      return (s == visit_continue_with_parent) ? visit_continue : s;
+   if (this->coordinate) {
+      s = this->coordinate->accept(v);
+      if (s != visit_continue)
+        return (s == visit_continue_with_parent) ? visit_continue : s;
+   }
 
    if (this->projector) {
       s = this->projector->accept(v);
@@ -186,6 +189,12 @@ ir_texture::accept(ir_hierarchical_visitor *v)
         return (s == visit_continue_with_parent) ? visit_continue : s;
    }
 
+   if (this->offset) {
+      s = this->offset->accept(v);
+      if (s != visit_continue)
+        return (s == visit_continue_with_parent) ? visit_continue : s;
+   }
+
    switch (this->op) {
    case ir_tex:
       break;
@@ -196,6 +205,7 @@ ir_texture::accept(ir_hierarchical_visitor *v)
       break;
    case ir_txl:
    case ir_txf:
+   case ir_txs:
       s = this->lod_info.lod->accept(v);
       if (s != visit_continue)
         return (s == visit_continue_with_parent) ? visit_continue : s;
@@ -211,7 +221,7 @@ ir_texture::accept(ir_hierarchical_visitor *v)
       break;
    }
 
-   return visit_continue_with_parent;
+   return (s == visit_stop) ? s : v->visit_leave(this);
 }
 
 
@@ -241,7 +251,14 @@ ir_dereference_array::accept(ir_hierarchical_visitor *v)
    if (s != visit_continue)
       return (s == visit_continue_with_parent) ? visit_continue : s;
 
+   /* 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 = v->in_assignee;
+   v->in_assignee = false;
    s = this->array_index->accept(v);
+   v->in_assignee = was_in_assignee;
+
    if (s != visit_continue)
       return (s == visit_continue_with_parent) ? visit_continue : s;
 
@@ -269,7 +286,9 @@ ir_assignment::accept(ir_hierarchical_visitor *v)
    if (s != visit_continue)
       return (s == visit_continue_with_parent) ? visit_continue : s;
 
+   v->in_assignee = true;
    s = this->lhs->accept(v);
+   v->in_assignee = false;
    if (s != visit_continue)
       return (s == visit_continue_with_parent) ? visit_continue : s;