haikuwebkit/Source/WebCore/html/canvas/EXTColorBufferHalfFloat.h

44 lines
1.7 KiB
C
Raw Permalink Normal View History

REGRESSION (r256784?): Shadertoy demo no longer works in Safari https://bugs.webkit.org/show_bug.cgi?id=210994 Patch by Kenneth Russell <kbr@chromium.org> on 2020-04-29 Reviewed by Dean Jackson. Source/WebCore: Certain Shadertoy examples stopped working with the ANGLE backend for WebGL because rendering to floating-point render targets was no longer being enabled implicitly along with the OES_texture_float extension. Add support for the WebGL 1.0 extensions EXT_color_buffer_half_float and WEBGL_color_buffer_float, and the WebGL 2.0 extension EXT_color_buffer_float. Enable these implicitly for WebGL 1.0 in the OES_texture_float and OES_texture_half_float extensions, restoring the previous functionality. Translate 32-bit floating point texture formats appropriately for the ANGLE backend. Fix some failures in previously-skipped conformance tests. The new code passes the more stringent top-of-tree WebGL 1.0.4 and 2.0.1 conformance tests related to floating-point texture renderability, which are not yet in the WebKit repository. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMConvertWebGL.cpp: (WebCore::convertToJSValue): * html/canvas/EXTColorBufferFloat.cpp: Copied from Source/WebCore/html/canvas/OESTextureHalfFloat.cpp. (WebCore::EXTColorBufferFloat::EXTColorBufferFloat): (WebCore::EXTColorBufferFloat::getName const): (WebCore::EXTColorBufferFloat::supported): * html/canvas/EXTColorBufferFloat.h: Copied from Source/WebCore/html/canvas/OESTextureFloat.h. * html/canvas/EXTColorBufferFloat.idl: Added. * html/canvas/EXTColorBufferHalfFloat.cpp: Copied from Source/WebCore/html/canvas/OESTextureFloat.cpp. (WebCore::EXTColorBufferHalfFloat::EXTColorBufferHalfFloat): (WebCore::EXTColorBufferHalfFloat::getName const): (WebCore::EXTColorBufferHalfFloat::supported): * html/canvas/EXTColorBufferHalfFloat.h: Copied from Source/WebCore/html/canvas/OESTextureFloat.h. * html/canvas/EXTColorBufferHalfFloat.idl: Added. * html/canvas/OESTextureFloat.cpp: (WebCore::OESTextureFloat::OESTextureFloat): (WebCore::OESTextureFloat::supported): * html/canvas/OESTextureFloat.h: * html/canvas/OESTextureHalfFloat.cpp: (WebCore::OESTextureHalfFloat::OESTextureHalfFloat): (WebCore::OESTextureHalfFloat::supported): * html/canvas/OESTextureHalfFloat.h: * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getExtension): (WebCore::WebGL2RenderingContext::getSupportedExtensions): (WebCore::WebGL2RenderingContext::getParameter): * html/canvas/WebGLColorBufferFloat.cpp: Copied from Source/WebCore/html/canvas/OESTextureFloat.cpp. (WebCore::WebGLColorBufferFloat::WebGLColorBufferFloat): (WebCore::WebGLColorBufferFloat::getName const): (WebCore::WebGLColorBufferFloat::supported): * html/canvas/WebGLColorBufferFloat.h: Copied from Source/WebCore/html/canvas/OESTextureFloat.h. * html/canvas/WebGLColorBufferFloat.idl: Added. * html/canvas/WebGLExtension.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): (WebCore::WebGLRenderingContext::getParameter): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::extensionIsEnabled): (WebCore::WebGLRenderingContextBase::copyTexImage2D): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/angle/ExtensionsGLANGLE.cpp: (WebCore::ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat): (WebCore::ExtensionsGLANGLE::texImage2DRobustANGLE): * platform/graphics/angle/ExtensionsGLANGLE.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::texImage2DDirect): LayoutTests: Update tex-mipmap-levels.html to top-of-tree to fix incorrect test cases. Rebaseline layout tests which are either now all passing, or have progressed. Temporarily skip a couple of tests, previously skipped because of lack of the EXT_color_buffer_float extension, which are failing because of Bug 211156. * TestExpectations: * fast/canvas/webgl/readPixels-float-expected.txt: * webgl/2.0.0/conformance2/textures/misc/copy-texture-image-expected.txt: * webgl/2.0.0/conformance2/textures/misc/tex-mipmap-levels-expected.txt: * webgl/2.0.0/resources/webgl_test_files/conformance2/textures/misc/tex-mipmap-levels.html: Canonical link: https://commits.webkit.org/224098@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-29 19:01:50 +00:00
/*
* 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 EXTColorBufferHalfFloat final : public WebGLExtension {
CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::WebGLRenderingContext::getExtension https://bugs.webkit.org/show_bug.cgi?id=216337 <rdar://problem/68421590> Reviewed by Sam Weinig. Bug 215599 added IsoHeap storage to WebGLExtension, but didn't add it to any of the subclasses. This causes a crash in ::getExtension because allocation of the new instance fails. Add WTF_MAKE_ISO_ALLOCATED_IMPL to the .cpp files, and WTF_MAKE_ISO_ALLOCATED to the .h files. This should have been detected by on-device testing, since a debug build would have asserted because the size passed into the constructor was different from the actual size of the class. * html/canvas/ANGLEInstancedArrays.cpp: * html/canvas/ANGLEInstancedArrays.h: * html/canvas/EXTBlendMinMax.cpp: * html/canvas/EXTBlendMinMax.h: * html/canvas/EXTColorBufferFloat.cpp: * html/canvas/EXTColorBufferFloat.h: * html/canvas/EXTColorBufferHalfFloat.cpp: * html/canvas/EXTColorBufferHalfFloat.h: * html/canvas/EXTFragDepth.cpp: * html/canvas/EXTFragDepth.h: * html/canvas/EXTShaderTextureLOD.cpp: * html/canvas/EXTShaderTextureLOD.h: * html/canvas/EXTTextureFilterAnisotropic.cpp: * html/canvas/EXTTextureFilterAnisotropic.h: * html/canvas/EXTsRGB.cpp: * html/canvas/EXTsRGB.h: * html/canvas/OESElementIndexUint.cpp: * html/canvas/OESElementIndexUint.h: * html/canvas/OESStandardDerivatives.cpp: * html/canvas/OESStandardDerivatives.h: * html/canvas/OESTextureFloat.cpp: * html/canvas/OESTextureFloat.h: * html/canvas/OESTextureFloatLinear.cpp: * html/canvas/OESTextureFloatLinear.h: * html/canvas/OESTextureHalfFloat.cpp: * html/canvas/OESTextureHalfFloat.h: * html/canvas/OESTextureHalfFloatLinear.cpp: * html/canvas/OESTextureHalfFloatLinear.h: * html/canvas/OESVertexArrayObject.cpp: * html/canvas/OESVertexArrayObject.h: * html/canvas/WebGLColorBufferFloat.cpp: * html/canvas/WebGLColorBufferFloat.h: * html/canvas/WebGLCompressedTextureASTC.cpp: * html/canvas/WebGLCompressedTextureASTC.h: * html/canvas/WebGLCompressedTextureATC.cpp: * html/canvas/WebGLCompressedTextureATC.h: * html/canvas/WebGLCompressedTextureETC.cpp: * html/canvas/WebGLCompressedTextureETC.h: * html/canvas/WebGLCompressedTextureETC1.cpp: * html/canvas/WebGLCompressedTextureETC1.h: * html/canvas/WebGLCompressedTexturePVRTC.cpp: * html/canvas/WebGLCompressedTexturePVRTC.h: * html/canvas/WebGLCompressedTextureS3TC.cpp: * html/canvas/WebGLCompressedTextureS3TC.h: * html/canvas/WebGLCompressedTextureS3TCsRGB.cpp: * html/canvas/WebGLCompressedTextureS3TCsRGB.h: * html/canvas/WebGLDebugRendererInfo.cpp: * html/canvas/WebGLDebugRendererInfo.h: * html/canvas/WebGLDebugShaders.cpp: * html/canvas/WebGLDebugShaders.h: * html/canvas/WebGLDepthTexture.cpp: * html/canvas/WebGLDepthTexture.h: * html/canvas/WebGLDrawBuffers.cpp: * html/canvas/WebGLDrawBuffers.h: * html/canvas/WebGLLoseContext.cpp: * html/canvas/WebGLLoseContext.h: Canonical link: https://commits.webkit.org/229169@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 02:47:05 +00:00
WTF_MAKE_ISO_ALLOCATED(EXTColorBufferHalfFloat);
REGRESSION (r256784?): Shadertoy demo no longer works in Safari https://bugs.webkit.org/show_bug.cgi?id=210994 Patch by Kenneth Russell <kbr@chromium.org> on 2020-04-29 Reviewed by Dean Jackson. Source/WebCore: Certain Shadertoy examples stopped working with the ANGLE backend for WebGL because rendering to floating-point render targets was no longer being enabled implicitly along with the OES_texture_float extension. Add support for the WebGL 1.0 extensions EXT_color_buffer_half_float and WEBGL_color_buffer_float, and the WebGL 2.0 extension EXT_color_buffer_float. Enable these implicitly for WebGL 1.0 in the OES_texture_float and OES_texture_half_float extensions, restoring the previous functionality. Translate 32-bit floating point texture formats appropriately for the ANGLE backend. Fix some failures in previously-skipped conformance tests. The new code passes the more stringent top-of-tree WebGL 1.0.4 and 2.0.1 conformance tests related to floating-point texture renderability, which are not yet in the WebKit repository. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMConvertWebGL.cpp: (WebCore::convertToJSValue): * html/canvas/EXTColorBufferFloat.cpp: Copied from Source/WebCore/html/canvas/OESTextureHalfFloat.cpp. (WebCore::EXTColorBufferFloat::EXTColorBufferFloat): (WebCore::EXTColorBufferFloat::getName const): (WebCore::EXTColorBufferFloat::supported): * html/canvas/EXTColorBufferFloat.h: Copied from Source/WebCore/html/canvas/OESTextureFloat.h. * html/canvas/EXTColorBufferFloat.idl: Added. * html/canvas/EXTColorBufferHalfFloat.cpp: Copied from Source/WebCore/html/canvas/OESTextureFloat.cpp. (WebCore::EXTColorBufferHalfFloat::EXTColorBufferHalfFloat): (WebCore::EXTColorBufferHalfFloat::getName const): (WebCore::EXTColorBufferHalfFloat::supported): * html/canvas/EXTColorBufferHalfFloat.h: Copied from Source/WebCore/html/canvas/OESTextureFloat.h. * html/canvas/EXTColorBufferHalfFloat.idl: Added. * html/canvas/OESTextureFloat.cpp: (WebCore::OESTextureFloat::OESTextureFloat): (WebCore::OESTextureFloat::supported): * html/canvas/OESTextureFloat.h: * html/canvas/OESTextureHalfFloat.cpp: (WebCore::OESTextureHalfFloat::OESTextureHalfFloat): (WebCore::OESTextureHalfFloat::supported): * html/canvas/OESTextureHalfFloat.h: * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getExtension): (WebCore::WebGL2RenderingContext::getSupportedExtensions): (WebCore::WebGL2RenderingContext::getParameter): * html/canvas/WebGLColorBufferFloat.cpp: Copied from Source/WebCore/html/canvas/OESTextureFloat.cpp. (WebCore::WebGLColorBufferFloat::WebGLColorBufferFloat): (WebCore::WebGLColorBufferFloat::getName const): (WebCore::WebGLColorBufferFloat::supported): * html/canvas/WebGLColorBufferFloat.h: Copied from Source/WebCore/html/canvas/OESTextureFloat.h. * html/canvas/WebGLColorBufferFloat.idl: Added. * html/canvas/WebGLExtension.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): (WebCore::WebGLRenderingContext::getParameter): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::extensionIsEnabled): (WebCore::WebGLRenderingContextBase::copyTexImage2D): * html/canvas/WebGLRenderingContextBase.h: * platform/graphics/angle/ExtensionsGLANGLE.cpp: (WebCore::ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat): (WebCore::ExtensionsGLANGLE::texImage2DRobustANGLE): * platform/graphics/angle/ExtensionsGLANGLE.h: * platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLOpenGL::texImage2DDirect): LayoutTests: Update tex-mipmap-levels.html to top-of-tree to fix incorrect test cases. Rebaseline layout tests which are either now all passing, or have progressed. Temporarily skip a couple of tests, previously skipped because of lack of the EXT_color_buffer_float extension, which are failing because of Bug 211156. * TestExpectations: * fast/canvas/webgl/readPixels-float-expected.txt: * webgl/2.0.0/conformance2/textures/misc/copy-texture-image-expected.txt: * webgl/2.0.0/conformance2/textures/misc/tex-mipmap-levels-expected.txt: * webgl/2.0.0/resources/webgl_test_files/conformance2/textures/misc/tex-mipmap-levels.html: Canonical link: https://commits.webkit.org/224098@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-29 19:01:50 +00:00
public:
explicit EXTColorBufferHalfFloat(WebGLRenderingContextBase&);
virtual ~EXTColorBufferHalfFloat();
ExtensionName getName() const override;
static bool supported(const WebGLRenderingContextBase&);
};
} // namespace WebCore