[TexMap] Add TextureMapperContextAttributes
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Aug 2017 07:46:42 +0000 (07:46 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Aug 2017 07:46:42 +0000 (07:46 +0000)
commit571392f2c94a07a28f94831bca3ec6f7426fb8f7
tree0179985e893f28dfa38f1c2f9ca6938d84783ac9
parentc7c1a4484a63f7a495e54cb034cfd359d8636b90
[TexMap] Add TextureMapperContextAttributes
https://bugs.webkit.org/show_bug.cgi?id=175311

Reviewed by Carlos Garcia Campos.

Add and use TextureMapperContextAttributes, a slim struct that holds
information about the type and extensions supported by the OpenGL
context that's being used for one specific TextureMapperGL instance.

This struct is initialized in the TextureMapperGL constructor for the
OpenGL context that's been made current on that thread, and that will
be used for that TextureMapperGL instance through its lifetime. The
struct is then also copied into any BitmapTextureGL objects that have
been created through this TextureMapperGL (or its texture pool).

The struct is initialized with information about GLES2 support (which
is at this point done through the USE_OPENGL_ES_2 macro) and about
specific OpenGL extensions that are supported. These are then used in
TextureMapperGL (NPOT textures) and BitmapTextureGL (BGRA support,
sub-image unpacking) to deploy specific optimizations or workarounds.

This ultimately serves as a replacement for clunky static functions
that need to operate on GraphicsContext3D objects to retrieve this
information.

No new tests -- no change in behavior.

* platform/TextureMapper.cmake:
* platform/graphics/texmap/BitmapTextureGL.cpp:
(WebCore::BitmapTextureGL::BitmapTextureGL):
(WebCore::BitmapTextureGL::updateContentsNoSwizzle):
(WebCore::BitmapTextureGL::updateContents):
(WebCore::driverSupportsSubImage): Deleted.
* platform/graphics/texmap/BitmapTextureGL.h:
(WebCore::BitmapTextureGL::create):
* platform/graphics/texmap/BitmapTexturePool.cpp:
(WebCore::BitmapTexturePool::BitmapTexturePool):
(WebCore::BitmapTexturePool::createTexture):
* platform/graphics/texmap/BitmapTexturePool.h:
* platform/graphics/texmap/TextureMapperContextAttributes.cpp: Added.
(WebCore::TextureMapperContextAttributes::initialize):
* platform/graphics/texmap/TextureMapperContextAttributes.h: Added.
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::TextureMapperGL):
(WebCore::TextureMapperGL::drawTexture):
(WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
(WebCore::TextureMapperGL::createTexture):
(WebCore::driverSupportsNPOTTextures): Deleted.
* platform/graphics/texmap/TextureMapperGL.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@220392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/TextureMapper.cmake
Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp
Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h
Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp
Source/WebCore/platform/graphics/texmap/BitmapTexturePool.h
Source/WebCore/platform/graphics/texmap/TextureMapperContextAttributes.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/texmap/TextureMapperContextAttributes.h [new file with mode: 0644]
Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperGL.h