[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] questions about vertexAttribPointer / getVertexAttrib offsets








On Mon, Apr 23, 2012 at 11:14 AM, Benoit Jacob <bjacob@mozilla.com> 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 


 

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 public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------