<p dir="ltr"><br>
On Sep 2, 2015 7:27 AM, "Ilia Mirkin" <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br>
><br>
> On Wed, Sep 2, 2015 at 6:29 AM, Neil Roberts <<a href="mailto:neil@linux.intel.com">neil@linux.intel.com</a>> wrote:<br>
> > It's legal to call glTexSubImage with zero values for the width,<br>
> > height or depth. Previously this was breaking the PBO access<br>
> > validation because it tries to work out the last pixel accessed by<br>
> > getting the pixel at height-1 and depth-1 which would end up with<br>
> > bogus values.<br>
> ><br>
> > This was causing GL errors to be generated during the Piglit<br>
> > texsubimage test, although the test was passing anyway.<br>
> ><br>
> > v2: Also check for width == 0. Don't validate the start pointer if any<br>
> > of the dimensions are zero.<br>
><br>
> Reviewed-by: Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>><br>
><br>
> Note that the spec text you referred to earlier said to error if<br>
> anything out of bounds *would be accessed*, but if any of the dims are<br>
> 0, then nothing is accessed...</p>
<p dir="ltr">We can probably just bail higher up in the stack and never call the driver hook if we have a zero dimension. That would also protect us from silly zero-dim bugs that may exist.</p>
<p dir="ltr">> > ---<br>
> > src/mesa/main/pbo.c | 6 ++++++<br>
> > 1 file changed, 6 insertions(+)<br>
> ><br>
> > diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c<br>
> > index 0c16025..7762324 100644<br>
> > --- a/src/mesa/main/pbo.c<br>
> > +++ b/src/mesa/main/pbo.c<br>
> > @@ -103,6 +103,12 @@ _mesa_validate_pbo_access(GLuint dimensions,<br>
> > /* no buffer! */<br>
> > return GL_FALSE;<br>
> ><br>
> > + /* If the size of the image is zero then no pixels are accessed so we<br>
> > + * don't need to check anything else.<br>
> > + */<br>
> > + if (width == 0 || height == 0 || depth == 0)<br>
> > + return GL_TRUE;<br>
> > +<br>
> > /* get the offset to the first pixel we'll read/write */<br>
> > start = _mesa_image_offset(dimensions, pack, width, height,<br>
> > format, type, 0, 0, 0);<br>
> > --<br>
> > 1.9.3<br>
> ><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>