Title: [250697] trunk/Source/WebCore
Revision
250697
Author
[email protected]
Date
2019-10-03 20:48:11 -0700 (Thu, 03 Oct 2019)

Log Message

Fix WebGL 1 conformance regressions when USE_ANGLE=1
https://bugs.webkit.org/show_bug.cgi?id=202545

Prevent ANGLE from automatically using ES3 when ES2 is requested.

WEBGL_debug_shaders extension should not accept or return null.

Enable ANGLE's new support for emulating RGB on RGBA IOSurfaces.

Patch by James Darpinian <[email protected]> on 2019-10-03
Reviewed by Alex Christensen.

* html/canvas/WebGLDebugShaders.cpp:
(WebCore::WebGLDebugShaders::getTranslatedShaderSource):
* html/canvas/WebGLDebugShaders.h:
* html/canvas/WebGLDebugShaders.idl:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::validateVertexAttributes):
* platform/graphics/angle/Extensions3DANGLE.cpp:
(WebCore::Extensions3DANGLE::getTranslatedShaderSourceANGLE):
* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/cocoa/WebGLLayer.mm:
(-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (250696 => 250697)


--- trunk/Source/WebCore/ChangeLog	2019-10-04 02:00:13 UTC (rev 250696)
+++ trunk/Source/WebCore/ChangeLog	2019-10-04 03:48:11 UTC (rev 250697)
@@ -1,3 +1,29 @@
+2019-10-03  James Darpinian  <[email protected]>
+
+        Fix WebGL 1 conformance regressions when USE_ANGLE=1
+        https://bugs.webkit.org/show_bug.cgi?id=202545
+
+        Prevent ANGLE from automatically using ES3 when ES2 is requested.
+
+        WEBGL_debug_shaders extension should not accept or return null.
+
+        Enable ANGLE's new support for emulating RGB on RGBA IOSurfaces.
+
+        Reviewed by Alex Christensen.
+
+        * html/canvas/WebGLDebugShaders.cpp:
+        (WebCore::WebGLDebugShaders::getTranslatedShaderSource):
+        * html/canvas/WebGLDebugShaders.h:
+        * html/canvas/WebGLDebugShaders.idl:
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::validateVertexAttributes):
+        * platform/graphics/angle/Extensions3DANGLE.cpp:
+        (WebCore::Extensions3DANGLE::getTranslatedShaderSourceANGLE):
+        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        * platform/graphics/cocoa/WebGLLayer.mm:
+        (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
+
 2019-10-03  Jer Noble  <[email protected]>
 
     [iOS] WebContent process can be interrupted during suspension; loses "Now Playing" status

Modified: trunk/Source/WebCore/html/canvas/WebGLDebugShaders.cpp (250696 => 250697)


--- trunk/Source/WebCore/html/canvas/WebGLDebugShaders.cpp	2019-10-04 02:00:13 UTC (rev 250696)
+++ trunk/Source/WebCore/html/canvas/WebGLDebugShaders.cpp	2019-10-04 03:48:11 UTC (rev 250697)
@@ -48,13 +48,13 @@
     return WebGLDebugShadersName;
 }
 
-String WebGLDebugShaders::getTranslatedShaderSource(WebGLShader* shader)
+String WebGLDebugShaders::getTranslatedShaderSource(WebGLShader& shader)
 {
     if (m_context.isContextLost())
         return String();
-    if (!m_context.validateWebGLObject("getTranslatedShaderSource", shader))
+    if (!m_context.validateWebGLObject("getTranslatedShaderSource", &shader))
         return emptyString();
-    return m_context.graphicsContext3D()->getExtensions().getTranslatedShaderSourceANGLE(shader->object());
+    return m_context.graphicsContext3D()->getExtensions().getTranslatedShaderSourceANGLE(shader.object());
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/canvas/WebGLDebugShaders.h (250696 => 250697)


--- trunk/Source/WebCore/html/canvas/WebGLDebugShaders.h	2019-10-04 02:00:13 UTC (rev 250696)
+++ trunk/Source/WebCore/html/canvas/WebGLDebugShaders.h	2019-10-04 03:48:11 UTC (rev 250697)
@@ -40,7 +40,7 @@
 
     ExtensionName getName() const override;
 
-    String getTranslatedShaderSource(WebGLShader*);
+    String getTranslatedShaderSource(WebGLShader&);
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/canvas/WebGLDebugShaders.idl (250696 => 250697)


--- trunk/Source/WebCore/html/canvas/WebGLDebugShaders.idl	2019-10-04 02:00:13 UTC (rev 250696)
+++ trunk/Source/WebCore/html/canvas/WebGLDebugShaders.idl	2019-10-04 03:48:11 UTC (rev 250697)
@@ -28,5 +28,5 @@
     GenerateIsReachable=ImplWebGLRenderingContext,
     NoInterfaceObject,
 ] interface WebGLDebugShaders {
-    DOMString? getTranslatedShaderSource(WebGLShader? shader); // FIXME: The return value and the parameter should not be nullable.
+    DOMString getTranslatedShaderSource(WebGLShader shader);
 };

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (250696 => 250697)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2019-10-04 02:00:13 UTC (rev 250696)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2019-10-04 03:48:11 UTC (rev 250697)
@@ -2120,6 +2120,9 @@
             return false;
         }
     }
+#else
+    UNUSED_PARAM(elementCount);
+    UNUSED_PARAM(primitiveCount);
 #endif
     
     return true;

Modified: trunk/Source/WebCore/platform/graphics/angle/Extensions3DANGLE.cpp (250696 => 250697)


--- trunk/Source/WebCore/platform/graphics/angle/Extensions3DANGLE.cpp	2019-10-04 02:00:13 UTC (rev 250696)
+++ trunk/Source/WebCore/platform/graphics/angle/Extensions3DANGLE.cpp	2019-10-04 03:48:11 UTC (rev 250697)
@@ -111,7 +111,8 @@
     gl::GetTranslatedShaderSourceANGLE(shader, sourceLength, &returnedLength, name.data());
     if (!returnedLength)
         return emptyString();
-    ASSERT(returnedLength == sourceLength);
+    // returnedLength does not include the null terminator.
+    ASSERT(returnedLength == sourceLength - 1);
     return String(name.data(), returnedLength);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm (250696 => 250697)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm	2019-10-04 02:00:13 UTC (rev 250696)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm	2019-10-04 03:48:11 UTC (rev 250697)
@@ -327,6 +327,9 @@
     std::vector<EGLint> contextAttributes;
     contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
     contextAttributes.push_back(2);
+    // ANGLE will upgrade the context to ES3 automatically unless this is specified.
+    contextAttributes.push_back(EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE);
+    contextAttributes.push_back(EGL_FALSE);
     contextAttributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
     contextAttributes.push_back(EGL_TRUE);
     if (strstr(displayExtensions, "EGL_ANGLE_power_preference")) {

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm (250696 => 250697)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2019-10-04 02:00:13 UTC (rev 250696)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2019-10-04 03:48:11 UTC (rev 250697)
@@ -220,7 +220,7 @@
         EGL_HEIGHT, size.height(),
         EGL_IOSURFACE_PLANE_ANGLE, 0,
         EGL_TEXTURE_TARGET, EGL_TEXTURE_RECTANGLE_ANGLE,
-        EGL_TEXTURE_INTERNAL_FORMAT_ANGLE, GL_BGRA_EXT,
+        EGL_TEXTURE_INTERNAL_FORMAT_ANGLE, usingAlpha ? GL_BGRA_EXT : GL_RGB,
         EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
         EGL_TEXTURE_TYPE_ANGLE, GL_UNSIGNED_BYTE,
         EGL_NONE, EGL_NONE
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to