[Mesa-dev] [PATCH 3/4] i965/fs_surface_builder: Only apply predicate to components that exist

Jason Ekstrand jason at jlekstrand.net
Tue Sep 15 07:33:31 PDT 2015


On Sep 15, 2015 6:39 AM, "Francisco Jerez" <currojerez at riseup.net> wrote:
>
> Jason Ekstrand <jason at jlekstrand.net> writes:
>
> > In certain conditions, we have to do bounds-checking in the shader for
> > image_load_store.  The way this works for image loads is that we do the
> > load anyway and then emit a series of slecects, one per component, that
>
> Strictly speaking the load is predicated so it's not really done for out
> of bounds coordinates, with that sentence clarified or removed (and the
> typo fixed in "slecects") this patch is:
>
> Reviewed-by: Francisco Jerez <currojerez at riseup.net>
>
> > gives us 0 or the loaded value depending on whether or not you're in
> > bounds.  However, we were hard-coding 4 components which may not be
> > correct.  Instead, we should be using size which is the number of
> > components read.
> >
> > Cc: Francisco Jerez <currojerez at riseup.net>
>
> Although this is unlikely to fix any preexisting bugs (because the
> result of the extra SELs would have been left unused and they would have
> been dead-code-eliminated later on anyway), it shouldn't hurt to CC this
> to mesa-stable too, if you like.

Sure. Really, its just to make it pass the validation pass so its not a big
deal.  Still, there is a theoretical bug there so I'll do that.

> > ---
> >  src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
> > index 727e8d1..88f22fa 100644
> > --- a/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
> > +++ b/src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp
> > @@ -905,7 +905,7 @@ namespace brw {
> >              tmp = emit_untyped_read(bld, image, laddr, 1, size, pred);
> >
> >              /* An out of bounds surface access should give zero as
result. */
> > -            for (unsigned c = 0; c < 4; ++c)
> > +            for (unsigned c = 0; c < size; ++c)
> >                 set_predicate(pred, bld.SEL(offset(tmp, bld, c),
> >                                             offset(tmp, bld, c),
fs_reg(0)));
> >           }
> > --
> > 2.5.0.400.gff86faf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150915/e07711da/attachment.html>


More information about the mesa-dev mailing list