[Mesa-dev] [PATCH V3 05/13] mesa: Add validation helpers for new indirect draws

Paul Berry stereotype441 at gmail.com
Tue Nov 12 12:35:30 PST 2013


On 12 November 2013 12:13, Kenneth Graunke <kenneth at whitecape.org> wrote:

> It would be great to put a citation for this:
>
> /* From the ARB_multi_draw_indirect specification:
>  * "INVALID_VALUE is generated by MultiDrawArraysIndirect or
>  *  MultiDrawElementsIndirect if <primcount> is negative."
>  *
>  * "<primcount> must be positive, otherwise an INVALID_VALUE error will
>  *  be generated."
>  */
>
> These beg the question of whether 0 is allowed.  Usually I interpret
> "negative" as < 0, "positive" as >= 0, and "strictly positive" as > 0.
> So I think zero should be allowed, and I don't see a contradiction.
>
> The only text I can find in 4.3 and 4.4 just reiterate that it needs to
> positive, and I don't see any text defining "positive."
>

In the absence of text defining "positive", shouldn't we go with the
definition used by mathematicians?  According to
http://en.wikipedia.org/wiki/Sign_%28mathematics%29#Terminology_for_signs,
"positive" means strictly greater than zero.

If anyone is aware of a competing implementation that accepts a primcount
of 0, then I'd be open to following the behaviour of the competing
implementation (and filing a spec bug).  But otherwise I think we should
prohibit zero.

(Note: I brought this up last time the patch was reviewed:
http://lists.freedesktop.org/archives/mesa-dev/2013-November/047962.html)


>
> Our existing implementation of MultiDrawElements appears to allow 0,
> simply turning it into a noop.  This seems to be supported by the
> pseudocode; the loop will simply execute zero times.
>
> > +      _mesa_error(ctx, GL_INVALID_VALUE, "%s(primcount <= 0)", name);
> > +      return GL_FALSE;
> > +   }
> > +
>
> /* From the ARB_multi_draw_indirect specification:
>  * "<stride> must be a multiple of four, otherwise an INVALID_VALUE
>  *  error is generated."
>  */
>
> > +   if (stride % 4) {
> > +      _mesa_error(ctx, GL_INVALID_VALUE, "%s(stride %% 4)", name);
> > +      return GL_FALSE;
> > +   }
> > +
> > +   return GL_TRUE;
> > +}
>
> Assuming you add spec citations, and either allow primcount == 0 or
> refute my claim that it should be valid, this would get a:
>
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> _______________________________________________
> 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/20131112/0a3cefcc/attachment.html>


More information about the mesa-dev mailing list