glsl: added slang_operation_insert_child()
authorBrian Paul <brianp@vmware.com>
Tue, 23 Jun 2009 23:07:12 +0000 (17:07 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 26 Jun 2009 19:16:33 +0000 (13:16 -0600)
src/mesa/shader/slang/slang_compile_operation.c
src/mesa/shader/slang/slang_compile_operation.h

index 730cc0691299e6423991478218dc6b16d1dd1ea1..b75fd073afdf17ae2f841b78826b5dbdbe5b8b9a 100644 (file)
@@ -265,6 +265,26 @@ slang_operation_insert(GLuint *numElements, slang_operation **array,
 }
 
 
+/**
+ * Add/insert new child into given node at given position.
+ * \return pointer to the new child node
+ */
+slang_operation *
+slang_operation_insert_child(slang_operation *oper, GLuint pos)
+{
+   slang_operation *newOp;
+
+   newOp = slang_operation_insert(&oper->num_children,
+                                  &oper->children,
+                                  pos);
+   if (newOp) {
+      newOp->locals->outer_scope = oper->locals;
+   }
+
+   return newOp;
+}
+
+
 void
 _slang_operation_swap(slang_operation *oper0, slang_operation *oper1)
 {
index b701d9a957c999ecf8da89f4c00a2d4a90188bcd..c69078b007077fa1810a128fe6ae53ef9cd4878c 100644 (file)
@@ -157,6 +157,9 @@ extern slang_operation *
 slang_operation_insert(GLuint *numChildren, slang_operation **children,
                        GLuint pos);
 
+extern slang_operation *
+slang_operation_insert_child(slang_operation *oper, GLuint pos);
+
 extern void
 _slang_operation_swap(slang_operation *oper0, slang_operation *oper1);