Bug 188291

Summary: WebGL 2 conformance: vertex_arrays/vertex_array_object.html
Product: WebKit Reporter: Justin Fan <justin_fan>
Component: New BugsAssignee: Justin Fan <justin_fan>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, dino, esprehn+autocc, ews-watchlist, graouts, gyuyoung.kim, kondapallykalyan, noam, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews106 for mac-sierra-wk2
none
Archive of layout-test-results from ews101 for mac-sierra
none
Patch
none
Patch
none
Patch
dino: review+, commit-queue: commit-queue-
Archive of layout-test-results from ews200 for win-future
none
Patch with reviewer added
none
Patch none

Description Justin Fan 2018-08-02 17:17:50 PDT
WebGL 2 conformance: vertex_arrays/vertex_array_object.html
Comment 1 Justin Fan 2018-08-02 17:18:35 PDT
<rdar://problem/42792709>
Comment 2 Justin Fan 2018-08-02 17:28:47 PDT
Mac side is done, fixing iOS before uploading the patch.
Comment 3 Justin Fan 2018-08-02 18:03:27 PDT
Created attachment 346439 [details]
Patch
Comment 4 Justin Fan 2018-08-02 18:07:13 PDT
We shouldn’t need the _APPLE calls anymore; VAOs take the OES extension path for WebGL 1, whereas WebGL 2 is now backed by GL 4 or ES 3 which both natively support vertex arrays.
Comment 5 Dean Jackson 2018-08-02 18:46:20 PDT
Comment on attachment 346439 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=346439&action=review

> Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:98
> +#if !USE(OPENGL_ES)

Swap this to be #if USE(OPENGL_ES)

> Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:99
> +    bindVertexArray(nullptr); // WebGL, unlike OpenGL 3.3+, expects a bound default VAO.

Could you expand on this comment a bit? It's also a bit confusing, because you're talking about WebGL but inside a block that is doing desktop OpenGL.

Maybe you could say something like "OpenGL 3.3+ removed the concept of default VAO. For that reason we need to explicitly bind to nothing before trying to initialise it."
Or something :)

> Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:1070
> +#if !USE(OPENGL_ES)

Swap this to be #if USE(OPENGL_ES)

> Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:1780
> +    if (buffer->isDeleted() || !deleteObject(buffer))

What causes this change? Where is the WebGLBuffer getting deleted?

> Source/WebCore/html/canvas/WebGLVertexArrayObject.cpp:55
> -    switch (m_type) {
> -    case Type::Default:
> -        break;
> -    case Type::User:
> -        setObject(this->context()->graphicsContext3D()->createVertexArray());
> -        break;
> -    }
> +#if !USE(OPENGL_ES)
> +    ASSERT(!(type == Type::Default && this->context()->m_defaultVertexArrayObject));
> +#else
> +    if (m_type != Type::User)
> +        return;
> +#endif
> +    setObject(this->context()->graphicsContext3D()->createVertexArray());

I suggest writing the #if with a positive conditional:

#if USE(OPENGL_ES)

I'd also write the ASSERT without the ! : type != Type::Default || !this->context()->m_defaultVertexArrayObject
Comment 6 EWS Watchlist 2018-08-02 18:54:11 PDT
Comment on attachment 346439 [details]
Patch

Attachment 346439 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/8744330

New failing tests:
webgl/2.0.0/conformance2/glsl3/array-assign.html
webgl/2.0.0/conformance2/glsl3/array-equality.html
webgl/2.0.0/conformance2/glsl3/tricky-loop-conditions.html
webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing.html
webgl/2.0.0/conformance2/glsl3/loops-with-side-effects.html
webgl/2.0.0/conformance2/glsl3/array-as-return-value.html
webgl/2.0.0/conformance2/glsl3/compare-structs-containing-arrays.html
webgl/2.0.0/conformance2/glsl3/no-attribute-vertex-shader.html
webgl/2.0.0/conformance2/glsl3/array-in-complex-expression.html
webgl/2.0.0/conformance2/glsl3/bool-type-cast-bug-uint-ivec-uvec.html
webgl/2.0.0/conformance2/glsl3/array-assign-constructor.html
webgl/2.0.0/conformance2/glsl3/array-element-increment.html
webgl/2.0.0/conformance2/glsl3/frag-depth.html
webgl/2.0.0/conformance2/glsl3/short-circuiting-in-loop-condition.html
webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing-nv-driver-bug.html
webgl/1.0.2/conformance/more/functions/deleteBufferBadArgs.html
webgl/2.0.0/conformance2/glsl3/const-array-init.html
webgl/2.0.0/conformance2/glsl3/array-complex-indexing.html
Comment 7 EWS Watchlist 2018-08-02 18:54:13 PDT
Created attachment 346442 [details]
Archive of layout-test-results from ews106 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 8 Justin Fan 2018-08-02 19:00:04 PDT
(In reply to Dean Jackson from comment #5)
> Comment on attachment 346439 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=346439&action=review

Got it, thanks!

> > Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:1780
> > +    if (buffer->isDeleted() || !deleteObject(buffer))
> 
> What causes this change? Where is the WebGLBuffer getting deleted?

For this, WebGL 1 spec states that most redundant delete functions (e.g. binding two VAOs to a single buffer, then binding the first VAO and calling deleteBuffer; binding the second VAO and calling deleteBuffer should do nothing) should be no-ops. Since we weren't preventing this, the conformance test was failing. I actually have a more general change that should affect deleteProgram, deleteShader, deleteTexture, deleteRenderBuffer, and deleteFrameBuffer as well as per the spec. 

Going to throw another patch at EWS, this time with the new test passes in /glsl3 and fixing the crash in deleteBufferBadArgs.
Comment 9 EWS Watchlist 2018-08-02 19:08:47 PDT
Comment on attachment 346439 [details]
Patch

Attachment 346439 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/8744502

New failing tests:
webgl/2.0.0/conformance2/glsl3/array-assign.html
webgl/2.0.0/conformance2/glsl3/array-equality.html
webgl/2.0.0/conformance2/glsl3/tricky-loop-conditions.html
webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing.html
webgl/2.0.0/conformance2/glsl3/loops-with-side-effects.html
webgl/2.0.0/conformance2/glsl3/array-as-return-value.html
webgl/2.0.0/conformance2/glsl3/compare-structs-containing-arrays.html
webgl/2.0.0/conformance2/glsl3/no-attribute-vertex-shader.html
webgl/2.0.0/conformance2/glsl3/array-in-complex-expression.html
webgl/2.0.0/conformance2/glsl3/bool-type-cast-bug-uint-ivec-uvec.html
webgl/2.0.0/conformance2/glsl3/array-assign-constructor.html
webgl/2.0.0/conformance2/glsl3/array-element-increment.html
webgl/2.0.0/conformance2/glsl3/frag-depth.html
webgl/2.0.0/conformance2/glsl3/short-circuiting-in-loop-condition.html
webgl/2.0.0/conformance2/glsl3/vector-dynamic-indexing-nv-driver-bug.html
webgl/1.0.2/conformance/more/functions/deleteBufferBadArgs.html
webgl/2.0.0/conformance2/glsl3/const-array-init.html
webgl/2.0.0/conformance2/glsl3/array-complex-indexing.html
Comment 10 EWS Watchlist 2018-08-02 19:08:49 PDT
Created attachment 346443 [details]
Archive of layout-test-results from ews101 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 11 Justin Fan 2018-08-02 19:16:15 PDT
Created attachment 346445 [details]
Patch
Comment 12 Justin Fan 2018-08-02 21:21:35 PDT
Created attachment 346450 [details]
Patch
Comment 13 Justin Fan 2018-08-02 22:29:12 PDT
Created attachment 346456 [details]
Patch
Comment 14 EWS Watchlist 2018-08-03 08:54:19 PDT
Comment on attachment 346456 [details]
Patch

Attachment 346456 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8750945

New failing tests:
http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
Comment 15 EWS Watchlist 2018-08-03 08:54:31 PDT
Created attachment 346491 [details]
Archive of layout-test-results from ews200 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews200  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 16 WebKit Commit Bot 2018-08-03 11:21:32 PDT
Comment on attachment 346456 [details]
Patch

Rejecting attachment 346456 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'validate-changelog', '--check-oops', '--non-interactive', 346456, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

/Volumes/Data/EWS/WebKit/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: https://webkit-queues.webkit.org/results/8753272
Comment 17 Justin Fan 2018-08-03 15:38:20 PDT
Created attachment 346553 [details]
Patch with reviewer added
Comment 18 Justin Fan 2018-08-03 15:46:18 PDT
Created attachment 346555 [details]
Patch
Comment 19 WebKit Commit Bot 2018-08-03 17:11:57 PDT
Comment on attachment 346555 [details]
Patch

Clearing flags on attachment: 346555

Committed r234566: <https://trac.webkit.org/changeset/234566>
Comment 20 WebKit Commit Bot 2018-08-03 17:11:59 PDT
All reviewed patches have been landed.  Closing bug.