[Mesa-dev] [PATCH 1/2] glsl/linker: use without_array() to retrieve type

Ilia Mirkin imirkin at alum.mit.edu
Fri Nov 3 15:52:49 UTC 2017


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

However I might recommend doing like

const glsl_type *type_without_array = type->without_array();
if (type_without_array->is_interface()) {
  for (... ; i < type_without_array->length; i++) {
     field = &type_without_array->fields.structure[i]

Otherwise it's just redoing the same bit of work over and over again.
Maybe it's smart enough to not do that? (Perhaps without_array() is
marked as a const function?)

On Fri, Nov 3, 2017 at 6:56 AM, Iago Toral Quiroga <itoral at igalia.com> wrote:
> This is what we do in the condition too, so it makes sense.
> ---
>  src/compiler/glsl/link_varyings.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
> index 66a20a2c9b..af938611f4 100644
> --- a/src/compiler/glsl/link_varyings.cpp
> +++ b/src/compiler/glsl/link_varyings.cpp
> @@ -568,7 +568,7 @@ validate_explicit_variable_location(struct gl_context *ctx,
>
>     if (type->without_array()->is_interface()) {
>        for (unsigned i = 0; i < type->without_array()->length; i++) {
> -         glsl_struct_field *field = &type->fields.structure[i];
> +         glsl_struct_field *field = &type->without_array()->fields.structure[i];
>           unsigned field_location = field->location -
>              (field->patch ? VARYING_SLOT_PATCH0 : VARYING_SLOT_VAR0);
>           if (!check_location_aliasing(explicit_locations, var,
> --
> 2.11.0
>


More information about the mesa-dev mailing list