[WebGL] VideoTextureCopierCV doesn't correctly restore vertex attribute state
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Sep 2017 02:55:33 +0000 (02:55 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Sep 2017 02:55:33 +0000 (02:55 +0000)
commitc056c081861e22cd433bbe6c333644c278b45c30
tree970cbd51b539d1f2a4610cb9458ebece724a9b83
parent9f5b333cec49bc29a0d246c2869ec20e68e22304
[WebGL] VideoTextureCopierCV doesn't correctly restore vertex attribute state
https://bugs.webkit.org/show_bug.cgi?id=176771
<rdar://problem/34386621>

Reviewed by Antoine Quint.

Source/WebCore:

The OpenGL context in VideoTextureCopierCV wasn't being restored to
the state it had before rendering a video to a texture. Specifically
the vertex attribute values were never recorded by the state saver.

Update the existing test of VideoTextureCopierCV so that it is
explicitly doing something different from the WebCore code, which
means that state will have to be correctly restored for the test
to pass.

* platform/graphics/cv/VideoTextureCopierCV.cpp:
(WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Make sure
to record the vertex attribute state once we know the location of the position attribute.
(WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver):
(WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
(WebCore::VideoTextureCopierCV::GC3DStateSaver::saveVertexAttribState): Save all the
applicable vertex attribute state information.
* platform/graphics/cv/VideoTextureCopierCV.h: GC3DStateSaver can use a reference
to the GC3D rather than a pointer.

LayoutTests:

Tweak this test to make sure it does something different from
the code in WebCore to render a video into a texture, thus
ensuring that we're testing state is correctly restored.

* fast/canvas/webgl/texImage2D-video-flipY-true.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222198 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/texImage2D-video-flipY-true.html
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp
Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.h