Title: [267613] trunk
Revision
267613
Author
[email protected]
Date
2020-09-25 17:41:37 -0700 (Fri, 25 Sep 2020)

Log Message

Support OES_fbo_render_mipmap
https://bugs.webkit.org/show_bug.cgi?id=217003

Reviewed by Kenneth Russell.

Source/WebCore:

Test: webgl/conformance/extensions/oes-fbo-render-mipmap.html

* CMakeLists.txt:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMConvertWebGL.cpp:
(WebCore::convertToJSValue):
* html/canvas/OESFBORenderMipmap.cpp: Added.
(WebCore::OESFBORenderMipmap::OESFBORenderMipmap):
(WebCore::OESFBORenderMipmap::getName const):
(WebCore::OESFBORenderMipmap::supported):
* html/canvas/OESFBORenderMipmap.h: Added.
* html/canvas/OESFBORenderMipmap.idl: Added.
* html/canvas/WebGLExtension.h:
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getExtension):
(WebCore::WebGLRenderingContext::getSupportedExtensions):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::framebufferTexture2D):
(WebCore::WebGLRenderingContextBase::extensionIsEnabled):
(WebCore::WebGLRenderingContextBase::loseExtensions):
* html/canvas/WebGLRenderingContextBase.h:

LayoutTests:

* webgl/conformance/extensions/oes-fbo-render-mipmap-expected.txt: Added.
* webgl/conformance/extensions/oes-fbo-render-mipmap.html: Added.
* webgl/resources/webgl_test_files/conformance/extensions/oes-fbo-render-mipmap.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (267612 => 267613)


--- trunk/LayoutTests/ChangeLog	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/LayoutTests/ChangeLog	2020-09-26 00:41:37 UTC (rev 267613)
@@ -1,3 +1,14 @@
+2020-09-25  James Darpinian  <[email protected]>
+
+        Support OES_fbo_render_mipmap
+        https://bugs.webkit.org/show_bug.cgi?id=217003
+
+        Reviewed by Kenneth Russell.
+
+        * webgl/conformance/extensions/oes-fbo-render-mipmap-expected.txt: Added.
+        * webgl/conformance/extensions/oes-fbo-render-mipmap.html: Added.
+        * webgl/resources/webgl_test_files/conformance/extensions/oes-fbo-render-mipmap.html: Added.
+
 2020-09-25  Karl Rackler  <[email protected]>
 
         REGRESSION (r266932): [ Catalina wk2 ] fast/scrolling/latching/latched-scroll-into-nonfast-region.html is a flaky failure

Added: trunk/LayoutTests/webgl/conformance/extensions/oes-fbo-render-mipmap-expected.txt (0 => 267613)


--- trunk/LayoutTests/webgl/conformance/extensions/oes-fbo-render-mipmap-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgl/conformance/extensions/oes-fbo-render-mipmap-expected.txt	2020-09-26 00:41:37 UTC (rev 267613)
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/extensions/oes-fbo-render-mipmap.html
+PASS
+

Added: trunk/LayoutTests/webgl/conformance/extensions/oes-fbo-render-mipmap.html (0 => 267613)


--- trunk/LayoutTests/webgl/conformance/extensions/oes-fbo-render-mipmap.html	                        (rev 0)
+++ trunk/LayoutTests/webgl/conformance/extensions/oes-fbo-render-mipmap.html	2020-09-26 00:41:37 UTC (rev 267613)
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for oes-fbo-render-mipmap.html</title>
+<script type="text/_javascript_" src=""
+<script type="text/_javascript_" src=""
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href=""
+<div id="result"></div>
+<div id="iframe">
+<iframe src="" width="800" height="600"></iframe>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/webgl/resources/webgl_test_files/conformance/extensions/oes-fbo-render-mipmap.html (0 => 267613)


--- trunk/LayoutTests/webgl/resources/webgl_test_files/conformance/extensions/oes-fbo-render-mipmap.html	                        (rev 0)
+++ trunk/LayoutTests/webgl/resources/webgl_test_files/conformance/extensions/oes-fbo-render-mipmap.html	2020-09-26 00:41:37 UTC (rev 267613)
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL OES_fbo_render_mipmap Conformance Tests</title>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+</head>
+<body>
+<canvas id="canvas" width="128" height="128"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description("This test verifies the functionality of the OES_fbo_render_mipmap extension, if it is available.");
+
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById("canvas");
+var gl = wtu.create3DContext(canvas);
+var ext = null;
+
+(function(){
+
+    const oesFboRenderMipmap = gl.getExtension("OES_fbo_render_mipmap");
+    if (!oesFboRenderMipmap) {
+        testPassed("OES_fbo_render_mipmap is allowed to be missing.");
+        return;
+    }
+
+    let texture = gl.createTexture();
+    gl.bindTexture(gl.TEXTURE_2D, texture);
+    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
+    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_NEAREST);
+
+    let colors = [
+        [255, 0, 0, 255],
+        [255, 127, 0, 255],
+        [255, 255, 0, 255],
+        [0, 255, 0, 255],
+        [0, 255, 255, 255],
+        [0, 127, 255, 255],
+        [0, 0, 255, 255],
+        [255, 0, 255, 255],
+    ];
+
+    let fbos = [];
+    let maxLevel = 7;
+    for (let level = 0; level <= maxLevel; level++) {
+        let size = Math.pow(2, maxLevel - level);
+        gl.texImage2D(gl.TEXTURE_2D, level, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
+        let fbo = gl.createFramebuffer();
+        gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
+        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, level);
+        fbos.push(fbo);
+
+        wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Any level of a texture can be attached to a framebuffer object.");
+    }
+
+    for (let level = 0; level <= maxLevel; level++) {
+        gl.bindFramebuffer(gl.FRAMEBUFFER, fbos[level]);
+        shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_COMPLETE");
+        gl.clearColor(colors[level][0] / 255, colors[level][1] / 255, colors[level][2] / 255, colors[level][3] / 255);
+        gl.clear(gl.COLOR_BUFFER_BIT);
+    }
+
+    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+
+    let program = wtu.setupTexturedQuad(gl);
+
+    for (let level = 0; level <= maxLevel; level++) {
+        let size = Math.pow(2, maxLevel - level);
+        // We use differrent viewport sizes to affect which miplevel is fetched from the texture.
+        gl.viewport(0, 0, size, size);
+        gl.drawArrays(gl.TRIANGLES, 0, 6);
+        wtu.checkCanvasRect(gl, 0, 0, 1, 1, colors[level]);
+    }
+
+})();
+
+debug("");
+var successfullyParsed = true;
+</script>
+<script src=""
+
+</body>
+</html>
+<!--
+Copyright (c) 2019 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->

Modified: trunk/Source/WebCore/CMakeLists.txt (267612 => 267613)


--- trunk/Source/WebCore/CMakeLists.txt	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-09-26 00:41:37 UTC (rev 267613)
@@ -1454,6 +1454,7 @@
         html/canvas/EXTTextureFilterAnisotropic.cpp
         html/canvas/EXTsRGB.cpp
         html/canvas/OESElementIndexUint.cpp
+        html/canvas/OESFBORenderMipmap.cpp
         html/canvas/OESStandardDerivatives.cpp
         html/canvas/OESTextureFloat.cpp
         html/canvas/OESTextureFloatLinear.cpp
@@ -1511,6 +1512,7 @@
     html/canvas/EXTTextureFilterAnisotropic.idl
     html/canvas/EXTsRGB.idl
     html/canvas/OESElementIndexUint.idl
+    html/canvas/OESFBORenderMipmap.idl
     html/canvas/OESStandardDerivatives.idl
     html/canvas/OESTextureFloat.idl
     html/canvas/OESTextureFloatLinear.idl

Modified: trunk/Source/WebCore/ChangeLog (267612 => 267613)


--- trunk/Source/WebCore/ChangeLog	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/ChangeLog	2020-09-26 00:41:37 UTC (rev 267613)
@@ -1,3 +1,34 @@
+2020-09-25  James Darpinian  <[email protected]>
+
+        Support OES_fbo_render_mipmap
+        https://bugs.webkit.org/show_bug.cgi?id=217003
+
+        Reviewed by Kenneth Russell.
+
+        Test: webgl/conformance/extensions/oes-fbo-render-mipmap.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDOMConvertWebGL.cpp:
+        (WebCore::convertToJSValue):
+        * html/canvas/OESFBORenderMipmap.cpp: Added.
+        (WebCore::OESFBORenderMipmap::OESFBORenderMipmap):
+        (WebCore::OESFBORenderMipmap::getName const):
+        (WebCore::OESFBORenderMipmap::supported):
+        * html/canvas/OESFBORenderMipmap.h: Added.
+        * html/canvas/OESFBORenderMipmap.idl: Added.
+        * html/canvas/WebGLExtension.h:
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::getExtension):
+        (WebCore::WebGLRenderingContext::getSupportedExtensions):
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::framebufferTexture2D):
+        (WebCore::WebGLRenderingContextBase::extensionIsEnabled):
+        (WebCore::WebGLRenderingContextBase::loseExtensions):
+        * html/canvas/WebGLRenderingContextBase.h:
+
 2020-09-25  Tim Horton  <[email protected]>
 
         Crunchyroll playback controls do not work on iPad with trackpad

Modified: trunk/Source/WebCore/DerivedSources.make (267612 => 267613)


--- trunk/Source/WebCore/DerivedSources.make	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/DerivedSources.make	2020-09-26 00:41:37 UTC (rev 267613)
@@ -957,6 +957,7 @@
     $(WebCore)/html/canvas/ImageBitmapRenderingContextSettings.idl \
     $(WebCore)/html/canvas/ImageSmoothingQuality.idl \
     $(WebCore)/html/canvas/OESElementIndexUint.idl \
+    $(WebCore)/html/canvas/OESFBORenderMipmap.idl \
     $(WebCore)/html/canvas/OESStandardDerivatives.idl \
     $(WebCore)/html/canvas/OESTextureFloat.idl \
     $(WebCore)/html/canvas/OESTextureFloatLinear.idl \

Modified: trunk/Source/WebCore/Sources.txt (267612 => 267613)


--- trunk/Source/WebCore/Sources.txt	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/Sources.txt	2020-09-26 00:41:37 UTC (rev 267613)
@@ -1256,6 +1256,7 @@
 html/canvas/GPUBasedCanvasRenderingContext.cpp
 html/canvas/ImageBitmapRenderingContext.cpp
 html/canvas/OESElementIndexUint.cpp
+html/canvas/OESFBORenderMipmap.cpp
 html/canvas/OESStandardDerivatives.cpp
 html/canvas/OESTextureFloat.cpp
 html/canvas/OESTextureFloatLinear.cpp
@@ -3133,6 +3134,7 @@
 JSNotificationPermission.cpp
 JSNotificationPermissionCallback.cpp
 JSOESElementIndexUint.cpp
+JSOESFBORenderMipmap.cpp
 JSOESStandardDerivatives.cpp
 JSOESTextureFloat.cpp
 JSOESTextureFloatLinear.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (267612 => 267613)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-09-26 00:41:37 UTC (rev 267613)
@@ -12077,6 +12077,9 @@
 		A37049D8251D4B8E009BA1B3 /* EXTFloatBlend.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTFloatBlend.idl; sourceTree = "<group>"; };
 		A37049DA251D4B8E009BA1B3 /* EXTFloatBlend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTFloatBlend.h; sourceTree = "<group>"; };
 		A37049DB251D4B8F009BA1B3 /* EXTFloatBlend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTFloatBlend.cpp; sourceTree = "<group>"; };
+		A37A42CE251EB99600F75AFF /* OESFBORenderMipmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OESFBORenderMipmap.cpp; sourceTree = "<group>"; };
+		A37A42D0251EB99600F75AFF /* OESFBORenderMipmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OESFBORenderMipmap.h; sourceTree = "<group>"; };
+		A37A42D1251EB99700F75AFF /* OESFBORenderMipmap.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OESFBORenderMipmap.idl; sourceTree = "<group>"; };
 		A3AF9D81203252EE006CAD06 /* UserAgentCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentCocoa.mm; sourceTree = "<group>"; };
 		A3AF9D8220325324006CAD06 /* UserAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserAgent.h; sourceTree = "<group>"; };
 		A3AF9D8320325691006CAD06 /* UserAgentIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentIOS.mm; sourceTree = "<group>"; };
@@ -19412,6 +19415,9 @@
 				7E5D7A73161D3F8F00896C34 /* OESElementIndexUint.cpp */,
 				7E5D7A74161D3F8F00896C34 /* OESElementIndexUint.h */,
 				E176580C180DF3A0005A96D1 /* OESElementIndexUint.idl */,
+				A37A42CE251EB99600F75AFF /* OESFBORenderMipmap.cpp */,
+				A37A42D0251EB99600F75AFF /* OESFBORenderMipmap.h */,
+				A37A42D1251EB99700F75AFF /* OESFBORenderMipmap.idl */,
 				9001773D12E0347800648462 /* OESStandardDerivatives.cpp */,
 				9001773E12E0347800648462 /* OESStandardDerivatives.h */,
 				9001773F12E0347800648462 /* OESStandardDerivatives.idl */,

Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp (267612 => 267613)


--- trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2020-09-26 00:41:37 UTC (rev 267613)
@@ -39,6 +39,7 @@
 #include "JSEXTTextureFilterAnisotropic.h"
 #include "JSEXTsRGB.h"
 #include "JSOESElementIndexUint.h"
+#include "JSOESFBORenderMipmap.h"
 #include "JSOESStandardDerivatives.h"
 #include "JSOESTextureFloat.h"
 #include "JSOESTextureFloatLinear.h"
@@ -192,6 +193,8 @@
         return toJS(&lexicalGlobalObject, &globalObject, static_cast<OESVertexArrayObject&>(extension));
     case WebGLExtension::OESElementIndexUintName:
         return toJS(&lexicalGlobalObject, &globalObject, static_cast<OESElementIndexUint&>(extension));
+    case WebGLExtension::OESFBORenderMipmapName:
+        return toJS(&lexicalGlobalObject, &globalObject, static_cast<OESFBORenderMipmap&>(extension));
     case WebGLExtension::WebGLDebugRendererInfoName:
         return toJS(&lexicalGlobalObject, &globalObject, static_cast<WebGLDebugRendererInfo&>(extension));
     case WebGLExtension::WebGLDebugShadersName:

Added: trunk/Source/WebCore/html/canvas/OESFBORenderMipmap.cpp (0 => 267613)


--- trunk/Source/WebCore/html/canvas/OESFBORenderMipmap.cpp	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/OESFBORenderMipmap.cpp	2020-09-26 00:41:37 UTC (rev 267613)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 Google Inc. 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 "OESFBORenderMipmap.h"
+
+#include "ExtensionsGL.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(OESFBORenderMipmap);
+
+OESFBORenderMipmap::OESFBORenderMipmap(WebGLRenderingContextBase& context)
+    : WebGLExtension(context)
+{
+    context.graphicsContextGL()->getExtensions().ensureEnabled("GL_OES_fbo_render_mipmap"_s);
+}
+
+OESFBORenderMipmap::~OESFBORenderMipmap() = default;
+
+WebGLExtension::ExtensionName OESFBORenderMipmap::getName() const
+{
+    return OESFBORenderMipmapName;
+}
+
+bool OESFBORenderMipmap::supported(const WebGLRenderingContextBase& context)
+{
+    return context.graphicsContextGL()->getExtensions().supports("GL_OES_fbo_render_mipmap"_s);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGL)

Added: trunk/Source/WebCore/html/canvas/OESFBORenderMipmap.h (0 => 267613)


--- trunk/Source/WebCore/html/canvas/OESFBORenderMipmap.h	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/OESFBORenderMipmap.h	2020-09-26 00:41:37 UTC (rev 267613)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2020 Google Inc. 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 OESFBORenderMipmap final : public WebGLExtension {
+    WTF_MAKE_ISO_ALLOCATED(OESFBORenderMipmap);
+public:
+    OESFBORenderMipmap(WebGLRenderingContextBase&);
+    virtual ~OESFBORenderMipmap();
+
+    ExtensionName getName() const override;
+
+    static bool supported(const WebGLRenderingContextBase&);
+};
+
+} // namespace WebCore

Added: trunk/Source/WebCore/html/canvas/OESFBORenderMipmap.idl (0 => 267613)


--- trunk/Source/WebCore/html/canvas/OESFBORenderMipmap.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/OESFBORenderMipmap.idl	2020-09-26 00:41:37 UTC (rev 267613)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2020 Google Inc. 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 OESFBORenderMipmap {
+};

Modified: trunk/Source/WebCore/html/canvas/WebGLExtension.h (267612 => 267613)


--- trunk/Source/WebCore/html/canvas/WebGLExtension.h	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/html/canvas/WebGLExtension.h	2020-09-26 00:41:37 UTC (rev 267613)
@@ -56,6 +56,7 @@
         WebGLDepthTextureName,
         WebGLDrawBuffersName,
         OESElementIndexUintName,
+        OESFBORenderMipmapName,
         WebGLCompressedTextureATCName,
         WebGLCompressedTextureETCName,
         WebGLCompressedTextureETC1Name,

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (267612 => 267613)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2020-09-26 00:41:37 UTC (rev 267613)
@@ -44,6 +44,7 @@
 #include "ImageData.h"
 #include "InspectorInstrumentation.h"
 #include "OESElementIndexUint.h"
+#include "OESFBORenderMipmap.h"
 #include "OESStandardDerivatives.h"
 #include "OESTextureFloat.h"
 #include "OESTextureFloatLinear.h"
@@ -159,6 +160,7 @@
     ENABLE_IF_REQUESTED(OESTextureHalfFloatLinear, m_oesTextureHalfFloatLinear, "OES_texture_half_float_linear", enableSupportedExtension("GL_OES_texture_half_float_linear"_s));
     ENABLE_IF_REQUESTED(OESVertexArrayObject, m_oesVertexArrayObject, "OES_vertex_array_object", enableSupportedExtension("GL_OES_vertex_array_object"_s));
     ENABLE_IF_REQUESTED(OESElementIndexUint, m_oesElementIndexUint, "OES_element_index_uint", enableSupportedExtension("GL_OES_element_index_uint"_s));
+    ENABLE_IF_REQUESTED(OESFBORenderMipmap, m_oesFBORenderMipmap, "OES_fbo_render_mipmap", enableSupportedExtension("GL_OES_fbo_render_mipmap"_s));
     ENABLE_IF_REQUESTED(WebGLLoseContext, m_webglLoseContext, "WEBGL_lose_context", true);
     ENABLE_IF_REQUESTED(WebGLCompressedTextureASTC, m_webglCompressedTextureASTC, "WEBGL_compressed_texture_astc", WebGLCompressedTextureASTC::supported(*this));
     ENABLE_IF_REQUESTED(WebGLCompressedTextureATC, m_webglCompressedTextureATC, "WEBKIT_WEBGL_compressed_texture_atc", WebGLCompressedTextureATC::supported(*this));
@@ -234,6 +236,8 @@
         result.append("OES_vertex_array_object"_s);
     if (m_context->getExtensions().supports("GL_OES_element_index_uint"_s))
         result.append("OES_element_index_uint"_s);
+    if (m_context->getExtensions().supports("GL_OES_fbo_render_mipmap"_s))
+        result.append("OES_fbo_render_mipmap"_s);
     result.append("WEBGL_lose_context"_s);
     if (WebGLCompressedTextureASTC::supported(*this))
         result.append("WEBGL_compressed_texture_astc"_s);

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (267612 => 267613)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-09-26 00:41:37 UTC (rev 267613)
@@ -62,6 +62,7 @@
 #include "NavigatorWebXR.h"
 #include "NotImplemented.h"
 #include "OESElementIndexUint.h"
+#include "OESFBORenderMipmap.h"
 #include "OESStandardDerivatives.h"
 #include "OESTextureFloat.h"
 #include "OESTextureFloatLinear.h"
@@ -2724,8 +2725,8 @@
 {
     if (isContextLostOrPending() || !validateFramebufferFuncParameters("framebufferTexture2D", target, attachment))
         return;
-    if (level && isWebGL1()) {
-        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "framebufferTexture2D", "level not 0");
+    if (level && isWebGL1() && !m_oesFBORenderMipmap) {
+        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "framebufferTexture2D", "level not 0 and OES_fbo_render_mipmap not enabled");
         return;
     }
     if (texture && !texture->validate(contextGroup(), *this)) {
@@ -3723,6 +3724,7 @@
     CHECK_EXTENSION(m_oesStandardDerivatives, "OES_standard_derivatives");
     CHECK_EXTENSION(m_oesVertexArrayObject, "OES_vertex_array_object");
     CHECK_EXTENSION(m_oesElementIndexUint, "OES_element_index_uint");
+    CHECK_EXTENSION(m_oesFBORenderMipmap, "OES_fbo_render_mipmap");
     CHECK_EXTENSION(m_webglLoseContext, "WEBGL_lose_context");
     CHECK_EXTENSION(m_webglDebugRendererInfo, "WEBGL_debug_renderer_info");
     CHECK_EXTENSION(m_webglDebugShaders, "WEBGL_debug_shaders");
@@ -7791,6 +7793,7 @@
     LOSE_EXTENSION(m_oesStandardDerivatives);
     LOSE_EXTENSION(m_oesVertexArrayObject);
     LOSE_EXTENSION(m_oesElementIndexUint);
+    LOSE_EXTENSION(m_oesFBORenderMipmap);
     LOSE_EXTENSION(m_webglLoseContext);
     LOSE_EXTENSION(m_webglDebugRendererInfo);
     LOSE_EXTENSION(m_webglDebugShaders);

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (267612 => 267613)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2020-09-26 00:27:09 UTC (rev 267612)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2020-09-26 00:41:37 UTC (rev 267613)
@@ -86,6 +86,7 @@
 class OESTextureHalfFloatLinear;
 class OESVertexArrayObject;
 class OESElementIndexUint;
+class OESFBORenderMipmap;
 #if ENABLE(OFFSCREEN_CANVAS)
 class OffscreenCanvas;
 #endif
@@ -677,6 +678,7 @@
     RefPtr<OESStandardDerivatives> m_oesStandardDerivatives;
     RefPtr<OESVertexArrayObject> m_oesVertexArrayObject;
     RefPtr<OESElementIndexUint> m_oesElementIndexUint;
+    RefPtr<OESFBORenderMipmap> m_oesFBORenderMipmap;
     RefPtr<WebGLLoseContext> m_webglLoseContext;
     RefPtr<WebGLDebugRendererInfo> m_webglDebugRendererInfo;
     RefPtr<WebGLDebugShaders> m_webglDebugShaders;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to