[Public WebGL] questions about vertexAttribPointer / getVertexAttrib offsets
Benoit Jacob
[email protected]
Mon Apr 23 11:55:26 PDT 2012
----- Original Message -----
> On Mon, Apr 23, 2012 at 11:14 AM, Benoit Jacob < [email protected] >
> wrote:
> > Hi,
>
> > 1. It seems that the WebGL and GLES2 specs allow for vertex attrib
> > offsets to be negative. Firefox currently generates a INVALID_VALUE
> > error on negative offset in vertexAttribPointer. Is that a Firefox
> > bug? There is a conformance test in index-validation.html that
> > tests
> > a very large negative offset, but due to a separate bug in Firefox,
> > this 64bit value is converted to 32bit and becomes positive.
>
> > What is the use case for negative offsets? If we allow them, how
> > are
> > we going to protect from out-of-bounds accesses without relying on
> > drivers for that?
>
> How do you get a negative offset from glVertexAttribPointer?
> The spec says,
> > When an array is sourced from
>
> > a buffer object, the pointer value of that array is used to compute
> > an offset, in basic
>
> > machine units, into the data store of the buffer object. This
> > offset
> > is computed by
>
> > subtracting a null pointer from the pointer value, where both
> > pointers are treated as
>
> > pointers to basic machine units
>
> pointer - null is always positive no?
The WebGL spec currently declares
void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
GLboolean normalized, GLsizei stride, GLintptr offset);
Where GLintptr is signed:
typedef long long GLintptr;
> Chrome doesn't allow negative offsets either.
Then either both Chrome and Firefox share a common bug wrt what the spec currently requires?
> There's at least one negative offset test in
> https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conformance/more/functions/vertexAttribPointerBadArgs.html
> > 2. The constant VERTEX_ATTRIB_ARRAY_POINTER is mentioned in the
> > spec,
> > but not as an constant accepted by getVertexAttrib. Shouldn't
> > getVertexAttrib accept it?
>
> you use gl.getVertexAttribOffset for the offset.
Oh. I had utterly forgotten about this function.
Cheers,
Benoit
> > Cheers,
>
> > Benoit
>
> > -----------------------------------------------------------
>
> > You are currently subscribed to [email protected] .
>
> > To unsubscribe, send an email to [email protected] with
>
> > the following command in the body of your email:
>
> > unsubscribe public_webgl
>
> > -----------------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20120423/afb7ab55/attachment.html>
More information about the public_webgl
mailing list