[Mesa-dev] [PATCH] i965: Actually check every primitive for cut index support.

Paul Berry stereotype441 at gmail.com
Tue Sep 3 06:26:55 PDT 2013


On 2 September 2013 16:47, Ian Romanick <idr at freedesktop.org> wrote:

> On 09/01/2013 07:05 PM, Kenneth Graunke wrote:
> > can_cut_index_handle_prims() was passed an array of _mesa_prim objects
> > and a count, and ran a loop for that many iterations.  However, it
> > treated the array like a pointer, repeatedly checking the first element.
>
> Blarg.  How would an application be able to observe the old bug
> behavior?  Can we come up with a test case that might tickle it?
>

We already had some discussion about this (see
http://lists.freedesktop.org/archives/mesa-dev/2013-August/044129.html).
 Briefly, I wasn't able to come up with a test case that produced incorrect
rendering, but I was able to produce a test case where prim[i] != prim[j].
 Considering how difficult the VBO module is to understand, I think it's
wise to err on the safe side and do what Ken has done in this patch.

Patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


>
> > This patch makes it actually check every primitive.
> >
> > Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>
> Either way, the patch is obviously correct.
>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>
> > ---
> >  src/mesa/drivers/dri/i965/brw_primitive_restart.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> > index 0dbc48f..b305dca 100644
> > --- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> > +++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
> > @@ -92,8 +92,8 @@ can_cut_index_handle_prims(struct gl_context *ctx,
> >        return false;
> >     }
> >
> > -   for ( ; nr_prims > 0; nr_prims--) {
> > -      switch(prim->mode) {
> > +   for (int i = 0; i < nr_prims; i++) {
> > +      switch (prim[i].mode) {
> >        case GL_POINTS:
> >        case GL_LINES:
> >        case GL_LINE_STRIP:
> >
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130903/92ef2ef9/attachment.html>


More information about the mesa-dev mailing list