[Mesa-dev] [PATCH] i965: Serialize nir later in the linking process

Jason Ekstrand jason at jlekstrand.net
Sat Dec 2 00:37:49 UTC 2017


Based on what you pasted on IRC the other day, I'm guessing the problem was
the missing unify_interfaces().  In any case, this looks much better.  The
closer serialization happens to back-end shader compilation, the better.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Fri, Dec 1, 2017 at 3:08 PM, Jordan Justen <jordan.l.justen at intel.com>
wrote:

> Fixes MESA_GLSL=cache_fb with piglit
> tests/spec/glsl-1.50/execution/geometry/clip-
> distance-vs-gs-out.shader_test
>
> Fixes: 0610a624a12 i965/link: Serialize program to nir after linking for
> shader cache
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103988
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_link.cpp | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp
> b/src/mesa/drivers/dri/i965/brw_link.cpp
> index d18521e792d..6177c8f5ebd 100644
> --- a/src/mesa/drivers/dri/i965/brw_link.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_link.cpp
> @@ -302,15 +302,6 @@ brw_link_shader(struct gl_context *ctx, struct
> gl_shader_program *shProg)
>        NIR_PASS_V(prog->nir, nir_lower_atomics_to_ssbo,
>                   prog->nir->info.num_abos);
>
> -      if (brw->ctx.Cache) {
> -         struct blob writer;
> -         blob_init(&writer);
> -         nir_serialize(&writer, prog->nir);
> -         prog->driver_cache_blob = ralloc_size(NULL, writer.size);
> -         memcpy(prog->driver_cache_blob, writer.data, writer.size);
> -         prog->driver_cache_blob_size = writer.size;
> -      }
> -
>        infos[stage] = &prog->nir->info;
>
>        update_xfb_info(prog->sh.LinkedTransformFeedback, infos[stage]);
> @@ -357,6 +348,22 @@ brw_link_shader(struct gl_context *ctx, struct
> gl_shader_program *shProg)
>        }
>     }
>
> +   if (brw->ctx.Cache) {
> +      for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders);
> stage++) {
> +         struct gl_linked_shader *shader = shProg->_LinkedShaders[stage];
> +         if (!shader)
> +            continue;
> +
> +         struct gl_program *prog = shader->Program;
> +         struct blob writer;
> +         blob_init(&writer);
> +         nir_serialize(&writer, prog->nir);
> +         prog->driver_cache_blob = ralloc_size(NULL, writer.size);
> +         memcpy(prog->driver_cache_blob, writer.data, writer.size);
> +         prog->driver_cache_blob_size = writer.size;
> +      }
> +   }
> +
>     if (brw->precompile && !brw_shader_precompile(ctx, shProg))
>        return false;
>
> --
> 2.15.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171201/e6dfabb7/attachment.html>


More information about the mesa-dev mailing list