glsl: added slang_operation_add_children() and slang_oper_child() helpers
authorBrian Paul <brianp@vmware.com>
Thu, 18 Jun 2009 20:11:59 +0000 (14:11 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 26 Jun 2009 19:16:32 +0000 (13:16 -0600)
src/mesa/shader/slang/slang_compile_operation.c
src/mesa/shader/slang/slang_compile_operation.h

index e6506168808b60a18e4c7273958d86209e456a54..310a46b6454a6f48ae209b10635f5afc7e97d71d 100644 (file)
@@ -272,3 +272,17 @@ _slang_operation_swap(slang_operation *oper0, slang_operation *oper1)
 }
 
 
+void
+slang_operation_add_children(slang_operation *oper, GLuint num_children)
+{
+   GLuint i;
+   assert(oper->num_children == 0);
+   assert(oper->children == NULL);
+   oper->num_children = num_children;
+   oper->children = slang_operation_new(num_children);
+   for (i = 0; i < num_children; i++) {
+      oper->children[i].locals = _slang_variable_scope_new(oper->locals);
+   }
+}
+
+
index 37af5d617c9775a777443c28b0b102d0f9bc90d7..627356bb5671b39fa3e6bc4ebb8294d6e7795bd5 100644 (file)
@@ -161,4 +161,15 @@ extern void
 _slang_operation_swap(slang_operation *oper0, slang_operation *oper1);
 
 
+extern void
+slang_operation_add_children(slang_operation *oper, GLuint num_children);
+
+static INLINE slang_operation *
+slang_oper_child(slang_operation *oper, GLuint child)
+{
+   assert(child < oper->num_children);
+   return &oper->children[child];
+}
+
+
 #endif /* SLANG_COMPILE_OPERATION_H */