<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'><br><br><hr id="zwchr"><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 23, 2012 at 11:14 AM, Benoit Jacob <span dir="ltr"><<a href="mailto:bjacob@mozilla.com" target="_blank">bjacob@mozilla.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi,<br>
<br>
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.<br>

<br>
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?<br></blockquote><div><br></div><div><div class="gmail_extra">How do you get a negative offset from glVertexAttribPointer?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">The spec says,</div><div class="gmail_extra"><br></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
<div class="gmail_extra">When an array is sourced from</div><div class="gmail_extra">a buffer object, the pointer value of that array is used to compute an offset, in basic</div><div class="gmail_extra">machine units, into the data store of the buffer object. This offset is computed by</div>
<div class="gmail_extra">subtracting a null pointer from the pointer value, where both pointers are treated as</div><div class="gmail_extra">pointers to basic machine units</div></blockquote><div class="gmail_extra"><br></div>
<div id="DWT1251" class="gmail_extra">pointer - null is always positive no?</div></div></div></div></blockquote>The WebGL spec currently declares<br><br><pre class="idl">    void vertexAttribPointer(GLuint indx, GLint size, GLenum type, 
                             GLboolean normalized, GLsizei stride, GLintptr offset);<br><font face="times new roman,new york,times,serif"><br>Where GLintptr is signed:<br></font><br>typedef long long      GLintptr;<br></pre><br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class="gmail_extra"><div class="gmail_quote"><div><div id="DWT1252" class="gmail_extra">Chrome doesn't allow negative offsets either.</div></div></div></div></blockquote>Then either both Chrome and Firefox share a common bug wrt what the spec currently requires?<br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class="gmail_extra"><div class="gmail_quote"><div><div class="gmail_extra"></div><div class="gmail_extra"><br></div><div class="gmail_extra">
There's at least one negative offset test in </div><div class="gmail_extra"><a href="https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conformance/more/functions/vertexAttribPointerBadArgs.html" target="_blank">https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conformance/more/functions/vertexAttribPointerBadArgs.html</a></div>
<div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
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?<br></blockquote><div><br></div><div id="DWT1253">you use gl.getVertexAttribOffset for the offset.</div></div></div></blockquote>Oh. I had utterly forgotten about this function.<br><br>Cheers,<br>
Benoit<br>
<div class="gmail_extra"><br></div><br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class="gmail_extra"><div class="gmail_quote"><div></div>
<div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
Benoit<br>
<br>
-----------------------------------------------------------<br>
You are currently subscribed to <a href="mailto:public_webgl@khronos.org" target="_blank">public_webgl@khronos.org</a>.<br>
To unsubscribe, send an email to <a href="mailto:majordomo@khronos.org" target="_blank">majordomo@khronos.org</a> with<br>
the following command in the body of your email:<br>
unsubscribe public_webgl<br>
-----------------------------------------------------------<br>
<br>
</blockquote></div><br></div>
</blockquote><br></div></body></html>