[Mesa-dev] [PATCH] nir: remove dead glsl variables before lowering io.

Jason Ekstrand jason at jlekstrand.net
Fri May 20 22:29:24 UTC 2016


On Fri, May 20, 2016 at 2:36 PM, Jason Ekstrand <jason at jlekstrand.net>
wrote:

> On Fri, May 20, 2016 at 1:49 PM, Dave Airlie <airlied at gmail.com> wrote:
>
>> From: Dave Airlie <airlied at redhat.com>
>>
>> For cull distance GLSL will let unsized unused arrays get
>> into the backend, we should nuke those straight away, to
>> save caring about them later.
>>
>> This fixes:
>> arb_separate_shader_objects/linker/large-number-of-unused-varyings
>> as a side effect (even without culling changes).
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>> ---
>>  src/mesa/drivers/dri/i965/brw_nir.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_nir.c
>> b/src/mesa/drivers/dri/i965/brw_nir.c
>> index 9afd036..6ceac7e 100644
>> --- a/src/mesa/drivers/dri/i965/brw_nir.c
>> +++ b/src/mesa/drivers/dri/i965/brw_nir.c
>> @@ -560,6 +560,8 @@ brw_create_nir(struct brw_context *brw,
>>     /* First, lower the GLSL IR or Mesa IR to NIR */
>>     if (shader_prog) {
>>        nir = glsl_to_nir(shader_prog, stage, options);
>> +      nir_remove_dead_variables(nir, nir_var_shader_in);
>> +      nir_remove_dead_variables(nir, nir_var_shader_out);
>>
>
> The mode parameter is a bitfield.  You can just do nir_var_shader_in |
> nir_var_shader_out.
>
> I think this is the right thing to do.  Pardon my while I run it though CI.
>

Pardon the delay.  I was 95% sure this was the right thing to do but wanted
to make sure I wasn't missing something.  Jenkins is good with it.

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


>
>
>>        OPT_V(nir_lower_io_to_temporaries,
>>              nir_shader_get_entrypoint(nir),
>>              true, false);
>> --
>> 2.5.5
>>
>> _______________________________________________
>> 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/20160520/5892ffa9/attachment.html>


More information about the mesa-dev mailing list