diff options
author | Brian Paul <brianp@vmware.com> | 2009-06-17 13:51:35 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-06-26 13:16:32 -0600 |
commit | 4bc74a07561eeaa97dbde55c384998ea6aa5968c (patch) | |
tree | 7cd258f0ea6e3cd8a1f6f82ff89d0ac8a1eaf196 /src/mesa/shader/slang | |
parent | 625b0fe2684de462d1e7ea7fc8fcdfc8e3283949 (diff) |
glsl: don't unroll loops containing continue/break
Just search the AST in _slang_can_unroll_for_loop().
Diffstat (limited to 'src/mesa/shader/slang')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index f19da41b0d..f6274780ad 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2488,6 +2488,12 @@ _slang_can_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) assert(oper->type == SLANG_OPER_FOR); assert(oper->num_children == 4); + if (_slang_find_node_type((slang_operation *) oper, SLANG_OPER_CONTINUE) || + _slang_find_node_type((slang_operation *) oper, SLANG_OPER_BREAK)) { + /* dont't unroll loops containing continue/break statements */ + return GL_FALSE; + } + /* children[0] must be either "int i=constant" or "i=constant" */ if (oper->children[0].type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) { slang_variable *var; |