[Mesa-dev] [PATCH] glsl: Allow ES2 function parameters to be hidden by variable declarations.
Ilia Mirkin
imirkin at alum.mit.edu
Mon Jul 16 21:50:39 UTC 2018
Perhaps use state->es_shader instead of is_version(0, 100)? [Just a
drive-by comment, not a real review, sorry]
On Mon, Jul 16, 2018 at 5:46 PM, Eric Anholt <eric at anholt.net> wrote:
> 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
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list