Title: [261769] trunk/Source/WebCore
Revision
261769
Author
[email protected]
Date
2020-05-15 16:57:24 -0700 (Fri, 15 May 2020)

Log Message

OES_texture_float internal format conversion must depend on WEBGL_color_buffer_float
https://bugs.webkit.org/show_bug.cgi?id=211971

Patch by Kenneth Russell <[email protected]> on 2020-05-15
Reviewed by Dean Jackson.

Only adjust the internal formats of textures created for the WebGL
1.0 OES_texture_float extension if the WEBGL_color_buffer_float
extension has been enabled.

Covered by the WebGL 1.0 OES_texture_float conformance tests when
run on iOS with another forthcoming fix to ANGLE which will enable
the OES_texture_float extension on that platform.

* platform/graphics/angle/ExtensionsGLANGLE.cpp:
(WebCore::ExtensionsGLANGLE::ensureEnabled):
(WebCore::ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat):
* platform/graphics/angle/ExtensionsGLANGLE.h:
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::texImage2DDirect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261768 => 261769)


--- trunk/Source/WebCore/ChangeLog	2020-05-15 23:43:04 UTC (rev 261768)
+++ trunk/Source/WebCore/ChangeLog	2020-05-15 23:57:24 UTC (rev 261769)
@@ -1,3 +1,25 @@
+2020-05-15  Kenneth Russell  <[email protected]>
+
+        OES_texture_float internal format conversion must depend on WEBGL_color_buffer_float
+        https://bugs.webkit.org/show_bug.cgi?id=211971
+
+        Reviewed by Dean Jackson.
+
+        Only adjust the internal formats of textures created for the WebGL
+        1.0 OES_texture_float extension if the WEBGL_color_buffer_float
+        extension has been enabled.
+
+        Covered by the WebGL 1.0 OES_texture_float conformance tests when
+        run on iOS with another forthcoming fix to ANGLE which will enable
+        the OES_texture_float extension on that platform.
+
+        * platform/graphics/angle/ExtensionsGLANGLE.cpp:
+        (WebCore::ExtensionsGLANGLE::ensureEnabled):
+        (WebCore::ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat):
+        * platform/graphics/angle/ExtensionsGLANGLE.h:
+        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+        (WebCore::GraphicsContextGLOpenGL::texImage2DDirect):
+
 2020-05-15  Oriol Brufau  <[email protected]>
 
         [css-grid] Treat percentages as auto for the minimum contribution

Modified: trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp (261768 => 261769)


--- trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp	2020-05-15 23:43:04 UTC (rev 261768)
+++ trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp	2020-05-15 23:57:24 UTC (rev 261769)
@@ -87,6 +87,11 @@
         m_context->makeContextCurrent();
         gl::RequestExtensionANGLE(name.ascii().data());
         m_enabledExtensions.add(name);
+
+        if (name == "GL_CHROMIUM_color_buffer_float_rgba"_s)
+            m_webglColorBufferFloatRGBA = true;
+        else if (name == "GL_CHROMIUM_color_buffer_float_rgb"_s)
+            m_webglColorBufferFloatRGB = true;
     }
 }
 
@@ -249,13 +254,11 @@
 GCGLenum ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat(GCGLenum internalformat, GCGLenum format, GCGLenum type)
 {
     // The implementation of WEBGL_color_buffer_float for WebGL 1.0 / ES 2.0 requires a sized
-    // internal format. Adjust it if necessary at this lowest level. Note that it does not matter at
-    // this point whether the WEBGL_color_buffer_float extension has actually been enabled at higher
-    // levels; the enum will be valid or invalid either way.
+    // internal format. Adjust it if necessary at this lowest level.
     if (type == GL_FLOAT) {
-        if (format == GL_RGBA && internalformat == GL_RGBA)
+        if (m_webglColorBufferFloatRGBA && format == GL_RGBA && internalformat == GL_RGBA)
             return GL_RGBA32F;
-        if (format == GL_RGB && internalformat == GL_RGB)
+        if (m_webglColorBufferFloatRGB && format == GL_RGB && internalformat == GL_RGB)
             return GL_RGB32F;
     }
     return internalformat;

Modified: trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.h (261768 => 261769)


--- trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.h	2020-05-15 23:43:04 UTC (rev 261768)
+++ trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.h	2020-05-15 23:57:24 UTC (rev 261769)
@@ -148,7 +148,7 @@
     void getQueryObjectui64vRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint64 *params) override;
 
     // Only for non-WebGL 2.0 contexts.
-    static GCGLenum adjustWebGL1TextureInternalFormat(GCGLenum internalformat, GCGLenum format, GCGLenum type);
+    GCGLenum adjustWebGL1TextureInternalFormat(GCGLenum internalformat, GCGLenum format, GCGLenum type);
 
 private:
     bool supportsExtension(const WTF::String&);
@@ -174,6 +174,10 @@
 
     String m_vendor;
     String m_renderer;
+
+    // Whether the WebGL 1.0-related floating-point renderability extensions have been enabled.
+    bool m_webglColorBufferFloatRGB { false };
+    bool m_webglColorBufferFloatRGBA { false };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (261768 => 261769)


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2020-05-15 23:43:04 UTC (rev 261768)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2020-05-15 23:57:24 UTC (rev 261769)
@@ -1888,8 +1888,8 @@
 void GraphicsContextGLOpenGL::texImage2DDirect(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, const void* pixels)
 {
     makeContextCurrent();
-    if (!m_isForWebGL2)
-        internalformat = ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat(internalformat, format, type);
+    if (!m_isForWebGL2 && m_extensions)
+        internalformat = m_extensions->adjustWebGL1TextureInternalFormat(internalformat, format, type);
     gl::TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
     m_state.textureSeedCount.add(m_state.currentBoundTexture());
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to