summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-06-18 14:11:59 -0600
committerBrian Paul <[email protected]>2009-06-26 13:16:32 -0600
commitc4fd947beedbd1e2f8fdaf4ead3b2a8249bd239e (patch)
treea91ed38a44855e2053c016f399c787ef208aa0f0 /src
parentc20bb48d3a897fd616bf4c7d4eb67ea34475985d (diff)
glsl: added slang_operation_add_children() and slang_oper_child() helpers
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/slang/slang_compile_operation.c14
-rw-r--r--src/mesa/shader/slang/slang_compile_operation.h11
2 files changed, 25 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c
index e6506168808..310a46b6454 100644
--- a/src/mesa/shader/slang/slang_compile_operation.c
+++ b/src/mesa/shader/slang/slang_compile_operation.c
@@ -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);
+ }
+}
+
+
diff --git a/src/mesa/shader/slang/slang_compile_operation.h b/src/mesa/shader/slang/slang_compile_operation.h
index 37af5d617c9..627356bb567 100644
--- a/src/mesa/shader/slang/slang_compile_operation.h
+++ b/src/mesa/shader/slang/slang_compile_operation.h
@@ -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 */