Khronos Public Bugzilla
Bug 779 - Incorrect draw sequence in oes-vertex-array-object.html resulting in test failure.
Incorrect draw sequence in oes-vertex-array-object.html resulting in test fai...
Status: NEW
Product: WebGL
Classification: Unclassified
Component: Conformance Tests
unspecified
PC Linux
: P3 normal
: ---
Assigned To: 3dweb Working Group email alias
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-31 15:44 PST by Nayan Kumar K
Modified: 2013-01-31 16:08 PST (History)
1 user (show)

See Also:


Attachments
Proposed fix (1.31 KB, patch)
2013-01-31 15:46 PST, Nayan Kumar K
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nayan Kumar K 2013-01-31 15:44:23 PST
oes-vertex-array-object.html test is failing in browsers which support OES_vertex_array_object extension (Currently only chromium browser supports it I think). 

To be specific, this test fails in 'runDrawTests' function after it draws green colored (50,50) rect and fails to verify the color drawn. Below is the snippet of the error,

...
PASS Draw 0 passed pixel test
PASS Draw 1 passed pixel test
PASS Draw 2 passed pixel test
PASS should be green
FAIL should be green
at (0, 0) expected: 0,255,0,255 was 250,252,0,255
Testing using deleted buffers referenced by VAOs
...
Comment 1 Nayan Kumar K 2013-01-31 15:46:26 PST
Created attachment 133 [details]
Proposed fix
Comment 2 Gregg Tavares 2013-01-31 16:00:27 PST
thanks for the patch.

BTW: We don't generally take patches here. Patches should be done on github

http://github.com/KhronosGroup/WebGL

I happy to do that for you but if you want your account/email attached to the patch you might want to do that yourself. If I don't hear from you by tomorrow I'll apply it for you.

As for the patch thanks for catching this. It seems like disableVertexAttribArray call should to go before line 458 so that both calls to wtu.drawIndexedQuad use the value in the attribute.
Comment 3 Nayan Kumar K 2013-01-31 16:04:51 PST
Root cause:

At the beginning of runDrawTests, test creates setupSimpleTextureProgram program and binds 0 and 1 as position and tex_coord locations. Test then enables these generic vertex attributes in setupQuad.

Near to the end of this function, test creates another quad using 
wtu.setupQuad function passing 0 as position location. setupQuad function rebinds the 0 vertex attrib array position to a new position buffer which it creates. Note that vertex attrib array 1 is left unmodified by qtu.setupQuad.

runDrawTests function later tries to bind vertex attrib pos 1 (colorLoc) to [0,1,0,1] color using gl.vertexAttrib4f(colorLoc, 0, 1, 0, 1) call. As per the specification http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf section 2.7, current generic attribute values define generic attributes for a vertex when a vertex array defining that data is not enabled. Since vertex attrib array is still left enabled, it seems like call to gl.vertexAttrib4f is simply a no-op.

Attached patch tried to fix this bug.
Comment 4 Nayan Kumar K 2013-01-31 16:08:21 PST
(In reply to comment #2)
> thanks for the patch.
> 
> BTW: We don't generally take patches here. Patches should be done on github
> 
> http://github.com/KhronosGroup/WebGL
> 
> I happy to do that for you but if you want your account/email attached to
> the patch you might want to do that yourself. If I don't hear from you by
> tomorrow I'll apply it for you.
Sure, I will create an account in github and submit the patch there.
> 
> As for the patch thanks for catching this. It seems like
> disableVertexAttribArray call should to go before line 458 so that both
> calls to wtu.drawIndexedQuad use the value in the attribute.