[Mesa-dev] [PATCH 24/27] glsl: Assign atomic counter resources on shader compile fall back path

Timothy Arceri tarceri at itsqueeze.com
Sun Aug 20 23:28:50 UTC 2017



On 19/08/17 17:44, Jordan Justen wrote:
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Timothy Arceri <tarceri at itsqueeze.com>
> ---
>   src/compiler/glsl/linker.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index 306051f1f0..671c38e8e1 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -4578,9 +4578,9 @@ link_and_validate_uniforms(struct gl_context *ctx,
>   {
>      update_array_sizes(prog);
>      link_assign_uniform_locations(prog, ctx);
> +   link_assign_atomic_counter_resources(ctx, prog);

I'm still not 100% sure this is really necessary. Either way in its 
current form it will leak memory unless you also update the code in 
shaderobj.c to release the old arrays e.g.

if (shProg->data->AtomicBuffers && !shProg->data->cache_fallback) {

to

if (shProg->data->AtomicBuffers) {

Having said this, it seems that I may have been better off making NIR 
serialisable and avoid the whole fallback path mess [1]. I'm not sure if 
Rob has done any work on this yet but having a NIR level cache would 
simplify things considerably and avoid potentially expensive fallbacks 
all the way to GLSL IR.

[1] https://lists.freedesktop.org/archives/mesa-dev/2017-May/156616.html


>   
>      if (!prog->data->cache_fallback) {
> -      link_assign_atomic_counter_resources(ctx, prog);
>         link_calculate_subroutine_compat(prog);
>         check_resources(ctx, prog);
>         check_subroutine_resources(prog);
> 


More information about the mesa-dev mailing list