[Public WebGL] questions about vertexAttribPointer / getVertexAttrib offsets

Gregg Tavares (勤) [email protected]
Mon Apr 23 11:43:20 PDT 2012


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?

Chrome doesn't allow negative offsets either.

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.




>
> 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/5456c825/attachment.html>


More information about the public_webgl mailing list