[Mesa-dev] [PATCH 2/4] i965/fs: Make the repclear shader support either a uniform or a flat input

Jason Ekstrand jason at jlekstrand.net
Tue Apr 5 16:27:51 UTC 2016


On Mon, Apr 4, 2016 at 11:04 PM, Jordan Justen <jordan.l.justen at intel.com>
wrote:

> On 2016-04-04 15:51:13, Jason Ekstrand wrote:
> > In the Vulkan driver we use a single flat input instead of a uniform
> > because setting up push constants is more disruptive to the pipeline than
> > setting up another vertex input.  This uses the number of uniforms as a
> key
> > to keep it working for the GL driver.
>
> How about "This uses the number of uniforms to distinguish the uniform
> vs attribute methods."
>
> > ---
> >  src/mesa/drivers/dri/i965/brw_fs.cpp | 25 ++++++++++++++++++++-----
> >  1 file changed, 20 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> > index 1a6a229..b138c15 100644
> > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> > @@ -2787,10 +2787,23 @@ fs_visitor::emit_repclear_shader()
> >     brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
> >     int base_mrf = 1;
> >     int color_mrf = base_mrf + 2;
> > +   fs_inst *mov;
> >
> > -   fs_inst *mov = bld.exec_all().group(4, 0)
> > -                     .MOV(brw_message_reg(color_mrf),
> > -                          fs_reg(UNIFORM, 0, BRW_REGISTER_TYPE_F));
> > +   if (uniforms > 0) {
>
> On the vulkan branch, we have '== 1', and you do below as well. Should
> we move both to '> 0'?
>

Good catch.  They should both be > 0.  I'll get that fixed.


> -Jordan
>
> > +      mov = bld.exec_all().group(4, 0)
> > +               .MOV(brw_message_reg(color_mrf),
> > +                    fs_reg(UNIFORM, 0, BRW_REGISTER_TYPE_F));
> > +   } else {
> > +      struct brw_reg reg =
> > +         brw_reg(BRW_GENERAL_REGISTER_FILE,
> > +                 2, 3, 0, 0, BRW_REGISTER_TYPE_F,
> > +                 BRW_VERTICAL_STRIDE_8,
> > +                 BRW_WIDTH_2,
> > +                 BRW_HORIZONTAL_STRIDE_4, BRW_SWIZZLE_XYZW,
> WRITEMASK_XYZW);
> > +
> > +      mov = bld.exec_all().group(4, 0)
> > +               .MOV(vec4(brw_message_reg(color_mrf)), fs_reg(reg));
> > +   }
> >
> >     fs_inst *write;
> >     if (key->nr_color_regions == 1) {
> > @@ -2819,8 +2832,10 @@ fs_visitor::emit_repclear_shader()
> >     assign_curb_setup();
> >
> >     /* Now that we have the uniform assigned, go ahead and force it to a
> vec4. */
> > -   assert(mov->src[0].file == FIXED_GRF);
> > -   mov->src[0] = brw_vec4_grf(mov->src[0].nr, 0);
> > +   if (uniforms == 1) {
> > +      assert(mov->src[0].file == FIXED_GRF);
> > +      mov->src[0] = brw_vec4_grf(mov->src[0].nr, 0);
> > +   }
> >  }
> >
> >  /**
> > --
> > 2.5.0.400.gff86faf
> >
> > _______________________________________________
> > 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/20160405/597a2f97/attachment-0001.html>


More information about the mesa-dev mailing list