WebKit Bugzilla
Attachment 361318 Details for
Bug 194354
: [Web GPU] Implement supporting dictionaries for GPUTexture
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194354-20190206124307.patch (text/plain), 48.20 KB, created by
Justin Fan
on 2019-02-06 12:43:08 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Justin Fan
Created:
2019-02-06 12:43:08 PST
Size:
48.20 KB
patch
obsolete
>Subversion Revision: 240985 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6ebd36c6181f4d2a1cd97db58dc5d851fd5c781d..079746c30617552ec4aa88821e2d166a85eed53f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,43 @@ >+2019-02-06 Justin Fan <justin_fan@apple.com> >+ >+ [Web GPU] Implement supporting dictionaries for GPUTexture >+ https://bugs.webkit.org/show_bug.cgi?id=194354 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add dictionaries needed to create a GPUTextureDescriptor. >+ >+ No new tests; no change in behavior. >+ >+ New interface and dictionaries added: >+ * Modules/webgpu/GPUExtent3D.idl: >+ * Modules/webgpu/GPUTextureDescriptor.idl: >+ * Modules/webgpu/GPUTextureDimension.idl: >+ * Modules/webgpu/GPUTextureUsage.idl: >+ * platform/graphics/gpu/GPUExtent3D.h: >+ * platform/graphics/gpu/GPUTextureDescriptor.h: >+ * platform/graphics/gpu/GPUTextureDimension.h: >+ * platform/graphics/gpu/GPUTextureUsage.h: >+ >+ Update WebGPUTextureFormatEnum to GPUTextureFormat: >+ * Modules/webgpu/WebGPUTextureFormatEnum.h: Removed. >+ * Modules/webgpu/GPUTextureFormat.idl: Renamed from WebGPUTextureFormatEnum.idl and updated to hyphen-case. >+ * platform/graphics/gpu/GPUTextureFormat.h: Renamed from GPUTextureFormatEnum and updated for hyphen-case IDL. >+ * Modules/webgpu/WebGPUSwapChain.cpp: >+ * Modules/webgpu/WebGPUSwapChain.h: >+ * Modules/webgpu/WebGPUSwapChain.idl: >+ * platform/graphics/gpu/GPUSwapChain.h: >+ * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: >+ (WebCore::platformTextureFormatForGPUTextureFormat): >+ (WebCore::GPUSwapChain::setFormat): >+ >+ Update project files with new symbols: >+ * CMakeLists.txt: >+ * DerivedSources.make: >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * bindings/js/WebCoreBuiltinNames.h: >+ > 2019-02-05 Alex Christensen <achristensen@webkit.org> > > Stop using blobRegistry in NetworkProcess >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 938fe9a5af1ab54ad0156994c33df45c57324566..502974ba7ff8abf70f52fee326d0bc5bdc7d33cf 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -464,7 +464,12 @@ set(WebCore_NON_SVG_IDL_FILES > Modules/webgpu/DOMWindowWebGPU.idl > Modules/webgpu/GPUCompareFunction.idl > Modules/webgpu/GPUDepthStencilStateDescriptor.idl >+ Modules/webgpu/GPUExtent3D.idl > Modules/webgpu/GPURequestAdapterOptions.idl >+ Modules/webgpu/GPUTextureDescriptor.idl >+ Modules/webgpu/GPUTextureDimension.idl >+ Modules/webgpu/GPUTextureFormat.idl >+ Modules/webgpu/GPUTextureUsage.idl > Modules/webgpu/WebGPU.idl > Modules/webgpu/WebGPUAdapter.idl > Modules/webgpu/WebGPUBindGroup.idl >@@ -500,7 +505,6 @@ set(WebCore_NON_SVG_IDL_FILES > Modules/webgpu/WebGPUShaderStageBit.idl > Modules/webgpu/WebGPUSwapChain.idl > Modules/webgpu/WebGPUTexture.idl >- Modules/webgpu/WebGPUTextureFormatEnum.idl > Modules/webgpu/WebGPUTextureView.idl > Modules/webgpu/WebGPUVertexAttributeDescriptor.idl > Modules/webgpu/WebGPUVertexFormat.idl >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index bc3009ef50c964b6e6784ce82c07649cf7945edd..00833b8277ddcd276e40e5829d641afa11598f51 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -374,7 +374,12 @@ JS_BINDING_IDLS = \ > $(WebCore)/Modules/webgpu/DOMWindowWebGPU.idl \ > $(WebCore)/Modules/webgpu/GPUCompareFunction.idl \ > $(WebCore)/Modules/webgpu/GPUDepthStencilStateDescriptor.idl \ >+ $(WebCore)/Modules/webgpu/GPUExtent3D.idl \ > $(WebCore)/Modules/webgpu/GPURequestAdapterOptions.idl \ >+ $(WebCore)/Modules/webgpu/GPUTextureDescriptor.idl \ >+ $(WebCore)/Modules/webgpu/GPUTextureDimension.idl \ >+ $(WebCore)/Modules/webgpu/GPUTextureFormat.idl \ >+ $(WebCore)/Modules/webgpu/GPUTextureUsage.idl \ > $(WebCore)/Modules/webgpu/WebGPU.idl \ > $(WebCore)/Modules/webgpu/WebGPUAdapter.idl \ > $(WebCore)/Modules/webgpu/WebGPUBindGroup.idl \ >@@ -410,7 +415,6 @@ JS_BINDING_IDLS = \ > $(WebCore)/Modules/webgpu/WebGPUShaderStageBit.idl \ > $(WebCore)/Modules/webgpu/WebGPUSwapChain.idl \ > $(WebCore)/Modules/webgpu/WebGPUTexture.idl \ >- $(WebCore)/Modules/webgpu/WebGPUTextureFormatEnum.idl \ > $(WebCore)/Modules/webgpu/WebGPUTextureView.idl \ > $(WebCore)/Modules/webgpu/WebGPUVertexAttributeDescriptor.idl \ > $(WebCore)/Modules/webgpu/WebGPUVertexFormat.idl \ >diff --git a/Source/WebCore/Modules/webgpu/GPUExtent3D.idl b/Source/WebCore/Modules/webgpu/GPUExtent3D.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..e040de80e9ecf5fad67d9b3a61d0484acf387118 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/GPUExtent3D.idl >@@ -0,0 +1,36 @@ >+/* >+ * Copyright (C) 2019 Apple 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 INC. 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 INC. 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. >+ */ >+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl >+ >+typedef unsigned long u32; >+ >+[ >+ Conditional=WEBGPU, >+ EnabledAtRuntime=WebGPU >+] dictionary GPUExtent3D { >+ u32 width; >+ u32 height; >+ u32 depth; >+}; >diff --git a/Source/WebCore/Modules/webgpu/GPUTextureDescriptor.idl b/Source/WebCore/Modules/webgpu/GPUTextureDescriptor.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..4ba69d370d8a92f26db5ac66cec1ba836c04c334 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/GPUTextureDescriptor.idl >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 2019 Apple 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 INC. 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 INC. 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. >+ */ >+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl >+ >+typedef unsigned long u32; >+typedef u32 GPUTextureUsageFlags; >+ >+[ >+ Conditional=WEBGPU, >+ EnabledAtRuntime=WebGPU >+] dictionary GPUTextureDescriptor { >+ GPUExtent3D size; >+ u32 arrayLayerCount; >+ u32 mipLevelCount; >+ u32 sampleCount; >+ GPUTextureDimension dimension; >+ GPUTextureFormat format; >+ GPUTextureUsageFlags usage; >+}; >diff --git a/Source/WebCore/Modules/webgpu/GPUTextureDimension.idl b/Source/WebCore/Modules/webgpu/GPUTextureDimension.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..858141789966c39c96d26a6d2856a79af0a80813 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/GPUTextureDimension.idl >@@ -0,0 +1,34 @@ >+/* >+ * Copyright (C) 2019 Apple 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 INC. 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 INC. 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. >+ */ >+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl >+ >+[ >+ Conditional=WEBGPU, >+ EnabledAtRuntime=WebGPU >+] enum GPUTextureDimension { >+ "1d", >+ "2d", >+ "3d" >+}; >diff --git a/Source/WebCore/Modules/webgpu/GPUTextureFormat.idl b/Source/WebCore/Modules/webgpu/GPUTextureFormat.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..7411c745c26096b13b5f0915764c098ff65432d4 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/GPUTextureFormat.idl >@@ -0,0 +1,34 @@ >+/* >+ * Copyright (C) 2018 Apple 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 INC. 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 INC. 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. >+ */ >+ >+[ >+ Conditional=WEBGPU, >+ EnabledAtRuntime=WebGPU >+] enum GPUTextureFormat { >+ "r8g8b8a8-unorm", >+ "r8g8b8a8-uint", >+ "b8g8r8a8-unorm", >+ "d32-float-s8-uint" >+}; >diff --git a/Source/WebCore/Modules/webgpu/GPUTextureUsage.idl b/Source/WebCore/Modules/webgpu/GPUTextureUsage.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..fccecf95ac42abda14851788b18e6aee08957f4f >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/GPUTextureUsage.idl >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 2019 Apple 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 INC. 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 INC. 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. >+ */ >+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl >+ >+typedef unsigned long u32; >+ >+[ >+ Conditional=WEBGPU, >+ DoNotCheckConstants, >+ EnabledAtRuntime=WebGPU, >+ ImplementationLacksVTable >+] interface GPUTextureUsage { >+ const u32 NONE = 0; >+ const u32 TRANSFER_SRC = 1; >+ const u32 TRANSFER_DST = 2; >+ const u32 SAMPLED = 4; >+ const u32 STORAGE = 8; >+ const u32 OUTPUT_ATTACHMENT = 16; >+}; >diff --git a/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp b/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp >index 26d20d3d31f3b34c074b8edad650a4aa3e62a7a6..40201b3825dc84f92af6e4bddf0b5ef242783d0d 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp >+++ b/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp >@@ -28,7 +28,7 @@ > > #if ENABLE(WEBGPU) > >-#include "GPUTextureFormatEnum.h" >+#include "GPUTextureFormat.h" > > namespace WebCore { > >diff --git a/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h b/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h >index ccae75e55dca8488fbbe2ca7509615ee88e9e164..ce0aeec6b71749f33182f2411adc76aacce8bc2b 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h >+++ b/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h >@@ -29,9 +29,9 @@ > > #include "GPUBasedCanvasRenderingContext.h" > #include "GPUSwapChain.h" >+#include "GPUTextureFormat.h" > #include "WebGPUDevice.h" > #include "WebGPUTexture.h" >-#include "WebGPUTextureFormatEnum.h" > > #include <wtf/RefPtr.h> > >@@ -42,7 +42,7 @@ public: > struct Descriptor { > const WebGPUDevice* device = nullptr; > // FIXME: More texture properties. >- WebGPUTextureFormatEnum format; >+ GPUTextureFormat format; > unsigned long width; > unsigned long height; > }; >diff --git a/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl b/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl >index a0521a023bec66ea61af52b5016ff82f18b1e0b5..fe07fe2602e11dc1cebc29c58b34ee4f474b1f97 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl >+++ b/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl >@@ -42,7 +42,7 @@ typedef unsigned long u32; > ] dictionary WebGPUSwapChainDescriptor { > WebGPUDevice? device; > // WebGPUTextureUsageFlags usage; >- WebGPUTextureFormatEnum format; >+ GPUTextureFormat format; > u32 width; > u32 height; > }; >diff --git a/Source/WebCore/Modules/webgpu/WebGPUTextureFormatEnum.h b/Source/WebCore/Modules/webgpu/WebGPUTextureFormatEnum.h >deleted file mode 100644 >index de7aa2a8f5c02315a8620c5692008c6b5e8ceb82..0000000000000000000000000000000000000000 >--- a/Source/WebCore/Modules/webgpu/WebGPUTextureFormatEnum.h >+++ /dev/null >@@ -1,38 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple 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 INC. 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 INC. 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 >- >-#if ENABLE(WEBGPU) >- >-#include "GPUTextureFormatEnum.h" >- >-namespace WebCore { >- >-using WebGPUTextureFormatEnum = GPUTextureFormatEnum; >- >-} // namespace WebCore >- >-#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/Modules/webgpu/WebGPUTextureFormatEnum.idl b/Source/WebCore/Modules/webgpu/WebGPUTextureFormatEnum.idl >deleted file mode 100644 >index 9822ffd45937892d69274209c0688e1c3f5a718a..0000000000000000000000000000000000000000 >--- a/Source/WebCore/Modules/webgpu/WebGPUTextureFormatEnum.idl >+++ /dev/null >@@ -1,34 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple 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 INC. 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 INC. 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. >- */ >- >-[ >- Conditional=WEBGPU, >- EnabledAtRuntime=WebGPU >-] enum WebGPUTextureFormatEnum { >- "R8G8B8A8Unorm", >- "R8G8B8A8Uint", >- "B8G8R8A8Unorm", >- "D32FloatS8Uint" >-}; >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 3f4296d5242f423e590a386d02b2b929a8d8e6a1..876a6b8fa02cd0ef694b74c537b960ec14c347a2 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -2765,13 +2765,18 @@ JSFontFace.cpp > JSFontFaceSet.cpp > JSGPUCompareFunction.cpp > JSGPUDepthStencilStateDescriptor.cpp >+JSGPUExtent3D.cpp >+JSGPURequestAdapterOptions.cpp >+JSGPUTextureDescriptor.cpp >+JSGPUTextureDimension.cpp >+JSGPUTextureFormat.cpp >+JSGPUTextureUsage.cpp > JSGainNode.cpp > JSGeolocation.cpp > JSGeoposition.cpp > JSGlobalCrypto.cpp > JSGlobalEventHandlers.cpp > JSGlobalPerformance.cpp >-JSGPURequestAdapterOptions.cpp > JSHTMLAllCollection.cpp > JSHTMLAnchorElement.cpp > JSHTMLAppletElement.cpp >@@ -3329,7 +3334,6 @@ JSWebGPUShaderModuleDescriptor.cpp > JSWebGPUShaderStageBit.cpp > JSWebGPUSwapChain.cpp > JSWebGPUTexture.cpp >-JSWebGPUTextureFormatEnum.cpp > JSWebGPUTextureView.cpp > JSWebGPUVertexAttributeDescriptor.cpp > JSWebGPUVertexFormat.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 85590f6db27880e892ed5d0a311a1271784a6399..15e11bbd046c9cd08eac8c6bba4d60aaaea8fe98 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -921,7 +921,7 @@ > 312FF91921A4C36500EB199D /* GPUShaderModuleDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 312FF8C021A4C2F200EB199D /* GPUShaderModuleDescriptor.h */; }; > 312FF91A21A4C36500EB199D /* GPUSwapChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 312FF8BA21A4C2EF00EB199D /* GPUSwapChain.h */; }; > 312FF91B21A4C36500EB199D /* GPUTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 312FF8C521A4C2F400EB199D /* GPUTexture.h */; }; >- 312FF91C21A4C36500EB199D /* GPUTextureFormatEnum.h in Headers */ = {isa = PBXBuildFile; fileRef = 312FF8C321A4C2F300EB199D /* GPUTextureFormatEnum.h */; }; >+ 312FF91C21A4C36500EB199D /* GPUTextureFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 312FF8C321A4C2F300EB199D /* GPUTextureFormat.h */; }; > 312FF91D21A4C37300EB199D /* GPULegacyRenderPassDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 312FF8FF21A4C33F00EB199D /* GPULegacyRenderPassDescriptor.h */; }; > 312FF91E21A4C37300EB199D /* GPULegacyBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 312FF90221A4C33F00EB199D /* GPULegacyBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 312FF91F21A4C37300EB199D /* GPULegacyTextureDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 312FF90421A4C33F00EB199D /* GPULegacyTextureDescriptor.h */; }; >@@ -6955,7 +6955,7 @@ > 312FF8C021A4C2F200EB199D /* GPUShaderModuleDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUShaderModuleDescriptor.h; sourceTree = "<group>"; }; > 312FF8C121A4C2F200EB199D /* GPUQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUQueue.h; sourceTree = "<group>"; }; > 312FF8C221A4C2F300EB199D /* GPUPipelineStageDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUPipelineStageDescriptor.h; sourceTree = "<group>"; }; >- 312FF8C321A4C2F300EB199D /* GPUTextureFormatEnum.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureFormatEnum.h; sourceTree = "<group>"; }; >+ 312FF8C321A4C2F300EB199D /* GPUTextureFormat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureFormat.h; sourceTree = "<group>"; }; > 312FF8C421A4C2F400EB199D /* GPUPipelineDescriptorBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUPipelineDescriptorBase.h; sourceTree = "<group>"; }; > 312FF8C521A4C2F400EB199D /* GPUTexture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTexture.h; sourceTree = "<group>"; }; > 312FF8CF21A4C33F00EB199D /* GPULegacyTextureDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPULegacyTextureDescriptor.cpp; sourceTree = "<group>"; }; >@@ -13952,6 +13952,14 @@ > D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpaceSplitString.h; sourceTree = "<group>"; }; > D0232B5821CB49B7009483B9 /* GPUBindGroupLayoutMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUBindGroupLayoutMetal.mm; sourceTree = "<group>"; }; > D02454D021C4A41C00B73628 /* GPUBindGroupLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBindGroupLayout.h; sourceTree = "<group>"; }; >+ D026F47D220A2AC600AC5F49 /* GPUExtent3D.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUExtent3D.h; sourceTree = "<group>"; }; >+ D026F480220A2B7000AC5F49 /* GPUExtent3D.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUExtent3D.idl; sourceTree = "<group>"; }; >+ D026F483220A472F00AC5F49 /* GPUTextureUsage.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUTextureUsage.idl; sourceTree = "<group>"; }; >+ D026F485220A477200AC5F49 /* GPUTextureUsage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureUsage.h; sourceTree = "<group>"; }; >+ D026F486220A505900AC5F49 /* GPUTextureDimension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureDimension.h; sourceTree = "<group>"; }; >+ D026F489220A539800AC5F49 /* GPUTextureDimension.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUTextureDimension.idl; sourceTree = "<group>"; }; >+ D026F48B220A5B0B00AC5F49 /* GPUTextureDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUTextureDescriptor.idl; sourceTree = "<group>"; }; >+ D026F48C220A5BAD00AC5F49 /* GPUTextureDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureDescriptor.h; sourceTree = "<group>"; }; > D02B83ED21C8397A00F85473 /* WebGPUBindGroupLayoutDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBindGroupLayoutDescriptor.idl; sourceTree = "<group>"; }; > D02C26922181416D00D818E4 /* GPURequestAdapterOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPURequestAdapterOptions.idl; sourceTree = "<group>"; }; > D02F854E21682A4A0088EE74 /* WebMetalCommandQueue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalCommandQueue.idl; sourceTree = "<group>"; }; >@@ -14149,8 +14157,7 @@ > D0EACF9121940A5B000FA75C /* WebGPUProgrammablePassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUProgrammablePassEncoder.h; sourceTree = "<group>"; }; > D0EACF9221940A5B000FA75C /* WebGPUProgrammablePassEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUProgrammablePassEncoder.cpp; sourceTree = "<group>"; }; > D0EACF9321940A5B000FA75C /* WebGPUProgrammablePassEncoder.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUProgrammablePassEncoder.idl; sourceTree = "<group>"; }; >- D0EACFAD219E30FD000FA75C /* WebGPUTextureFormatEnum.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUTextureFormatEnum.h; sourceTree = "<group>"; }; >- D0EACFAE219E30FD000FA75C /* WebGPUTextureFormatEnum.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUTextureFormatEnum.idl; sourceTree = "<group>"; }; >+ D0EACFAE219E30FD000FA75C /* GPUTextureFormat.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUTextureFormat.idl; sourceTree = "<group>"; }; > D0EDA772143E303C0028E383 /* CachedRawResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedRawResource.cpp; sourceTree = "<group>"; }; > D0EDA773143E303C0028E383 /* CachedRawResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedRawResource.h; sourceTree = "<group>"; }; > D0F75598220391C300118058 /* WHLSLVertexBufferIndexCalculator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLVertexBufferIndexCalculator.h; sourceTree = "<group>"; }; >@@ -18459,6 +18466,7 @@ > D03C849A21FFC6670002227F /* GPUDepthStencilStateDescriptor.h */, > 312FF8BF21A4C2F100EB199D /* GPUDevice.cpp */, > 312FF8BE21A4C2F100EB199D /* GPUDevice.h */, >+ D026F47D220A2AC600AC5F49 /* GPUExtent3D.h */, > D0D8649921BA1B1F003C983C /* GPUInputStateDescriptor.h */, > D0F7559F2203BA1400118058 /* GPULimits.h */, > 312FF8C421A4C2F400EB199D /* GPUPipelineDescriptorBase.h */, >@@ -18478,7 +18486,10 @@ > 312FF8C021A4C2F200EB199D /* GPUShaderModuleDescriptor.h */, > 312FF8BA21A4C2EF00EB199D /* GPUSwapChain.h */, > 312FF8C521A4C2F400EB199D /* GPUTexture.h */, >- 312FF8C321A4C2F300EB199D /* GPUTextureFormatEnum.h */, >+ D026F48C220A5BAD00AC5F49 /* GPUTextureDescriptor.h */, >+ D026F486220A505900AC5F49 /* GPUTextureDimension.h */, >+ 312FF8C321A4C2F300EB199D /* GPUTextureFormat.h */, >+ D026F485220A477200AC5F49 /* GPUTextureUsage.h */, > D0D8649B21BA1C2D003C983C /* GPUVertexAttributeDescriptor.h */, > D0D8649C21BA1CE8003C983C /* GPUVertexInputDescriptor.h */, > 498770D71242C535002226BA /* Texture.cpp */, >@@ -26045,7 +26056,12 @@ > D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */, > D03C849E21FFCF000002227F /* GPUCompareFunction.idl */, > D03C84A221FFD7230002227F /* GPUDepthStencilStateDescriptor.idl */, >+ D026F480220A2B7000AC5F49 /* GPUExtent3D.idl */, > D02C26922181416D00D818E4 /* GPURequestAdapterOptions.idl */, >+ D026F48B220A5B0B00AC5F49 /* GPUTextureDescriptor.idl */, >+ D026F489220A539800AC5F49 /* GPUTextureDimension.idl */, >+ D0EACFAE219E30FD000FA75C /* GPUTextureFormat.idl */, >+ D026F483220A472F00AC5F49 /* GPUTextureUsage.idl */, > D00F5947216EFE54000D71DB /* WebGPU.cpp */, > D00F5946216EFE54000D71DB /* WebGPU.h */, > D00F5948216EFE54000D71DB /* WebGPU.idl */, >@@ -26132,8 +26148,6 @@ > D0EACF852193B02E000FA75C /* WebGPUTexture.cpp */, > D0EACF842193B02E000FA75C /* WebGPUTexture.h */, > D0EACF862193B02E000FA75C /* WebGPUTexture.idl */, >- D0EACFAD219E30FD000FA75C /* WebGPUTextureFormatEnum.h */, >- D0EACFAE219E30FD000FA75C /* WebGPUTextureFormatEnum.idl */, > D0EACF882193EE4E000FA75C /* WebGPUTextureView.cpp */, > D0EACF872193EE4E000FA75C /* WebGPUTextureView.h */, > D0EACF892193EE4E000FA75C /* WebGPUTextureView.idl */, >@@ -29360,7 +29374,7 @@ > 312FF91921A4C36500EB199D /* GPUShaderModuleDescriptor.h in Headers */, > 312FF91A21A4C36500EB199D /* GPUSwapChain.h in Headers */, > 312FF91B21A4C36500EB199D /* GPUTexture.h in Headers */, >- 312FF91C21A4C36500EB199D /* GPUTextureFormatEnum.h in Headers */, >+ 312FF91C21A4C36500EB199D /* GPUTextureFormat.h in Headers */, > BC53C5F50DA56B920021EB5D /* Gradient.h in Headers */, > B22279640D00BF220071B782 /* GradientAttributes.h in Headers */, > 2D481F04146B5C6B00AA7834 /* GradientImage.h in Headers */, >diff --git a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >index 183fe8a8858a38f4a8e80969b5bdec5041588bef..c448956a46ee078062ead17424a885d1d5f476bc 100644 >--- a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >+++ b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >@@ -81,6 +81,7 @@ namespace WebCore { > macro(Gamepad) \ > macro(GamepadButton) \ > macro(GamepadEvent) \ >+ macro(GPUTextureUsage) \ > macro(HTMLAttachmentElement) \ > macro(HTMLAudioElement) \ > macro(HTMLDataListElement) \ >diff --git a/Source/WebCore/platform/graphics/gpu/GPUExtent3D.h b/Source/WebCore/platform/graphics/gpu/GPUExtent3D.h >new file mode 100644 >index 0000000000000000000000000000000000000000..5b6f266b8c2998eadc72fec5f3a816a0630869c8 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gpu/GPUExtent3D.h >@@ -0,0 +1,40 @@ >+/* >+ * Copyright (C) 2019 Apple 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 INC. 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 INC. 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 >+ >+#if ENABLE(WEBGPU) >+ >+namespace WebCore { >+ >+struct GPUExtent3D { >+ unsigned long width; >+ unsigned long height; >+ unsigned long depth; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h b/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h >index 874ca365a76be19554829901906d9f725f2c4142..d6b771d6a56a1921cc1e804c3483469eb5aab723 100644 >--- a/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h >+++ b/Source/WebCore/platform/graphics/gpu/GPUSwapChain.h >@@ -39,7 +39,7 @@ namespace WebCore { > > class GPUDevice; > >-enum class GPUTextureFormatEnum; >+enum class GPUTextureFormat; > > using PlatformDrawableSmartPtr = RetainPtr<CAMetalDrawable>; > using PlatformLayer = CALayer; >@@ -50,7 +50,7 @@ public: > static RefPtr<GPUSwapChain> create(); > > void setDevice(const GPUDevice&); >- void setFormat(GPUTextureFormatEnum); >+ void setFormat(GPUTextureFormat); > void reshape(int width, int height); > RefPtr<GPUTexture> getNextTexture(); > void present(); >diff --git a/Source/WebCore/platform/graphics/gpu/GPUTextureDescriptor.h b/Source/WebCore/platform/graphics/gpu/GPUTextureDescriptor.h >new file mode 100644 >index 0000000000000000000000000000000000000000..66a46e95dba5a98f249c5f4d3253d54a147415d7 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gpu/GPUTextureDescriptor.h >@@ -0,0 +1,49 @@ >+/* >+ * Copyright (C) 2019 Apple 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 INC. 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 INC. 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 >+ >+#if ENABLE(WEBGPU) >+ >+#include "GPUExtent3D.h" >+#include "GPUTextureDimension.h" >+#include "GPUTextureFormat.h" >+#include "GPUTextureUsage.h" >+ >+namespace WebCore { >+ >+struct GPUTextureDescriptor { >+ GPUExtent3D size; >+ unsigned long arrayLayerCount; >+ unsigned long mipLevelCount; >+ unsigned long sampleCount; >+ GPUTextureDimension dimension; >+ GPUTextureFormat format; >+ GPUTextureUsageFlags usage; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/GPUTextureDimension.h b/Source/WebCore/platform/graphics/gpu/GPUTextureDimension.h >new file mode 100644 >index 0000000000000000000000000000000000000000..56b1ed3a409fbed7fb83b9782851bcb8dc04d51b >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gpu/GPUTextureDimension.h >@@ -0,0 +1,40 @@ >+/* >+ * Copyright (C) 2019 Apple 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 INC. 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 INC. 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 >+ >+#if ENABLE(WEBGPU) >+ >+namespace WebCore { >+ >+enum class GPUTextureDimension { >+ _1d, >+ _2d, >+ _3d >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/GPUTextureFormat.h b/Source/WebCore/platform/graphics/gpu/GPUTextureFormat.h >new file mode 100644 >index 0000000000000000000000000000000000000000..15c048f4feddcf58258b10182062fe5c8a3b8eec >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gpu/GPUTextureFormat.h >@@ -0,0 +1,43 @@ >+/* >+ * Copyright (C) 2018 Apple 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 INC. 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 INC. 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 >+ >+#if ENABLE(WEBGPU) >+ >+namespace WebCore { >+ >+enum class GPUTextureFormat { >+ R8g8b8a8Unorm, >+ R8g8b8a8Uint, >+ B8g8r8a8Unorm, >+ D32FloatS8Uint >+}; >+ >+using PlatformTextureFormat = unsigned long; >+ >+} >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/GPUTextureFormatEnum.h b/Source/WebCore/platform/graphics/gpu/GPUTextureFormatEnum.h >deleted file mode 100644 >index 791134fe064a6856352bfa8cfe3e2476f4abca72..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/graphics/gpu/GPUTextureFormatEnum.h >+++ /dev/null >@@ -1,43 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple 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 INC. 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 INC. 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 >- >-#if ENABLE(WEBGPU) >- >-namespace WebCore { >- >-enum class GPUTextureFormatEnum { >- R8G8B8A8Unorm, >- R8G8B8A8Uint, >- B8G8R8A8Unorm, >- D32FloatS8Uint >-}; >- >-using PlatformTextureFormat = unsigned long; >- >-} >- >-#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/GPUTextureUsage.h b/Source/WebCore/platform/graphics/gpu/GPUTextureUsage.h >new file mode 100644 >index 0000000000000000000000000000000000000000..17a03007d496bc8721ca94e40586c1f29a24a475 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gpu/GPUTextureUsage.h >@@ -0,0 +1,48 @@ >+/* >+ * Copyright (C) 2019 Apple 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 INC. 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 INC. 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 >+ >+#if ENABLE(WEBGPU) >+ >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+using GPUTextureUsageFlags = unsigned long; >+ >+class GPUTextureUsage : public RefCounted<GPUTextureUsage> { >+public: >+ static const GPUTextureUsageFlags None = 0; >+ static const GPUTextureUsageFlags TransferSrc = 1; >+ static const GPUTextureUsageFlags TransferDst = 2; >+ static const GPUTextureUsageFlags Sampled = 4; >+ static const GPUTextureUsageFlags Storage = 8; >+ static const GPUTextureUsageFlags OutputAttachment = 16; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm b/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm >index 19b88d5743943df378cd1c09323933a6f7bbef59..f48df41ad5ad5f169e740d14e3845ed2e88a3c63 100644 >--- a/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm >+++ b/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm >@@ -30,7 +30,7 @@ > > #import "GPUDevice.h" > #import "GPUTexture.h" >-#import "GPUTextureFormatEnum.h" >+#import "GPUTextureFormat.h" > #import "Logging.h" > #import "WebGPULayer.h" > >@@ -80,16 +80,16 @@ void GPUSwapChain::setDevice(const GPUDevice& device) > [m_platformSwapLayer setDevice:device.platformDevice()]; > } > >-static Optional<PlatformTextureFormat> platformTextureFormatForGPUTextureFormat(GPUTextureFormatEnum format) >+static Optional<PlatformTextureFormat> platformTextureFormatForGPUTextureFormat(GPUTextureFormat format) > { > switch (format) { >- case GPUTextureFormatEnum::R8G8B8A8Unorm: >+ case GPUTextureFormat::R8g8b8a8Unorm: > return MTLPixelFormatRGBA8Unorm; >- case GPUTextureFormatEnum::R8G8B8A8Uint: >+ case GPUTextureFormat::R8g8b8a8Uint: > return MTLPixelFormatRGBA8Uint; >- case GPUTextureFormatEnum::B8G8R8A8Unorm: >+ case GPUTextureFormat::B8g8r8a8Unorm: > return MTLPixelFormatBGRA8Unorm; >- case GPUTextureFormatEnum::D32FloatS8Uint: >+ case GPUTextureFormat::D32FloatS8Uint: > return MTLPixelFormatDepth32Float_Stencil8; > default: > LOG(WebGPU, "GPUSwapChain::setFormat(): Invalid texture format specified!"); >@@ -97,7 +97,7 @@ static Optional<PlatformTextureFormat> platformTextureFormatForGPUTextureFormat( > } > } > >-void GPUSwapChain::setFormat(GPUTextureFormatEnum format) >+void GPUSwapChain::setFormat(GPUTextureFormat format) > { > auto result = platformTextureFormatForGPUTextureFormat(format); > if (!result) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 53c9496b990b258d2e9436ac2d1f90e2743a153d..26a49fc64bd102b6f170abe3694e01371be74429 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2019-02-06 Justin Fan <justin_fan@apple.com> >+ >+ [Web GPU] Implement supporting dictionaries for GPUTexture >+ https://bugs.webkit.org/show_bug.cgi?id=194354 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Update test files to use hyphen-case for GPUTextureFormat. >+ >+ * webgpu/js/basic-webgpu-functions.js: >+ (async.setUpContexts): >+ * webgpu/js/webgpu-functions.js: >+ (createBasicContext): >+ > 2019-02-05 Ryan Haddad <ryanhaddad@apple.com> > > Unreviewed, rolling out r240742. >diff --git a/LayoutTests/webgpu/js/basic-webgpu-functions.js b/LayoutTests/webgpu/js/basic-webgpu-functions.js >index 083732536309f9c3a36b61a5576338570d3fad81..ce2468514eebff3f59653b8a90e387d12fb9e9fa 100644 >--- a/LayoutTests/webgpu/js/basic-webgpu-functions.js >+++ b/LayoutTests/webgpu/js/basic-webgpu-functions.js >@@ -74,7 +74,7 @@ async function setUpContexts(canvas) { > } > > // FIXME: Implement WebGPUTextureUsageEnum. >- context.configure({ device: defaultDevice, format:"B8G8R8A8Unorm", width: canvas.width, height: canvas.height }); >+ context.configure({ device: defaultDevice, format:"b8g8r8a8-unorm", width: canvas.width, height: canvas.height }); > } > > let shaderModule, vertexStageDescriptor, fragmentStageDescriptor, pipelineDescriptor, renderPipeline; >diff --git a/LayoutTests/webgpu/js/webgpu-functions.js b/LayoutTests/webgpu/js/webgpu-functions.js >index f3789c9f254b439044df7945f2f4c1e1e078af55..bf43de6f8ebf48424d3ae1813cec741ad30ae223 100644 >--- a/LayoutTests/webgpu/js/webgpu-functions.js >+++ b/LayoutTests/webgpu/js/webgpu-functions.js >@@ -7,7 +7,7 @@ async function getBasicDevice() { > function createBasicContext(canvas, device) { > const context = canvas.getContext("webgpu"); > // FIXME: Implement and specify a WebGPUTextureUsageEnum. >- context.configure({ device: device, format:"B8G8R8A8Unorm", width: canvas.width, height: canvas.height }); >+ context.configure({ device: device, format:"b8g8r8a8-unorm", width: canvas.width, height: canvas.height }); > return context; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194354
: 361318