Performance: Skip texture upload if source image and destination texture haven't...
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Oct 2017 02:38:09 +0000 (02:38 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Oct 2017 02:38:09 +0000 (02:38 +0000)
commit5e865c2b697cd5d3564460e16b499468314cfcaa
treec40713c73927271c569d3f40eed8d953649e6201
parent4967006b174f2e9f0b4f2ff507e82528e79c63ab
Performance: Skip texture upload if source image and destination texture haven't changed
https://bugs.webkit.org/show_bug.cgi?id=178254
<rdar://problem/34968181>

Reviewed by Dean Jackson.

Source/WebCore:

Update GraphicsContext3D to track which texture is bound to which texture unit, and also to
track when those bound textures have their backing stores modified. This new "seed" value
will be used to determine whether a given texture which has previously had image data
uploaded to it needs to be re-updated.

In VideoTextureCopierCV, track whether the texture's seed changed, whether the IOSurface is
the same,  whether the IOSurface's seed has changed, and whether the "flipY" parameter
changed since the last time the copier was asked to upload to the texture.

* platform/graphics/GraphicsContext3D.h:
(WebCore::GraphicsContext3D::textureSeed):
(WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture):
(WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture):
(WebCore::GraphicsContext3D::GraphicsContext3DState::setBoundTexture):
* platform/graphics/cv/VideoTextureCopierCV.cpp:
(WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
* platform/graphics/cv/VideoTextureCopierCV.h:
(WebCore::VideoTextureCopierCV::lastTextureSeed):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::prepareTexture):
(WebCore::GraphicsContext3D::bindTexture):
(WebCore::GraphicsContext3D::texStorage2D):
(WebCore::GraphicsContext3D::texStorage3D):
(WebCore::GraphicsContext3D::framebufferTexture2D):
(WebCore::GraphicsContext3D::texSubImage2D):
(WebCore::GraphicsContext3D::compressedTexImage2D):
(WebCore::GraphicsContext3D::compressedTexSubImage2D):
(WebCore::GraphicsContext3D::createTexture):
(WebCore::GraphicsContext3D::deleteTexture):
(WebCore::GraphicsContext3D::texImage2DDirect):

Source/WTF:

Add a new class, UnsafePointer, for safely holding pointers to objects with uncontrolled lifetimes.

* WTF.xcodeproj/project.pbxproj:
* wtf/UnsafePointer.h: Added.
(WTF::UnsafePointer::UnsafePointer):
(WTF::UnsafePointer::operator== const):
(WTF::UnsafePointer::operator!= const):
(WTF::UnsafePointer::operator bool const):
(WTF::operator==):
(WTF::operator!=):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/UnsafePointer.h [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp
Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.h
Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp