[Mesa-dev] [PATCH] nir: Embed the shader_info in the nir_shader again

Kenneth Graunke kenneth at whitecape.org
Tue May 9 18:45:42 UTC 2017


On Monday, May 8, 2017 10:54:25 AM PDT Jason Ekstrand wrote:
> Commit e1af20f18a86f52a9640faf2d4ff8a71b0a4fa9b changed the shader_info
> from being embedded into being just a pointer.  The idea was that
> sharing the shader_info between NIR and GLSL would be easier if it were
> a pointer pointing to the same shader_info struct.  This, however, has
> caused a few problems:
> 
>  1) There are many things which generate NIR without GLSL.  This means
>     we have to support both NIR shaders which come from GLSL and ones
>     that don't and need to have an info elsewhere.
> 
>  2) The solution to (1) raises all sorts of ownership issues which have
>     to be resolved with ralloc_parent checks.
> 
>  3) Ever since 00620782c92100d77c660f9783504c6d80fa1d58, we've been
>     using nir_gather_info to fill out the final shader_info.  Thanks to
>     cloning and the above ownership issues, the nir_shader::info may not
>     point back to the gl_shader anymore and so we have to do a copy of
>     the shader_info from NIR back to GLSL anyway.
> 
> All of these issues go away if we just embed the shader_info in the
> nir_shader.  There's a little downside of having to copy it back after
> calling nir_gather_info but, as explained above, we have to do that
> anyway.

  4) The i965 passthrough TCS code alters the NIR shader info for the
     TCS and TES, thinking each shader specialization had its own copy.
     This could have unintended consequences...

Thanks for doing this.  It seemed like a decent plan at the time, but
I think just copying the info is better - various layers of compilation
may want to alter it as we go (turn system values to/from
inputs/outputs, add bonus things to get copied through, ...)

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170509/ddcc75bc/attachment-0001.sig>


More information about the mesa-dev mailing list