[Mesa-dev] [PATCH] anv: Move nir_lower_wpos_center after dead variable elimination.

Jason Ekstrand jason at jlekstrand.net
Thu Jan 12 01:30:46 UTC 2017


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

On Wed, Jan 11, 2017 at 5:25 PM, Timothy Arceri <
timothy.arceri at collabora.com> wrote:

> On Wed, 2017-01-11 at 16:09 -0800, Kenneth Graunke wrote:
> > When multiple shader stages exist in the same SPIR-V module, we
> > compile
> > all entry points and their inputs/outputs, then dead code eliminate
> > the
> > ones not related to the specific entry point later.
> >
> > nir_lower_wpos_center was being run prior to eliminating those random
> > other variables, which made it trip up, thinking it found
> > gl_FragCoord
> > when it actually found something else like gl_PerVertex[3].
> >
> > Fixes dEQP-VK.spirv_assembly.instruction.graphics.module.same_module.
> >
> > Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>
> Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>
>
> > ---
> >  src/intel/vulkan/anv_pipeline.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/intel/vulkan/anv_pipeline.c
> > b/src/intel/vulkan/anv_pipeline.c
> > index 6c939b071da..7d939ebabe9 100644
> > --- a/src/intel/vulkan/anv_pipeline.c
> > +++ b/src/intel/vulkan/anv_pipeline.c
> > @@ -139,9 +139,6 @@ anv_shader_compile_to_nir(struct anv_device
> > *device,
> >
> >     free(spec_entries);
> >
> > -   if (stage == MESA_SHADER_FRAGMENT)
> > -      NIR_PASS_V(nir, nir_lower_wpos_center);
> > -
> >     /* We have to lower away local constant initializers right before
> > we
> >      * inline functions.  That way they get properly initialized at
> > the top
> >      * of the function and not at the top of its caller.
> > @@ -161,6 +158,9 @@ anv_shader_compile_to_nir(struct anv_device
> > *device,
> >     NIR_PASS_V(nir, nir_remove_dead_variables,
> >                nir_var_shader_in | nir_var_shader_out |
> > nir_var_system_value);
> >
> > +   if (stage == MESA_SHADER_FRAGMENT)
> > +      NIR_PASS_V(nir, nir_lower_wpos_center);
> > +
> >     /* Now that we've deleted all but the main function, we can go
> > ahead and
> >      * lower the rest of the constant initializers.
> >      */
> _______________________________________________
> 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/20170111/4d3aa2aa/attachment.html>


More information about the mesa-dev mailing list