From 06fdb6a74cfdddb5f598ddfeab890c59f176dab8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Jan 2009 08:52:54 -0700 Subject: glsl: better fix for for-loop scope issue (commit 6333005f7aea3e5d1d86a5c47b3fa2a1ed2f3ff0) --- src/mesa/shader/slang/library/slang_shader.syn | 13 +++---------- src/mesa/shader/slang/library/slang_shader_syn.h | 4 +--- src/mesa/shader/slang/slang_compile.c | 18 ------------------ 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/mesa/shader/slang/library/slang_shader.syn b/src/mesa/shader/slang/library/slang_shader.syn index 0ad4a1cba6..cc5c70a02f 100644 --- a/src/mesa/shader/slang/library/slang_shader.syn +++ b/src/mesa/shader/slang/library/slang_shader.syn @@ -1161,13 +1161,6 @@ compound_statement_2 compound_statement_3 lbrace .and statement_list .and rbrace; -/* - * ::= - * | - */ -statement_no_new_scope - compound_statement_no_new_scope .or simple_statement; - /* * ::= "{" "}" * | "{" "}" @@ -1181,6 +1174,7 @@ compound_statement_no_new_scope_2 compound_statement_no_new_scope_3 lbrace .and statement_list .and rbrace; + /* * ::= * | @@ -1242,8 +1236,7 @@ condition_3 /* * ::= "while" "(" ")" * | "do" "while" "(" ")" ";" - * | "for" "(" ")" - * + * | "for" "(" ")" */ iteration_statement iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3; @@ -1255,7 +1248,7 @@ iteration_statement_2 expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon; iteration_statement_3 "for" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and - for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope; + for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement; /* * ::= diff --git a/src/mesa/shader/slang/library/slang_shader_syn.h b/src/mesa/shader/slang/library/slang_shader_syn.h index e1705dfe19..6a382970e1 100644 --- a/src/mesa/shader/slang/library/slang_shader_syn.h +++ b/src/mesa/shader/slang/library/slang_shader_syn.h @@ -566,8 +566,6 @@ " lbrace .and rbrace;\n" "compound_statement_3\n" " lbrace .and statement_list .and rbrace;\n" -"statement_no_new_scope\n" -" compound_statement_no_new_scope .or simple_statement;\n" "compound_statement_no_new_scope\n" " compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;\n" "compound_statement_no_new_scope_1\n" @@ -617,7 +615,7 @@ " expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;\n" "iteration_statement_3\n" " \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n" -" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n" +" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement;\n" "for_init_statement\n" " expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n" "conditionopt\n" diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index add8594ff9..ec27fc69df 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1138,26 +1138,8 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O, RETURN0; if (!parse_child_operation(C, &o, oper, GL_FALSE)) RETURN0; -#if 0 if (!parse_child_operation(C, &o, oper, GL_TRUE)) RETURN0; -#else - /* force creation of new scope for loop body */ - { - slang_operation *ch; - slang_output_ctx oo = o; - - /* grow child array */ - ch = slang_operation_grow(&oper->num_children, &oper->children); - ch->type = SLANG_OPER_BLOCK_NEW_SCOPE; - - ch->locals->outer_scope = o.vars; - oo.vars = ch->locals; - - if (!parse_child_operation(C, &oo, ch, GL_TRUE)) - RETURN0; - } -#endif } break; case OP_PRECISION: -- cgit v1.2.3