On Mon, Feb 4, 2019 at 7:43 AM Andres Gomez <ago...@igalia.com> wrote:
>
> On Fri, 2019-02-01 at 13:17 -0500, Ilia Mirkin wrote:
> > On Fri, Feb 1, 2019 at 1:08 PM Andres Gomez <ago...@igalia.com> wrote:
> > > Current implementation uses a complicated calculation which relies in
> > > an implicit conversion to check the integral part of 2 division
> > > results.
> > >
> > > However, the calculation actually checks that the xfb_offset is
> > > smaller or a multiplier of the xfb_stride. For example, while this is
> > > expected to fail, it actually succeeds:
> > >
> > >   "
> > >
> > >     ...
> > >
> > >     layout(xfb_buffer = 2, xfb_stride = 12) out block3 {
> > >       layout(xfb_offset = 0) vec3 c;
> > >       layout(xfb_offset = 12) vec3 d; // ERROR, requires stride of 24
> > >     };
> > >
> > >     ...
> > >
> > >   "
> > >
> > > Fixes: 2fab85aaea5 ("glsl: add xfb_stride link time validation")
> > > Cc: Timothy Arceri <tarc...@itsqueeze.com>
> > > Signed-off-by: Andres Gomez <ago...@igalia.com>
> > > ---
> > >  src/compiler/glsl/link_varyings.cpp | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/src/compiler/glsl/link_varyings.cpp 
> > > b/src/compiler/glsl/link_varyings.cpp
> > > index 6cebc5b3c5a..ab66ceb0d00 100644
> > > --- a/src/compiler/glsl/link_varyings.cpp
> > > +++ b/src/compiler/glsl/link_varyings.cpp
> > > @@ -1213,8 +1213,7 @@ tfeedback_decl::store(struct gl_context *ctx, 
> > > struct gl_shader_program *prog,
> > >           return false;
> > >        }
> > >
> > > -      if ((this->offset / 4) / info->Buffers[buffer].Stride !=
> > > -          (xfb_offset - 1) / info->Buffers[buffer].Stride) {
> > > +      if (xfb_offset > info->Buffers[buffer].Stride) {
> >  >= ?
>
> I believe it is correct as it is.

Right. At this point in the code, xfb_offset is where the *next*
variable would go. But since there's no next variable, it's fine for
them to be equal.

Cheers,

  -ilia
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to