[Mesa-dev] [PATCH 3/6] nir: Try to make sense of the nir_shader_compiler_options code.

Eric Anholt eric at anholt.net
Fri Mar 6 18:31:22 PST 2015


Kenneth Graunke <kenneth at whitecape.org> writes:

> The code in glsl_to_nir is entirely dead, as we translate from GLSL to
> NIR at link time, when there isn't a _mesa_glsl_parse_state to pass,
> so every caller passes NULL.
>
> glsl_to_nir seems like the wrong place to try and create the shader
> compiler options structure anyway - tgsi_to_nir, prog_to_nir, and other
> translators all would have to duplicate that code.  The driver should
> set this up once with whatever settings it wants, and pass it in.
>
> Eric also added a NirOptions field to ctx->Const.ShaderCompilerOptions[]
> and left a comment saying: "The memory for the options is expected to be
> kept in a single static copy by the driver."  This suggests the plan was
> to do exactly that.  That pointer was not marked const, however, and the
> dead code used a mix of static structures and ralloced ones.
>
> This patch deletes the dead code in glsl_to_nir, instead making it take
> the shader compiler options as a mandatory argument.  It creates an
> (empty) options struct in the i965 driver, and makes NirOptions point
> to that.  It marks the pointer const so that we can actually do so
> without generating "discards const qualifier" compiler warnings.

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150306/1048094b/attachment.sig>


More information about the mesa-dev mailing list