diff options
author | Brian Paul <brianp@vmware.com> | 2009-06-18 14:11:59 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-06-18 14:11:59 -0600 |
commit | 083bf8125e8bf4919d2eb6f5dd9cb36142dbcb48 (patch) | |
tree | 595909bf08c953c62fdfc3e4d4fec4cf73bedd74 | |
parent | 99daeea9e93bf14ffef60dddf5f5d05489837c2f (diff) |
glsl: added slang_operation_add_children() and slang_oper_child() helpers
-rw-r--r-- | src/mesa/shader/slang/slang_compile_operation.c | 14 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_compile_operation.h | 11 |
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 e650616880..310a46b645 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 37af5d617c..627356bb56 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 */ |