Title: [295279] trunk
Revision
295279
Author
[email protected]
Date
2022-06-06 01:43:37 -0700 (Mon, 06 Jun 2022)

Log Message

Add OES_draw_buffers_indexed WebGL extension support
https://bugs.webkit.org/show_bug.cgi?id=222430

Patch by Alexey Knyazev <[email protected]> on 2022-06-06
Reviewed by Kimmo Kinnunen.

* Added the entrypoints defined by the extension
* Added getIntegeri_v and getIntegeri context functions

* LayoutTests/TestExpectations:
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp:
(WebCore::convertToJSValue):
* Source/WebCore/html/canvas/OESDrawBuffersIndexed.cpp: Added.
(WebCore::OESDrawBuffersIndexed::OESDrawBuffersIndexed):
(WebCore::OESDrawBuffersIndexed::getName const):
(WebCore::OESDrawBuffersIndexed::supported):
(WebCore::OESDrawBuffersIndexed::enableiOES):
(WebCore::OESDrawBuffersIndexed::disableiOES):
(WebCore::OESDrawBuffersIndexed::blendEquationiOES):
(WebCore::OESDrawBuffersIndexed::blendEquationSeparateiOES):
(WebCore::OESDrawBuffersIndexed::blendFunciOES):
(WebCore::OESDrawBuffersIndexed::blendFuncSeparateiOES):
(WebCore::OESDrawBuffersIndexed::colorMaskiOES):
* Source/WebCore/html/canvas/OESDrawBuffersIndexed.h: Added.
* Source/WebCore/html/canvas/OESDrawBuffersIndexed.idl: Added.
* Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::getIndexedParameter):
(WebCore::WebGL2RenderingContext::getIndexedBooleanArrayParameter):
(WebCore::WebGL2RenderingContext::getExtension):
(WebCore::WebGL2RenderingContext::getSupportedExtensions):
* Source/WebCore/html/canvas/WebGL2RenderingContext.h:
* Source/WebCore/html/canvas/WebGLExtension.h:
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::extensionIsEnabled):
(WebCore::WebGLRenderingContextBase::loseExtensions):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
(WebCore::GraphicsContextGL::getIntegeri):
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::getIntegeri_v):
(WebCore::GraphicsContextGLANGLE::enableiOES):
(WebCore::GraphicsContextGLANGLE::disableiOES):
(WebCore::GraphicsContextGLANGLE::blendEquationiOES):
(WebCore::GraphicsContextGLANGLE::blendEquationSeparateiOES):
(WebCore::GraphicsContextGLANGLE::blendFunciOES):
(WebCore::GraphicsContextGLANGLE::blendFuncSeparateiOES):
(WebCore::GraphicsContextGLANGLE::colorMaskiOES):
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h:
* Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
(WebCore::GraphicsContextGLOpenGL::getIntegeri_v):
(WebCore::GraphicsContextGLOpenGL::enableiOES):
(WebCore::GraphicsContextGLOpenGL::disableiOES):
(WebCore::GraphicsContextGLOpenGL::blendEquationiOES):
(WebCore::GraphicsContextGLOpenGL::blendEquationSeparateiOES):
(WebCore::GraphicsContextGLOpenGL::blendFunciOES):
(WebCore::GraphicsContextGLOpenGL::blendFuncSeparateiOES):
(WebCore::GraphicsContextGLOpenGL::colorMaskiOES):
* Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
(getIntegeri_v):
(enableiOES):
(disableiOES):
(blendEquationiOES):
(blendEquationSeparateiOES):
(blendFunciOES):
(blendFuncSeparateiOES):
(colorMaskiOES):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:
(WebKit::RemoteGraphicsContextGLProxy::getIntegeri_v):
(WebKit::RemoteGraphicsContextGLProxy::enableiOES):
(WebKit::RemoteGraphicsContextGLProxy::disableiOES):
(WebKit::RemoteGraphicsContextGLProxy::blendEquationiOES):
(WebKit::RemoteGraphicsContextGLProxy::blendEquationSeparateiOES):
(WebKit::RemoteGraphicsContextGLProxy::blendFunciOES):
(WebKit::RemoteGraphicsContextGLProxy::blendFuncSeparateiOES):
(WebKit::RemoteGraphicsContextGLProxy::colorMaskiOES):

Canonical link: https://commits.webkit.org/251325@main

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/TestExpectations (295278 => 295279)


--- trunk/LayoutTests/TestExpectations	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/LayoutTests/TestExpectations	2022-06-06 08:43:37 UTC (rev 295279)
@@ -3780,6 +3780,7 @@
 # Explicitly turn on conformance test until all of webgl/2.0.y is enabled
 webgl/2.0.y/conformance/extensions/webgl-compressed-texture-s3tc-srgb.html [ Pass ]
 webgl/2.0.y/conformance2/extensions/ext-texture-norm16.html [ Pass ]
+webgl/2.0.y/conformance2/extensions/oes-draw-buffers-indexed.html [ Pass ]
 
 # WebGL 1.0.3 and 2.0.0 tests where behavior is obsolete and WebKit contains implementation
 # and tests for the new behavior. Should be removed once 1.0.3 and 2.0.0 are retired.

Modified: trunk/Source/WebCore/CMakeLists.txt (295278 => 295279)


--- trunk/Source/WebCore/CMakeLists.txt	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/CMakeLists.txt	2022-06-06 08:43:37 UTC (rev 295279)
@@ -1814,6 +1814,7 @@
         html/canvas/EXTTextureNorm16.cpp
         html/canvas/EXTsRGB.cpp
         html/canvas/KHRParallelShaderCompile.cpp
+        html/canvas/OESDrawBuffersIndexed.cpp
         html/canvas/OESElementIndexUint.cpp
         html/canvas/OESFBORenderMipmap.cpp
         html/canvas/OESStandardDerivatives.cpp
@@ -1877,6 +1878,7 @@
     html/canvas/EXTTextureNorm16.idl
     html/canvas/EXTsRGB.idl
     html/canvas/KHRParallelShaderCompile.idl
+    html/canvas/OESDrawBuffersIndexed.idl
     html/canvas/OESElementIndexUint.idl
     html/canvas/OESFBORenderMipmap.idl
     html/canvas/OESStandardDerivatives.idl

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (295278 => 295279)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2022-06-06 08:43:37 UTC (rev 295279)
@@ -1305,6 +1305,7 @@
 $(PROJECT_DIR)/html/canvas/ImageBitmapRenderingContextSettings.idl
 $(PROJECT_DIR)/html/canvas/ImageSmoothingQuality.idl
 $(PROJECT_DIR)/html/canvas/KHRParallelShaderCompile.idl
+$(PROJECT_DIR)/html/canvas/OESDrawBuffersIndexed.idl
 $(PROJECT_DIR)/html/canvas/OESElementIndexUint.idl
 $(PROJECT_DIR)/html/canvas/OESFBORenderMipmap.idl
 $(PROJECT_DIR)/html/canvas/OESStandardDerivatives.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (295278 => 295279)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2022-06-06 08:43:37 UTC (rev 295279)
@@ -1760,6 +1760,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationPermission.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationPermissionCallback.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSNotificationPermissionCallback.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOESDrawBuffersIndexed.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOESDrawBuffersIndexed.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOESElementIndexUint.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOESElementIndexUint.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOESFBORenderMipmap.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (295278 => 295279)


--- trunk/Source/WebCore/DerivedSources.make	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/DerivedSources.make	2022-06-06 08:43:37 UTC (rev 295279)
@@ -1147,6 +1147,7 @@
     $(WebCore)/html/canvas/ImageBitmapRenderingContextSettings.idl \
     $(WebCore)/html/canvas/ImageSmoothingQuality.idl \
     $(WebCore)/html/canvas/KHRParallelShaderCompile.idl \
+    $(WebCore)/html/canvas/OESDrawBuffersIndexed.idl \
     $(WebCore)/html/canvas/OESElementIndexUint.idl \
     $(WebCore)/html/canvas/OESFBORenderMipmap.idl \
     $(WebCore)/html/canvas/OESStandardDerivatives.idl \

Modified: trunk/Source/WebCore/Sources.txt (295278 => 295279)


--- trunk/Source/WebCore/Sources.txt	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/Sources.txt	2022-06-06 08:43:37 UTC (rev 295279)
@@ -1371,6 +1371,7 @@
 html/canvas/GPUBasedCanvasRenderingContext.cpp
 html/canvas/ImageBitmapRenderingContext.cpp
 html/canvas/KHRParallelShaderCompile.cpp
+html/canvas/OESDrawBuffersIndexed.cpp
 html/canvas/OESElementIndexUint.cpp
 html/canvas/OESFBORenderMipmap.cpp
 html/canvas/OESStandardDerivatives.cpp
@@ -3548,6 +3549,7 @@
 JSNotificationOptions.cpp
 JSNotificationPermission.cpp
 JSNotificationPermissionCallback.cpp
+JSOESDrawBuffersIndexed.cpp
 JSOESElementIndexUint.cpp
 JSOESFBORenderMipmap.cpp
 JSOESStandardDerivatives.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (295278 => 295279)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-06-06 08:43:37 UTC (rev 295279)
@@ -2872,6 +2872,7 @@
 		8A9A587111E84C36008ACFD1 /* JSPerformanceNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A9A586F11E84C36008ACFD1 /* JSPerformanceNavigation.h */; };
 		8A9A587511E84C81008ACFD1 /* JSPerformance.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A9A587311E84C81008ACFD1 /* JSPerformance.h */; };
 		8A9A588811E84F37008ACFD1 /* JSPerformanceTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A9A587711E84C98008ACFD1 /* JSPerformanceTiming.h */; };
+		8AAAC5CD2840140500D08AE5 /* OESDrawBuffersIndexed.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AAAC5CA284013D600D08AE5 /* OESDrawBuffersIndexed.h */; };
 		8AB4BC77126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB4BC76126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h */; };
 		8AF4E55611DC5A36000ED3DE /* PerformanceNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AF4E55311DC5A36000ED3DE /* PerformanceNavigation.h */; };
 		8AF4E55C11DC5A63000ED3DE /* PerformanceTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AF4E55911DC5A63000ED3DE /* PerformanceTiming.h */; };
@@ -12641,6 +12642,9 @@
 		8A9A587711E84C98008ACFD1 /* JSPerformanceTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPerformanceTiming.h; sourceTree = "<group>"; };
 		8AA9407E279EEE8100EC0C48 /* JSDOMMicrotask.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSDOMMicrotask.h; sourceTree = "<group>"; };
 		8AA94080279EEE8100EC0C48 /* JSDOMMicrotask.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMMicrotask.cpp; sourceTree = "<group>"; };
+		8AAAC5CA284013D600D08AE5 /* OESDrawBuffersIndexed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OESDrawBuffersIndexed.h; sourceTree = "<group>"; };
+		8AAAC5CB284013D700D08AE5 /* OESDrawBuffersIndexed.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OESDrawBuffersIndexed.idl; sourceTree = "<group>"; };
+		8AAAC5CC284013D700D08AE5 /* OESDrawBuffersIndexed.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OESDrawBuffersIndexed.cpp; sourceTree = "<group>"; };
 		8AB4BC76126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreDestructiveWriteCountIncrementer.h; sourceTree = "<group>"; };
 		8AF4E55211DC5A36000ED3DE /* PerformanceNavigation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceNavigation.cpp; sourceTree = "<group>"; };
 		8AF4E55311DC5A36000ED3DE /* PerformanceNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceNavigation.h; sourceTree = "<group>"; };
@@ -21912,6 +21916,9 @@
 				A3BF7EF2256C8D720044BC75 /* KHRParallelShaderCompile.cpp */,
 				A3BF7EF4256C8D720044BC75 /* KHRParallelShaderCompile.h */,
 				A3BF7EF5256C8D740044BC75 /* KHRParallelShaderCompile.idl */,
+				8AAAC5CC284013D700D08AE5 /* OESDrawBuffersIndexed.cpp */,
+				8AAAC5CA284013D600D08AE5 /* OESDrawBuffersIndexed.h */,
+				8AAAC5CB284013D700D08AE5 /* OESDrawBuffersIndexed.idl */,
 				7E5D7A73161D3F8F00896C34 /* OESElementIndexUint.cpp */,
 				7E5D7A74161D3F8F00896C34 /* OESElementIndexUint.h */,
 				E176580C180DF3A0005A96D1 /* OESElementIndexUint.idl */,
@@ -36770,6 +36777,7 @@
 				1A569D170D7E2B82007C3983 /* objc_runtime.h in Headers */,
 				1A569D190D7E2B82007C3983 /* objc_utility.h in Headers */,
 				E16982551134629D00894115 /* ObjCRuntimeObject.h in Headers */,
+				8AAAC5CD2840140500D08AE5 /* OESDrawBuffersIndexed.h in Headers */,
 				7E5D7A77161D3F8F00896C34 /* OESElementIndexUint.h in Headers */,
 				9001774112E0347800648462 /* OESStandardDerivatives.h in Headers */,
 				6EBF0E4912A8926100DB1709 /* OESTextureFloat.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp (295278 => 295279)


--- trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2022-06-06 08:43:37 UTC (rev 295279)
@@ -42,6 +42,7 @@
 #include "JSEXTTextureNorm16.h"
 #include "JSEXTsRGB.h"
 #include "JSKHRParallelShaderCompile.h"
+#include "JSOESDrawBuffersIndexed.h"
 #include "JSOESElementIndexUint.h"
 #include "JSOESFBORenderMipmap.h"
 #include "JSOESStandardDerivatives.h"
@@ -179,6 +180,7 @@
         TO_JS(EXTTextureNorm16)
         TO_JS(EXTsRGB)
         TO_JS(KHRParallelShaderCompile)
+        TO_JS(OESDrawBuffersIndexed)
         TO_JS(OESElementIndexUint)
         TO_JS(OESFBORenderMipmap)
         TO_JS(OESStandardDerivatives)

Added: trunk/Source/WebCore/html/canvas/OESDrawBuffersIndexed.cpp (0 => 295279)


--- trunk/Source/WebCore/html/canvas/OESDrawBuffersIndexed.cpp	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/OESDrawBuffersIndexed.cpp	2022-06-06 08:43:37 UTC (rev 295279)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2022 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEBGL)
+#include "OESDrawBuffersIndexed.h"
+
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(OESDrawBuffersIndexed);
+
+OESDrawBuffersIndexed::OESDrawBuffersIndexed(WebGLRenderingContextBase& context)
+    : WebGLExtension(context)
+{
+    context.graphicsContextGL()->ensureExtensionEnabled("GL_OES_draw_buffers_indexed"_s);
+}
+
+OESDrawBuffersIndexed::~OESDrawBuffersIndexed() = default;
+
+WebGLExtension::ExtensionName OESDrawBuffersIndexed::getName() const
+{
+    return OESDrawBuffersIndexedName;
+}
+
+bool OESDrawBuffersIndexed::supported(GraphicsContextGL& context)
+{
+    return context.supportsExtension("GL_OES_draw_buffers_indexed"_s);
+}
+
+void OESDrawBuffersIndexed::enableiOES(GCGLenum target, GCGLuint index)
+{
+    if (!m_context || m_context->isContextLost())
+        return;
+
+    m_context->graphicsContextGL()->enableiOES(target, index);
+}
+
+void OESDrawBuffersIndexed::disableiOES(GCGLenum target, GCGLuint index)
+{
+    if (!m_context || m_context->isContextLost())
+        return;
+
+    m_context->graphicsContextGL()->disableiOES(target, index);
+}
+
+void OESDrawBuffersIndexed::blendEquationiOES(GCGLuint buf, GCGLenum mode)
+{
+    if (!m_context || m_context->isContextLost())
+        return;
+
+    m_context->graphicsContextGL()->blendEquationiOES(buf, mode);
+}
+
+void OESDrawBuffersIndexed::blendEquationSeparateiOES(GCGLuint buf, GCGLenum modeRGB, GCGLenum modeAlpha)
+{
+    if (!m_context || m_context->isContextLost())
+        return;
+
+    m_context->graphicsContextGL()->blendEquationSeparateiOES(buf, modeRGB, modeAlpha);
+}
+
+void OESDrawBuffersIndexed::blendFunciOES(GCGLuint buf, GCGLenum src, GCGLenum dst)
+{
+    if (!m_context || m_context->isContextLost())
+        return;
+
+    m_context->graphicsContextGL()->blendFunciOES(buf, src, dst);
+}
+
+void OESDrawBuffersIndexed::blendFuncSeparateiOES(GCGLuint buf, GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha)
+{
+    if (!m_context || m_context->isContextLost())
+        return;
+
+    m_context->graphicsContextGL()->blendFuncSeparateiOES(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
+}
+
+void OESDrawBuffersIndexed::colorMaskiOES(GCGLuint buf, GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha)
+{
+    if (!m_context || m_context->isContextLost())
+        return;
+
+    m_context->graphicsContextGL()->colorMaskiOES(buf, red, green, blue, alpha);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGL)

Added: trunk/Source/WebCore/html/canvas/OESDrawBuffersIndexed.h (0 => 295279)


--- trunk/Source/WebCore/html/canvas/OESDrawBuffersIndexed.h	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/OESDrawBuffersIndexed.h	2022-06-06 08:43:37 UTC (rev 295279)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2022 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "WebGLExtension.h"
+
+namespace WebCore {
+
+class OESDrawBuffersIndexed final : public WebGLExtension {
+    WTF_MAKE_ISO_ALLOCATED(OESDrawBuffersIndexed);
+public:
+    explicit OESDrawBuffersIndexed(WebGLRenderingContextBase&);
+    virtual ~OESDrawBuffersIndexed();
+
+    ExtensionName getName() const final;
+
+    static bool supported(GraphicsContextGL&);
+
+    void enableiOES(GCGLenum target, GCGLuint index);
+
+    void disableiOES(GCGLenum target, GCGLuint index);
+
+    void blendEquationiOES(GCGLuint buf, GCGLenum mode);
+
+    void blendEquationSeparateiOES(GCGLuint buf, GCGLenum modeRGB, GCGLenum modeAlpha);
+
+    void blendFunciOES(GCGLuint buf, GCGLenum src, GCGLenum dst);
+
+    void blendFuncSeparateiOES(GCGLuint buf, GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha);
+
+    void colorMaskiOES(GCGLuint buf, GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha);
+};
+
+} // namespace WebCore

Added: trunk/Source/WebCore/html/canvas/OESDrawBuffersIndexed.idl (0 => 295279)


--- trunk/Source/WebCore/html/canvas/OESDrawBuffersIndexed.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/OESDrawBuffersIndexed.idl	2022-06-06 08:43:37 UTC (rev 295279)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    LegacyNoInterfaceObject,
+    Conditional=WEBGL,
+    GenerateIsReachable=ImplWebGLRenderingContext,
+] interface OESDrawBuffersIndexed {
+    undefined enableiOES(unsigned long target, unsigned long index);
+    undefined disableiOES(unsigned long target, unsigned long index);
+    undefined blendEquationiOES(unsigned long buf, unsigned long mode);
+    undefined blendEquationSeparateiOES(unsigned long buf, unsigned long modeRGB, unsigned long modeAlpha);
+    undefined blendFunciOES(unsigned long buf, unsigned long src, unsigned long dst);
+    undefined blendFuncSeparateiOES(unsigned long buf, unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha);
+    undefined colorMaskiOES(unsigned long buf, boolean r, boolean g, boolean b, boolean a);
+};

Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (295278 => 295279)


--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2022-06-06 08:43:37 UTC (rev 295279)
@@ -45,6 +45,7 @@
 #include "InspectorInstrumentation.h"
 #include "KHRParallelShaderCompile.h"
 #include "Logging.h"
+#include "OESDrawBuffersIndexed.h"
 #include "OESTextureFloatLinear.h"
 #include "RenderBox.h"
 #include "RuntimeEnabledFeatures.h"
@@ -2536,6 +2537,18 @@
             return nullptr;
         }
         return m_boundIndexedUniformBuffers[index];
+    // OES_draw_buffers_indexed state
+    // ANGLE will synthesize an error if the extension
+    // was not enabled or the index is out of bounds
+    case GraphicsContextGL::BLEND_EQUATION_RGB:
+    case GraphicsContextGL::BLEND_EQUATION_ALPHA:
+    case GraphicsContextGL::BLEND_SRC_RGB:
+    case GraphicsContextGL::BLEND_SRC_ALPHA:
+    case GraphicsContextGL::BLEND_DST_RGB:
+    case GraphicsContextGL::BLEND_DST_ALPHA:
+        return m_context->getIntegeri(target, index);
+    case GraphicsContextGL::COLOR_WRITEMASK:
+        return getIndexedBooleanArrayParameter(target, index);
     default:
         synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "getIndexedParameter", "invalid parameter name");
         return nullptr;
@@ -2542,6 +2555,17 @@
     }
 }
 
+Vector<bool> WebGL2RenderingContext::getIndexedBooleanArrayParameter(GCGLenum pname, GCGLuint index)
+{
+    ASSERT(pname == GraphicsContextGL::COLOR_WRITEMASK);
+    GCGLint value[4];
+    m_context->getIntegeri_v(pname, index, value);
+    Vector<bool> vector(4);
+    for (unsigned i = 0; i < 4; ++i)
+        vector[i] = value[i];
+    return vector;
+}
+
 std::optional<Vector<GCGLuint>> WebGL2RenderingContext::getUniformIndices(WebGLProgram& program, const Vector<String>& names)
 {
     if (!validateWebGLProgramOrShader("getUniformIndices", &program))
@@ -2720,6 +2744,7 @@
     ENABLE_IF_REQUESTED(EXTTextureFilterAnisotropic, m_extTextureFilterAnisotropic, "EXT_texture_filter_anisotropic"_s, EXTTextureFilterAnisotropic::supported(*m_context));
     ENABLE_IF_REQUESTED(EXTTextureNorm16, m_extTextureNorm16, "EXT_texture_norm16"_s, EXTTextureNorm16::supported(*m_context));
     ENABLE_IF_REQUESTED(KHRParallelShaderCompile, m_khrParallelShaderCompile, "KHR_parallel_shader_compile"_s, KHRParallelShaderCompile::supported(*m_context));
+    ENABLE_IF_REQUESTED(OESDrawBuffersIndexed, m_oesDrawBuffersIndexed, "OES_draw_buffers_indexed"_s, OESDrawBuffersIndexed::supported(*m_context));
     ENABLE_IF_REQUESTED(OESTextureFloatLinear, m_oesTextureFloatLinear, "OES_texture_float_linear"_s, OESTextureFloatLinear::supported(*m_context));
     ENABLE_IF_REQUESTED(WebGLCompressedTextureASTC, m_webglCompressedTextureASTC, "WEBGL_compressed_texture_astc"_s, WebGLCompressedTextureASTC::supported(*m_context));
     ENABLE_IF_REQUESTED(WebGLCompressedTextureATC, m_webglCompressedTextureATC, "WEBKIT_WEBGL_compressed_texture_atc"_s, WebGLCompressedTextureATC::supported(*m_context));
@@ -2758,6 +2783,7 @@
     APPEND_IF_SUPPORTED("EXT_texture_filter_anisotropic", EXTTextureFilterAnisotropic::supported(*m_context))
     APPEND_IF_SUPPORTED("EXT_texture_norm16", EXTTextureNorm16::supported(*m_context))
     APPEND_IF_SUPPORTED("KHR_parallel_shader_compile", KHRParallelShaderCompile::supported(*m_context))
+    APPEND_IF_SUPPORTED("OES_draw_buffers_indexed", OESDrawBuffersIndexed::supported(*m_context))
     APPEND_IF_SUPPORTED("OES_texture_float_linear", OESTextureFloatLinear::supported(*m_context))
     APPEND_IF_SUPPORTED("WEBGL_compressed_texture_astc", WebGLCompressedTextureASTC::supported(*m_context))
     APPEND_IF_SUPPORTED("WEBKIT_WEBGL_compressed_texture_atc", WebGLCompressedTextureATC::supported(*m_context))

Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h (295278 => 295279)


--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h	2022-06-06 08:43:37 UTC (rev 295279)
@@ -281,6 +281,7 @@
     RefPtr<ArrayBufferView> sliceArrayBufferView(const char* const functionName, const ArrayBufferView& data, GCGLuint srcOffset, GCGLuint length);
 
     long long getInt64Parameter(GCGLenum);
+    Vector<bool> getIndexedBooleanArrayParameter(GCGLenum pname, GCGLuint index);
 
     void initializeVertexArrayObjects() final;
     bool validateBufferTarget(const char* functionName, GCGLenum target) final;

Modified: trunk/Source/WebCore/html/canvas/WebGLExtension.h (295278 => 295279)


--- trunk/Source/WebCore/html/canvas/WebGLExtension.h	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/html/canvas/WebGLExtension.h	2022-06-06 08:43:37 UTC (rev 295279)
@@ -50,6 +50,7 @@
         EXTTextureNorm16Name,
         EXTsRGBName,
         KHRParallelShaderCompileName,
+        OESDrawBuffersIndexedName,
         OESElementIndexUintName,
         OESFBORenderMipmapName,
         OESStandardDerivativesName,

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (295278 => 295279)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2022-06-06 08:43:37 UTC (rev 295279)
@@ -67,6 +67,7 @@
 #include "Logging.h"
 #include "NavigatorWebXR.h"
 #include "NotImplemented.h"
+#include "OESDrawBuffersIndexed.h"
 #include "OESElementIndexUint.h"
 #include "OESFBORenderMipmap.h"
 #include "OESStandardDerivatives.h"
@@ -4013,6 +4014,7 @@
     CHECK_EXTENSION(m_extTextureNorm16, "EXT_texture_norm16");
     CHECK_EXTENSION(m_extsRGB, "EXT_sRGB");
     CHECK_EXTENSION(m_khrParallelShaderCompile, "KHR_parallel_shader_compile");
+    CHECK_EXTENSION(m_oesDrawBuffersIndexed, "OES_draw_buffers_indexed");
     CHECK_EXTENSION(m_oesElementIndexUint, "OES_element_index_uint");
     CHECK_EXTENSION(m_oesFBORenderMipmap, "OES_fbo_render_mipmap");
     CHECK_EXTENSION(m_oesStandardDerivatives, "OES_standard_derivatives");
@@ -8120,6 +8122,7 @@
     LOSE_EXTENSION(m_extTextureNorm16);
     LOSE_EXTENSION(m_extsRGB);
     LOSE_EXTENSION(m_khrParallelShaderCompile);
+    LOSE_EXTENSION(m_oesDrawBuffersIndexed);
     LOSE_EXTENSION(m_oesElementIndexUint);
     LOSE_EXTENSION(m_oesFBORenderMipmap);
     LOSE_EXTENSION(m_oesStandardDerivatives);

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (295278 => 295279)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2022-06-06 08:43:37 UTC (rev 295279)
@@ -87,6 +87,7 @@
 class ImageData;
 class IntSize;
 class KHRParallelShaderCompile;
+class OESDrawBuffersIndexed;
 class OESElementIndexUint;
 class OESFBORenderMipmap;
 class OESStandardDerivatives;
@@ -720,6 +721,7 @@
     RefPtr<EXTTextureNorm16> m_extTextureNorm16;
     RefPtr<EXTsRGB> m_extsRGB;
     RefPtr<KHRParallelShaderCompile> m_khrParallelShaderCompile;
+    RefPtr<OESDrawBuffersIndexed> m_oesDrawBuffersIndexed;
     RefPtr<OESElementIndexUint> m_oesElementIndexUint;
     RefPtr<OESFBORenderMipmap> m_oesFBORenderMipmap;
     RefPtr<OESStandardDerivatives> m_oesStandardDerivatives;

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (295278 => 295279)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h	2022-06-06 08:43:37 UTC (rev 295279)
@@ -1136,6 +1136,7 @@
     virtual String getString(GCGLenum name) = 0;
     virtual void getFloatv(GCGLenum pname, GCGLSpan<GCGLfloat> value) = 0;
     virtual void getIntegerv(GCGLenum pname, GCGLSpan<GCGLint> value) = 0;
+    virtual void getIntegeri_v(GCGLenum pname, GCGLuint index, GCGLSpan<GCGLint, 4> value) = 0; // NOLINT
     virtual GCGLint64 getInteger64(GCGLenum pname) = 0;
     virtual GCGLint64 getInteger64i(GCGLenum pname, GCGLuint index) = 0;
     virtual GCGLint getProgrami(PlatformGLObject program, GCGLenum pname) = 0;
@@ -1397,10 +1398,20 @@
     // GL_ARB_draw_buffers / GL_EXT_draw_buffers
     virtual void drawBuffersEXT(GCGLSpan<const GCGLenum> bufs) = 0;
 
+    // GL_OES_draw_buffers_indexed
+    virtual void enableiOES(GCGLenum target, GCGLuint index) = 0;
+    virtual void disableiOES(GCGLenum target, GCGLuint index) = 0;
+    virtual void blendEquationiOES(GCGLuint buf, GCGLenum mode) = 0;
+    virtual void blendEquationSeparateiOES(GCGLuint buf, GCGLenum modeRGB, GCGLenum modeAlpha) = 0;
+    virtual void blendFunciOES(GCGLuint buf, GCGLenum src, GCGLenum dst) = 0;
+    virtual void blendFuncSeparateiOES(GCGLuint buf, GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha) = 0;
+    virtual void colorMaskiOES(GCGLuint buf, GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha) = 0;
+
     // ========== Other functions.
     GCGLfloat getFloat(GCGLenum pname);
     GCGLboolean getBoolean(GCGLenum pname);
     GCGLint getInteger(GCGLenum pname);
+    GCGLint getIntegeri(GCGLenum pname, GCGLuint index);
     GCGLint getActiveUniformBlocki(GCGLuint program, GCGLuint uniformBlockIndex, GCGLenum pname);
     GCGLint getInternalformati(GCGLenum target, GCGLenum internalformat, GCGLenum pname);
 
@@ -1551,6 +1562,13 @@
     return value[0];
 }
 
+inline GCGLint GraphicsContextGL::getIntegeri(GCGLenum pname, GCGLuint index)
+{
+    GCGLint value[4] { };
+    getIntegeri_v(pname, index, value);
+    return value[0];
+}
+
 inline GCGLint GraphicsContextGL::getActiveUniformBlocki(GCGLuint program, GCGLuint uniformBlockIndex, GCGLenum pname)
 {
     GCGLint value[1] { };

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


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2022-06-06 08:43:37 UTC (rev 295279)
@@ -374,6 +374,13 @@
     GL_GetIntegervRobustANGLE(pname, value.bufSize, nullptr, value.data);
 }
 
+void GraphicsContextGLANGLE::getIntegeri_v(GCGLenum pname, GCGLuint index, GCGLSpan<GCGLint, 4> value) // NOLINT
+{
+    if (!makeContextCurrent())
+        return;
+    GL_GetIntegeri_vRobustANGLE(pname, index, value.bufSize, nullptr, value.data);
+}
+
 void GraphicsContextGLANGLE::getShaderPrecisionFormat(GCGLenum shaderType, GCGLenum precisionType, GCGLSpan<GCGLint, 2> range, GCGLint* precision)
 {
     if (!makeContextCurrent())
@@ -2928,6 +2935,62 @@
     GL_DrawBuffersEXT(bufs.bufSize, bufs.data);
 }
 
+void GraphicsContextGLANGLE::enableiOES(GCGLenum target, GCGLuint index)
+{
+    if (!makeContextCurrent())
+        return;
+
+    GL_EnableiOES(target, index);
+}
+
+void GraphicsContextGLANGLE::disableiOES(GCGLenum target, GCGLuint index)
+{
+    if (!makeContextCurrent())
+        return;
+
+    GL_DisableiOES(target, index);
+}
+
+void GraphicsContextGLANGLE::blendEquationiOES(GCGLuint buf, GCGLenum mode)
+{
+    if (!makeContextCurrent())
+        return;
+
+    GL_BlendEquationiOES(buf, mode);
+}
+
+void GraphicsContextGLANGLE::blendEquationSeparateiOES(GCGLuint buf, GCGLenum modeRGB, GCGLenum modeAlpha)
+{
+    if (!makeContextCurrent())
+        return;
+
+    GL_BlendEquationSeparateiOES(buf, modeRGB, modeAlpha);
+}
+
+void GraphicsContextGLANGLE::blendFunciOES(GCGLuint buf, GCGLenum src, GCGLenum dst)
+{
+    if (!makeContextCurrent())
+        return;
+
+    GL_BlendFunciOES(buf, src, dst);
+}
+
+void GraphicsContextGLANGLE::blendFuncSeparateiOES(GCGLuint buf, GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha)
+{
+    if (!makeContextCurrent())
+        return;
+
+    GL_BlendFuncSeparateiOES(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
+}
+
+void GraphicsContextGLANGLE::colorMaskiOES(GCGLuint buf, GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha)
+{
+    if (!makeContextCurrent())
+        return;
+
+    GL_ColorMaskiOES(buf, red, green, blue, alpha);
+}
+
 bool GraphicsContextGLANGLE::waitAndUpdateOldestFrame()
 {
     size_t oldestFrameCompletionFence = m_oldestFrameCompletionFence++ % maxPendingFrames;

Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h (295278 => 295279)


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2022-06-06 08:43:37 UTC (rev 295279)
@@ -126,6 +126,7 @@
     void getFloatv(GCGLenum pname, GCGLSpan<GCGLfloat> value) final;
     GCGLint getFramebufferAttachmentParameteri(GCGLenum target, GCGLenum attachment, GCGLenum pname) final;
     void getIntegerv(GCGLenum pname, GCGLSpan<GCGLint> value) final;
+    void getIntegeri_v(GCGLenum pname, GCGLuint index, GCGLSpan<GCGLint, 4> value) final; // NOLINT
     GCGLint64 getInteger64(GCGLenum pname) final;
     GCGLint64 getInteger64i(GCGLenum pname, GCGLuint index) final;
     GCGLint getProgrami(PlatformGLObject program, GCGLenum pname) final;
@@ -311,6 +312,13 @@
     bool isExtensionEnabled(const String&) override;
     void drawBuffersEXT(GCGLSpan<const GCGLenum>) override;
     String getTranslatedShaderSourceANGLE(PlatformGLObject) override;
+    void enableiOES(GCGLenum target, GCGLuint index) final;
+    void disableiOES(GCGLenum target, GCGLuint index) final;
+    void blendEquationiOES(GCGLuint buf, GCGLenum mode) final;
+    void blendEquationSeparateiOES(GCGLuint buf, GCGLenum modeRGB, GCGLenum modeAlpha) final;
+    void blendFunciOES(GCGLuint buf, GCGLenum src, GCGLenum dst) final;
+    void blendFuncSeparateiOES(GCGLuint buf, GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha) final;
+    void colorMaskiOES(GCGLuint buf, GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha) final;
 
     PlatformGLObject createBuffer() final;
     PlatformGLObject createFramebuffer() final;

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp (295278 => 295279)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp	2022-06-06 08:43:37 UTC (rev 295279)
@@ -1872,6 +1872,18 @@
     ::glGetFloatv(pname, value.data);
 }
 
+void GraphicsContextGLOpenGL::getIntegeri_v(GCGLenum pname, GCGLuint index, GCGLSpan<GCGLint, 4> value) // NOLINT
+{
+    UNUSED_PARAM(pname);
+    UNUSED_PARAM(index);
+    UNUSED_PARAM(value);
+    if (!makeContextCurrent())
+        return;
+
+    // FIXME 141178: Before enabling this we must first switch over to using gl3.h and creating and initialing the WebGL2 context using OpenGL ES 3.0.
+    // ::glGetIntegeri_v(pname, index, value.data);
+}
+
 GCGLint64 GraphicsContextGLOpenGL::getInteger64(GCGLenum pname)
 {
     UNUSED_PARAM(pname);
@@ -3081,6 +3093,34 @@
     return getExtensions().getTranslatedShaderSourceANGLE(shader);
 }
 
+void GraphicsContextGLOpenGL::enableiOES(GCGLenum, GCGLuint)
+{
+}
+
+void GraphicsContextGLOpenGL::disableiOES(GCGLenum, GCGLuint)
+{
+}
+
+void GraphicsContextGLOpenGL::blendEquationiOES(GCGLuint, GCGLenum)
+{
+}
+
+void GraphicsContextGLOpenGL::blendEquationSeparateiOES(GCGLuint, GCGLenum, GCGLenum)
+{
+}
+
+void GraphicsContextGLOpenGL::blendFunciOES(GCGLuint, GCGLenum, GCGLenum)
+{
+}
+
+void GraphicsContextGLOpenGL::blendFuncSeparateiOES(GCGLuint, GCGLenum, GCGLenum, GCGLenum, GCGLenum)
+{
+}
+
+void GraphicsContextGLOpenGL::colorMaskiOES(GCGLuint, GCGLboolean, GCGLboolean, GCGLboolean, GCGLboolean)
+{
+}
+
 bool GraphicsContextGLOpenGL::texImage2DResourceSafe(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, GCGLint unpackAlignment)
 {
     ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (295278 => 295279)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2022-06-06 08:43:37 UTC (rev 295279)
@@ -142,6 +142,7 @@
     void getFloatv(GCGLenum pname, GCGLSpan<GCGLfloat> value) final;
     GCGLint getFramebufferAttachmentParameteri(GCGLenum target, GCGLenum attachment, GCGLenum pname) final;
     void getIntegerv(GCGLenum pname, GCGLSpan<GCGLint> value) final;
+    void getIntegeri_v(GCGLenum pname, GCGLuint index, GCGLSpan<GCGLint, 4> value) final; // NOLINT
     GCGLint64 getInteger64(GCGLenum pname) final;
     GCGLint64 getInteger64i(GCGLenum pname, GCGLuint index) final;
     GCGLint getProgrami(PlatformGLObject program, GCGLenum pname) final;
@@ -369,6 +370,15 @@
     void multiDrawElementsANGLE(GCGLenum mode, GCGLSpanTuple<const GCGLsizei, const GCGLint> countsAndOffsets, GCGLenum type) override;
     void multiDrawElementsInstancedANGLE(GCGLenum mode, GCGLSpanTuple<const GCGLsizei, const GCGLint, const GCGLsizei> countsOffsetsAndInstanceCounts, GCGLenum type) override;
 
+    // GL_OES_draw_buffers_indexed
+    void enableiOES(GCGLenum target, GCGLuint index) final;
+    void disableiOES(GCGLenum target, GCGLuint index) final;
+    void blendEquationiOES(GCGLuint buf, GCGLenum mode) final;
+    void blendEquationSeparateiOES(GCGLuint buf, GCGLenum modeRGB, GCGLenum modeAlpha) final;
+    void blendFunciOES(GCGLuint buf, GCGLenum src, GCGLenum dst) final;
+    void blendFuncSeparateiOES(GCGLuint buf, GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha) final;
+    void colorMaskiOES(GCGLuint buf, GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha) final;
+
     bool supportsExtension(const String&) final;
     void ensureExtensionEnabled(const String&) final;
     bool isExtensionEnabled(const String&) final;

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in (295278 => 295279)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in	2022-06-06 08:43:37 UTC (rev 295279)
@@ -116,6 +116,7 @@
     void GetString(uint32_t name) -> (String returnValue) Synchronous
     void GetFloatv(uint32_t pname, uint64_t valueSize) -> (IPC::ArrayReference<float> value) Synchronous
     void GetIntegerv(uint32_t pname, uint64_t valueSize) -> (IPC::ArrayReference<int32_t> value) Synchronous
+    void GetIntegeri_v(uint32_t pname, uint32_t index) -> (IPC::ArrayReference<int32_t, 4> value) Synchronous
     void GetInteger64(uint32_t pname) -> (int64_t returnValue) Synchronous
     void GetInteger64i(uint32_t pname, uint32_t index) -> (int64_t returnValue) Synchronous
     void GetProgrami(uint32_t program, uint32_t pname) -> (int32_t returnValue) Synchronous
@@ -293,6 +294,13 @@
     void GetActiveUniformBlockiv(uint32_t program, uint32_t uniformBlockIndex, uint32_t pname, uint64_t paramsSize) -> (IPC::ArrayReference<int32_t> params) Synchronous
     void GetTranslatedShaderSourceANGLE(uint32_t arg0) -> (String returnValue) Synchronous
     void DrawBuffersEXT(IPC::ArrayReference<uint32_t> bufs)
+    void EnableiOES(uint32_t target, uint32_t index)
+    void DisableiOES(uint32_t target, uint32_t index)
+    void BlendEquationiOES(uint32_t buf, uint32_t mode)
+    void BlendEquationSeparateiOES(uint32_t buf, uint32_t modeRGB, uint32_t modeAlpha)
+    void BlendFunciOES(uint32_t buf, uint32_t src, uint32_t dst)
+    void BlendFuncSeparateiOES(uint32_t buf, uint32_t srcRGB, uint32_t dstRGB, uint32_t srcAlpha, uint32_t dstAlpha)
+    void ColorMaskiOES(uint32_t buf, bool red, bool green, bool blue, bool alpha)
     void GetInternalformativ(uint32_t target, uint32_t internalformat, uint32_t pname, uint64_t paramsSize) -> (IPC::ArrayReference<int32_t> params) Synchronous
     void PaintRenderingResultsToPixelBuffer() -> (std::optional<IPC::PixelBufferReference> returnValue) Synchronous
 }

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h (295278 => 295279)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h	2022-06-06 08:43:37 UTC (rev 295279)
@@ -347,6 +347,13 @@
         m_context->getIntegerv(pname, value);
         completionHandler(IPC::ArrayReference<int32_t>(reinterpret_cast<int32_t*>(value.data()), value.size()));
     }
+    void getIntegeri_v(uint32_t pname, uint32_t index, CompletionHandler<void(IPC::ArrayReference<int32_t, 4>)>&& completionHandler) // NOLINT
+    {
+        std::array<GCGLint, 4> value { };
+        assertIsCurrent(workQueue());
+        m_context->getIntegeri_v(pname, index, value);
+        completionHandler(IPC::ArrayReference<int32_t, 4>(reinterpret_cast<int32_t*>(value.data()), value.size()));
+    }
     void getInteger64(uint32_t pname, CompletionHandler<void(int64_t)>&& completionHandler)
     {
         GCGLint64 returnValue = { };
@@ -1333,6 +1340,41 @@
         assertIsCurrent(workQueue());
         m_context->drawBuffersEXT(makeGCGLSpan(reinterpret_cast<const GCGLenum*>(bufs.data()), bufs.size()));
     }
+    void enableiOES(uint32_t target, uint32_t index)
+    {
+        assertIsCurrent(workQueue());
+        m_context->enableiOES(target, index);
+    }
+    void disableiOES(uint32_t target, uint32_t index)
+    {
+        assertIsCurrent(workQueue());
+        m_context->disableiOES(target, index);
+    }
+    void blendEquationiOES(uint32_t buf, uint32_t mode)
+    {
+        assertIsCurrent(workQueue());
+        m_context->blendEquationiOES(buf, mode);
+    }
+    void blendEquationSeparateiOES(uint32_t buf, uint32_t modeRGB, uint32_t modeAlpha)
+    {
+        assertIsCurrent(workQueue());
+        m_context->blendEquationSeparateiOES(buf, modeRGB, modeAlpha);
+    }
+    void blendFunciOES(uint32_t buf, uint32_t src, uint32_t dst)
+    {
+        assertIsCurrent(workQueue());
+        m_context->blendFunciOES(buf, src, dst);
+    }
+    void blendFuncSeparateiOES(uint32_t buf, uint32_t srcRGB, uint32_t dstRGB, uint32_t srcAlpha, uint32_t dstAlpha)
+    {
+        assertIsCurrent(workQueue());
+        m_context->blendFuncSeparateiOES(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
+    }
+    void colorMaskiOES(uint32_t buf, bool red, bool green, bool blue, bool alpha)
+    {
+        assertIsCurrent(workQueue());
+        m_context->colorMaskiOES(buf, static_cast<GCGLboolean>(red), static_cast<GCGLboolean>(green), static_cast<GCGLboolean>(blue), static_cast<GCGLboolean>(alpha));
+    }
     void getInternalformativ(uint32_t target, uint32_t internalformat, uint32_t pname, uint64_t paramsSize, CompletionHandler<void(IPC::ArrayReference<int32_t>)>&& completionHandler)
     {
         Vector<GCGLint, 4> params(static_cast<size_t>(paramsSize), 0);

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h (295278 => 295279)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h	2022-06-06 08:43:37 UTC (rev 295279)
@@ -143,6 +143,7 @@
     String getString(GCGLenum name) final;
     void getFloatv(GCGLenum pname, GCGLSpan<GCGLfloat> value) final;
     void getIntegerv(GCGLenum pname, GCGLSpan<GCGLint> value) final;
+    void getIntegeri_v(GCGLenum pname, GCGLuint index, GCGLSpan<GCGLint, 4> value) final; // NOLINT
     GCGLint64 getInteger64(GCGLenum pname) final;
     GCGLint64 getInteger64i(GCGLenum pname, GCGLuint index) final;
     GCGLint getProgrami(PlatformGLObject program, GCGLenum pname) final;
@@ -320,6 +321,13 @@
     void getActiveUniformBlockiv(GCGLuint program, GCGLuint uniformBlockIndex, GCGLenum pname, GCGLSpan<GCGLint> params) final;
     String getTranslatedShaderSourceANGLE(PlatformGLObject arg0) final;
     void drawBuffersEXT(GCGLSpan<const GCGLenum> bufs) final;
+    void enableiOES(GCGLenum target, GCGLuint index) final;
+    void disableiOES(GCGLenum target, GCGLuint index) final;
+    void blendEquationiOES(GCGLuint buf, GCGLenum mode) final;
+    void blendEquationSeparateiOES(GCGLuint buf, GCGLenum modeRGB, GCGLenum modeAlpha) final;
+    void blendFunciOES(GCGLuint buf, GCGLenum src, GCGLenum dst) final;
+    void blendFuncSeparateiOES(GCGLuint buf, GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha) final;
+    void colorMaskiOES(GCGLuint buf, GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha) final;
     void getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLSpan<GCGLint> params) final;
     RefPtr<WebCore::PixelBuffer> paintRenderingResultsToPixelBuffer() final;
     // End of list used by generate-gpup-webgl script.

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp (295278 => 295279)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp	2022-06-06 06:19:26 UTC (rev 295278)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp	2022-06-06 08:43:37 UTC (rev 295279)
@@ -584,6 +584,19 @@
     }
 }
 
+void RemoteGraphicsContextGLProxy::getIntegeri_v(GCGLenum pname, GCGLuint index, GCGLSpan<GCGLint, 4> value) // NOLINT
+{
+    constexpr std::array<int32_t, 4> valueReplyEmpty { };
+    IPC::ArrayReference<int32_t, 4> valueReply { valueReplyEmpty };
+    if (!isContextLost()) {
+        auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::GetIntegeri_v(pname, index), Messages::RemoteGraphicsContextGL::GetIntegeri_v::Reply(valueReply));
+        if (!sendResult)
+            markContextLost();
+        else
+            memcpy(value.data, valueReply.data(), value.bufSize * sizeof(int32_t));
+    }
+}
+
 GCGLint64 RemoteGraphicsContextGLProxy::getInteger64(GCGLenum pname)
 {
     int64_t returnValue = { };
@@ -2287,6 +2300,69 @@
     }
 }
 
+void RemoteGraphicsContextGLProxy::enableiOES(GCGLenum target, GCGLuint index)
+{
+    if (!isContextLost()) {
+        auto sendResult = send(Messages::RemoteGraphicsContextGL::EnableiOES(target, index));
+        if (!sendResult)
+            markContextLost();
+    }
+}
+
+void RemoteGraphicsContextGLProxy::disableiOES(GCGLenum target, GCGLuint index)
+{
+    if (!isContextLost()) {
+        auto sendResult = send(Messages::RemoteGraphicsContextGL::DisableiOES(target, index));
+        if (!sendResult)
+            markContextLost();
+    }
+}
+
+void RemoteGraphicsContextGLProxy::blendEquationiOES(GCGLuint buf, GCGLenum mode)
+{
+    if (!isContextLost()) {
+        auto sendResult = send(Messages::RemoteGraphicsContextGL::BlendEquationiOES(buf, mode));
+        if (!sendResult)
+            markContextLost();
+    }
+}
+
+void RemoteGraphicsContextGLProxy::blendEquationSeparateiOES(GCGLuint buf, GCGLenum modeRGB, GCGLenum modeAlpha)
+{
+    if (!isContextLost()) {
+        auto sendResult = send(Messages::RemoteGraphicsContextGL::BlendEquationSeparateiOES(buf, modeRGB, modeAlpha));
+        if (!sendResult)
+            markContextLost();
+    }
+}
+
+void RemoteGraphicsContextGLProxy::blendFunciOES(GCGLuint buf, GCGLenum src, GCGLenum dst)
+{
+    if (!isContextLost()) {
+        auto sendResult = send(Messages::RemoteGraphicsContextGL::BlendFunciOES(buf, src, dst));
+        if (!sendResult)
+            markContextLost();
+    }
+}
+
+void RemoteGraphicsContextGLProxy::blendFuncSeparateiOES(GCGLuint buf, GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha)
+{
+    if (!isContextLost()) {
+        auto sendResult = send(Messages::RemoteGraphicsContextGL::BlendFuncSeparateiOES(buf, srcRGB, dstRGB, srcAlpha, dstAlpha));
+        if (!sendResult)
+            markContextLost();
+    }
+}
+
+void RemoteGraphicsContextGLProxy::colorMaskiOES(GCGLuint buf, GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha)
+{
+    if (!isContextLost()) {
+        auto sendResult = send(Messages::RemoteGraphicsContextGL::ColorMaskiOES(buf, static_cast<bool>(red), static_cast<bool>(green), static_cast<bool>(blue), static_cast<bool>(alpha)));
+        if (!sendResult)
+            markContextLost();
+    }
+}
+
 void RemoteGraphicsContextGLProxy::getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLSpan<GCGLint> params)
 {
     IPC::ArrayReference<int32_t> paramsReply;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to