[Mesa-dev] [PATCH 1/5] glsl: move some uniform linking code to new link_setup_uniform_remap_tables()

Kenneth Graunke kenneth at whitecape.org
Mon Sep 26 18:59:43 UTC 2016


On Sunday, September 25, 2016 10:50:24 PM PDT Timothy Arceri wrote:
> This makes link_assign_uniform_locations() easier to follow.
> ---
>  src/compiler/glsl/link_uniforms.cpp | 330 +++++++++++++++++++-----------------
>  src/compiler/glsl/linker.cpp        |   4 +-
>  src/compiler/glsl/linker.h          |   5 +-
>  3 files changed, 177 insertions(+), 162 deletions(-)
> 
> diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
> index 4d3fc6d..11204fc 100644
> --- a/src/compiler/glsl/link_uniforms.cpp
> +++ b/src/compiler/glsl/link_uniforms.cpp
> @@ -997,12 +997,168 @@ find_empty_block(struct gl_shader_program *prog,
>     return -1;
>  }
>  
> +static void
> +link_setup_uniform_remap_tables(struct gl_context *ctx,

                                   const struct gl_context *ctx,

> +                                struct gl_shader_program *prog,
> +                                unsigned num_explicit_uniform_locs)
> +{
[snip]
> +}
>  void
>  link_assign_uniform_locations(struct gl_shader_program *prog,
> -                              unsigned int boolean_true,
> -                              unsigned int num_explicit_uniform_locs,
> -                              unsigned int max_uniform_locs)
> +                              struct gl_context *ctx,

                                 const struct gl_context *ctx,

> +                              unsigned int num_explicit_uniform_locs)
>  {
> +   unsigned int boolean_true = ctx->Const.UniformBooleanTrue;
> +
>     ralloc_free(prog->UniformStorage);
>     prog->UniformStorage = NULL;
>     prog->NumUniformStorage = 0;
> @@ -1067,7 +1223,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog,
>        }
>     }
>  
> -   const unsigned num_uniforms = uniform_size.num_active_uniforms;
> +   prog->NumUniformStorage = uniform_size.num_active_uniforms;

You can delete the earlier prog->NumUniformStorage = 0 if you like.
Then again, it isn't hurting anything, either.

Patches 1-2 are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

I don't understand patches 3-4.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160926/46581369/attachment.sig>


More information about the mesa-dev mailing list