[Mesa-dev] [PATCH] glsl: Allow ES2 function parameters to be hidden by variable declarations.
Eric Anholt
eric at anholt.net
Mon Jul 16 21:46:07 UTC 2018
This fixes dEQP case:
dEQP-GLES2.functional.shaders.scoping.valid.local_variable_hides_function_parameter_fragment
without breaking
dEQP-GLES3.functional.shaders.scoping.invalid.local_variable_hides_function_parameter_fragment
---
src/compiler/glsl/ast_to_hir.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index dd60a2a87fd5..28f074ca8a39 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -6180,10 +6180,19 @@ ast_function_definition::hir(exec_list *instructions,
}
}
+ /* On ES2, function parameters may be redeclared to be hidden within the
+ * function. Do this by creating a new scope inside the function.
+ */
+ if (state->is_version(0, 100) && !state->is_version(0, 300))
+ state->symbols->push_scope();
+
/* Convert the body of the function to HIR. */
this->body->hir(&signature->body, state);
signature->is_defined = true;
+ if (state->is_version(0, 100) && !state->is_version(0, 300))
+ state->symbols->pop_scope();
+
state->symbols->pop_scope();
assert(state->current_function == signature);
--
2.18.0
More information about the mesa-dev
mailing list