WebKit Bugzilla
Attachment 356134 Details for
Bug 192213
: [WebGPU] Flesh out WebGPURenderPassDescriptor to match the WebGPU IDL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192213-20181129221439.patch (text/plain), 31.25 KB, created by
Justin Fan
on 2018-11-29 22:14:40 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Justin Fan
Created:
2018-11-29 22:14:40 PST
Size:
31.25 KB
patch
obsolete
>Subversion Revision: 238717 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f21fdb32fcde3c3bb4d75cd736574880822787fc..451e1abd137edbf37c81edf0bec57990f5195169 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,33 @@ >+2018-11-29 Justin Fan <justin_fan@apple.com> >+ >+ [WebGPU] Flesh out WebGPURenderPassDescriptor to match the WebGPU IDL >+ https://bugs.webkit.org/show_bug.cgi?id=192213 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WebGPU prototype now uses WebGPURenderPassColorAttachmentDescriptor in WebGPURenderPassDescriptor to match the WebGPU Sketch. >+ WebGPU developer can now also set the clearColor in WebGPURenderPassDescriptor. >+ >+ No new tests. Older WebGPURenderPass* tests updated. >+ >+ * CMakeLists.txt: >+ * DerivedSources.make: >+ * Modules/webgpu/WebGPUColor.h: Added. Typedef'd to GPUColor.h. >+ * Modules/webgpu/WebGPUColor.idl: Added. >+ * Modules/webgpu/WebGPUCommandBuffer.cpp: >+ (WebCore::WebGPUCommandBuffer::beginRenderPass): Updated to error check and support the new structure of WebGPURenderPassDescriptor. >+ * Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.h: Added. >+ * Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.idl: Added. >+ * Modules/webgpu/WebGPURenderPassDescriptor.h: >+ * Modules/webgpu/WebGPURenderPassDescriptor.idl: Updated to match the sketch IDL. >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * platform/graphics/gpu/GPUColor.h: Added. >+ * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Added. Backing struct for WebGPU__. >+ * platform/graphics/gpu/GPURenderPassDescriptor.h: Updated to match new WebGPURenderPassDescriptor. >+ * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: >+ (WebCore::GPURenderPassEncoder::create): Now also uses clearColor set by developer. >+ > 2018-11-29 Keith Rollin <krollin@apple.com> > > Unreviewed build fix. >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index b181517d01794e5a3af2ff76f5452f862c23694e..7ca751ff39c9ba8b27249a743425dc07aea69c5a 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -458,12 +458,14 @@ set(WebCore_NON_SVG_IDL_FILES > Modules/webgpu/WebGPU.idl > Modules/webgpu/WebGPUAdapter.idl > Modules/webgpu/WebGPUAdapterDescriptor.idl >+ Modules/webgpu/WebGPUColor.idl > Modules/webgpu/WebGPUCommandBuffer.idl > Modules/webgpu/WebGPUDevice.idl > Modules/webgpu/WebGPUPipelineDescriptorBase.idl > Modules/webgpu/WebGPUPipelineStageDescriptor.idl > Modules/webgpu/WebGPUProgrammablePassEncoder.idl > Modules/webgpu/WebGPUQueue.idl >+ Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.idl > Modules/webgpu/WebGPURenderPassDescriptor.idl > Modules/webgpu/WebGPURenderPassEncoder.idl > Modules/webgpu/WebGPURenderPipeline.idl >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index ab063fcc77a52dc38482d34f58206bf8be890892..3e57b1b0b83d9a5038899086ad1e7c9b46343be8 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -375,12 +375,14 @@ JS_BINDING_IDLS = \ > $(WebCore)/Modules/webgpu/WebGPU.idl \ > $(WebCore)/Modules/webgpu/WebGPUAdapter.idl \ > $(WebCore)/Modules/webgpu/WebGPUAdapterDescriptor.idl \ >+ $(WebCore)/Modules/webgpu/WebGPUColor.idl \ > $(WebCore)/Modules/webgpu/WebGPUCommandBuffer.idl \ > $(WebCore)/Modules/webgpu/WebGPUDevice.idl \ > $(WebCore)/Modules/webgpu/WebGPUQueue.idl \ > $(WebCore)/Modules/webgpu/WebGPUPipelineDescriptorBase.idl \ > $(WebCore)/Modules/webgpu/WebGPUPipelineStageDescriptor.idl \ > $(WebCore)/Modules/webgpu/WebGPUProgrammablePassEncoder.idl \ >+ $(WebCore)/Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.idl \ > $(WebCore)/Modules/webgpu/WebGPURenderPassDescriptor.idl \ > $(WebCore)/Modules/webgpu/WebGPURenderPassEncoder.idl \ > $(WebCore)/Modules/webgpu/WebGPURenderPipeline.idl \ >diff --git a/Source/WebCore/Modules/webgpu/WebGPUColor.h b/Source/WebCore/Modules/webgpu/WebGPUColor.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8cc96dd6fed373af1808330f349525fb66e95771 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WebGPUColor.h >@@ -0,0 +1,38 @@ >+/* >+ * 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 "GPUColor.h" >+ >+namespace WebCore { >+ >+using WebGPUColor = GPUColor; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/Modules/webgpu/WebGPUColor.idl b/Source/WebCore/Modules/webgpu/WebGPUColor.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..e613c2b5106caaeff58ebc66cb2244c2ef50b3db >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WebGPUColor.idl >@@ -0,0 +1,35 @@ >+/* >+ * 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. >+ */ >+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl >+ >+[ >+ Conditional=WEBGPU, >+ EnabledAtRuntime=WebGPU >+] dictionary WebGPUColor { >+ float r; >+ float g; >+ float b; >+ float a; >+}; >diff --git a/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp b/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp >index 4f760463f2204cbe8d68be187fd200d91ee0cbe9..0a4de2a1350a538a02a817bdc6dcdb99289e702c 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp >+++ b/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp >@@ -53,12 +53,22 @@ WebGPUCommandBuffer::WebGPUCommandBuffer(Ref<GPUCommandBuffer>&& buffer) > RefPtr<WebGPURenderPassEncoder> WebGPUCommandBuffer::beginRenderPass(WebGPURenderPassDescriptor&& descriptor) > { > // FIXME: Improve error checking as WebGPURenderPassDescriptor is implemented. >- if (!descriptor.attachment) { >- LOG(WebGPU, "WebGPUCommandBuffer::create(): No attachment specified for WebGPURenderPassDescriptor!"); >+ if (descriptor.colorAttachments.isEmpty()) { >+ LOG(WebGPU, "WebGPUCommandBuffer::create(): No attachments specified for WebGPURenderPassDescriptor!"); > return nullptr; > } >- >- auto encoder = GPURenderPassEncoder::create(m_commandBuffer.get(), GPURenderPassDescriptor { descriptor.attachment->texture() }); >+ >+ GPURenderPassDescriptor gpuRenderPassDescriptor; >+ >+ for (const auto& colorAttachment : descriptor.colorAttachments) { >+ if (!colorAttachment.attachment) { >+ LOG(WebGPU, "WebGPUCommandBuffer::create(): Invalid attachment in WebGPURenderPassColorAttachmentDescriptor!"); >+ return nullptr; >+ } >+ gpuRenderPassDescriptor.colorAttachments.append(GPURenderPassColorAttachmentDescriptor { colorAttachment.attachment->texture(), colorAttachment.clearColor }); >+ } >+ >+ auto encoder = GPURenderPassEncoder::create(m_commandBuffer.get(), WTFMove(gpuRenderPassDescriptor)); > > if (!encoder) > return nullptr; >diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.h b/Source/WebCore/Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ab72b553df0e892780226a4dd5461bee4df36299 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.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) >+ >+#include "WebGPUColor.h" >+#include "WebGPUTextureView.h" >+ >+namespace WebCore { >+ >+struct WebGPURenderPassColorAttachmentDescriptor { >+ RefPtr<WebGPUTextureView> attachment; >+ >+ WebGPUColor clearColor; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.idl b/Source/WebCore/Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..58c5cc8c863abe6e667d77641576d68ad4fd861b >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/WebGPURenderPassColorAttachmentDescriptor.idl >@@ -0,0 +1,37 @@ >+/* >+ * 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. >+ */ >+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl >+ >+[ >+ Conditional=WEBGPU, >+ EnabledAtRuntime=WebGPU >+] dictionary WebGPURenderPassColorAttachmentDescriptor { >+ WebGPUTextureView attachment; >+ >+ // Not Yet Implemented >+ // WebGPULoadOp loadOp; >+ // WebGPUStoreOp storeOp; >+ WebGPUColor clearColor; >+}; >diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.h b/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.h >index 747e39ef0708748010d1d1c9bc33659a1fd4a69f..c19230c0cf0b0dc2f12faac220e1a835c39c76b7 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.h >+++ b/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.h >@@ -27,13 +27,14 @@ > > #if ENABLE(WEBGPU) > >-#include "WebGPUTextureView.h" >+#include "WebGPURenderPassColorAttachmentDescriptor.h" >+ >+#include <wtf/Vector.h> > > namespace WebCore { > > struct WebGPURenderPassDescriptor { >- // FIXME: Temporary shortcut implementation for prototyping. >- RefPtr<WebGPUTextureView> attachment; >+ Vector<WebGPURenderPassColorAttachmentDescriptor> colorAttachments; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl b/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl >index 21dea2d37e74ce50b4ae7343dfed0c20a14d8c9e..b7ade3c4c6bd05f943a355753121cdf2db9763aa 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl >+++ b/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl >@@ -28,11 +28,6 @@ > Conditional=WEBGPU, > EnabledAtRuntime=WebGPU > ] dictionary WebGPURenderPassDescriptor { >- // FIXME: Temporary shortcut implementation for prototyping. >- WebGPUTextureView attachment; >- >-/* Not Yet Implemented: > sequence<WebGPURenderPassColorAttachmentDescriptor> colorAttachments; >- WebGPURenderPassDepthStencilAttachmentDescriptor depthStencilAttachment; >-*/ >+ // WebGPURenderPassDepthStencilAttachmentDescriptor depthStencilAttachment; > }; >diff --git a/Source/WebCore/Modules/webgpu/WebGPUTexture.cpp b/Source/WebCore/Modules/webgpu/WebGPUTexture.cpp >index ee1f2434c6fc307585d5a3dafdf1f8b4e712b45c..d5b4b3bdceb4be5ff04171d19de421e026103c3b 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUTexture.cpp >+++ b/Source/WebCore/Modules/webgpu/WebGPUTexture.cpp >@@ -28,7 +28,6 @@ > > #if ENABLE(WEBGPU) > >-#include "GPUTexture.h" > #include "WebGPUTextureView.h" > > namespace WebCore { >diff --git a/Source/WebCore/Modules/webgpu/WebGPUTexture.h b/Source/WebCore/Modules/webgpu/WebGPUTexture.h >index 1d44a39606aa86d1e65769c01299083ee66a7eb6..11c08de4d25dc2cbded9418b55ac725b91367e55 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUTexture.h >+++ b/Source/WebCore/Modules/webgpu/WebGPUTexture.h >@@ -27,12 +27,13 @@ > > #if ENABLE(WEBGPU) > >+#include "GPUTexture.h" >+ > #include <wtf/RefCounted.h> > #include <wtf/RefPtr.h> > > namespace WebCore { > >-class GPUTexture; > class WebGPUTextureView; > > class WebGPUTexture : public RefCounted<WebGPUTexture> { >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 79cdc3efae203fa1e20543a36c6472a790ef3bf3..cfe4687822abc32309904ba10343c8fa509d1f32 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -3221,12 +3221,14 @@ JSWebGPU.cpp > JSWebGPUAdapter.cpp > JSWebGPUAdapterDescriptor.cpp > JSWebGPUCommandBuffer.cpp >+JSWebGPUColor.cpp > JSWebGPUDevice.cpp > JSWebGPUQueue.cpp > JSWebGPUPipelineDescriptorBase.cpp > JSWebGPUPipelineStageDescriptor.cpp > JSWebGPUProgrammablePassEncoder.cpp > JSWebGPURenderingContext.cpp >+JSWebGPURenderPassColorAttachmentDescriptor.cpp > JSWebGPURenderPassDescriptor.cpp > JSWebGPURenderPassEncoder.cpp > JSWebGPURenderPipeline.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 9a4f9c52cbf10f88f51fd4c6840fbcf0957cab75..b7a1a62dd252ea65639526e4f735deb4cba0f56a 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -13771,6 +13771,12 @@ > D000EBA111BDAFD400C47726 /* FrameLoaderStateMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLoaderStateMachine.h; sourceTree = "<group>"; }; > D000ED2511C1B9CD00C47726 /* SubframeLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubframeLoader.cpp; sourceTree = "<group>"; }; > D000ED2611C1B9CD00C47726 /* SubframeLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubframeLoader.h; sourceTree = "<group>"; }; >+ D001D9A921B0C6730023B9BC /* GPURenderPassColorAttachmentDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPURenderPassColorAttachmentDescriptor.h; sourceTree = "<group>"; }; >+ D001D9AB21B0C7BF0023B9BC /* GPUColor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUColor.h; sourceTree = "<group>"; }; >+ D001D9AC21B0C81A0023B9BC /* WebGPUColor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUColor.h; sourceTree = "<group>"; }; >+ D001D9AD21B0C81A0023B9BC /* WebGPUColor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUColor.idl; sourceTree = "<group>"; }; >+ D001D9B021B0C8A80023B9BC /* WebGPURenderPassColorAttachmentDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPURenderPassColorAttachmentDescriptor.h; sourceTree = "<group>"; }; >+ D001D9B121B0C8A80023B9BC /* WebGPURenderPassColorAttachmentDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderPassColorAttachmentDescriptor.idl; sourceTree = "<group>"; }; > D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMWindowWebGPU.h; sourceTree = "<group>"; }; > D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowWebGPU.cpp; sourceTree = "<group>"; }; > D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMWindowWebGPU.idl; sourceTree = "<group>"; }; >@@ -18146,6 +18152,7 @@ > children = ( > D087CE3721ACA94200BDE174 /* cocoa */, > 312FF8CE21A4C33F00EB199D /* legacy */, >+ D001D9AB21B0C7BF0023B9BC /* GPUColor.h */, > 312FF8BD21A4C2F100EB199D /* GPUCommandBuffer.h */, > 312FF8BF21A4C2F100EB199D /* GPUDevice.cpp */, > 312FF8BE21A4C2F100EB199D /* GPUDevice.h */, >@@ -18153,6 +18160,7 @@ > 312FF8C221A4C2F300EB199D /* GPUPipelineStageDescriptor.h */, > D03211CF21AC954E00763CF2 /* GPUProgrammablePassEncoder.h */, > 312FF8C121A4C2F200EB199D /* GPUQueue.h */, >+ D001D9A921B0C6730023B9BC /* GPURenderPassColorAttachmentDescriptor.h */, > D03211D021AC954F00763CF2 /* GPURenderPassDescriptor.h */, > D03211CE21AC954E00763CF2 /* GPURenderPassEncoder.h */, > 312FF8B921A4C2EF00EB199D /* GPURenderPipeline.h */, >@@ -25634,6 +25642,8 @@ > D00F5951216FFAC2000D71DB /* WebGPUAdapter.idl */, > D02C26912181416D00D818E4 /* WebGPUAdapterDescriptor.h */, > D02C26922181416D00D818E4 /* WebGPUAdapterDescriptor.idl */, >+ D001D9AC21B0C81A0023B9BC /* WebGPUColor.h */, >+ D001D9AD21B0C81A0023B9BC /* WebGPUColor.idl */, > D0EACF7721937228000FA75C /* WebGPUCommandBuffer.cpp */, > D0EACF7621937228000FA75C /* WebGPUCommandBuffer.h */, > D0EACF7821937228000FA75C /* WebGPUCommandBuffer.idl */, >@@ -25653,6 +25663,8 @@ > D093D2292179541600329217 /* WebGPURenderingContext.cpp */, > D093D225217951D400329217 /* WebGPURenderingContext.h */, > D093D227217951D400329217 /* WebGPURenderingContext.idl */, >+ D001D9B021B0C8A80023B9BC /* WebGPURenderPassColorAttachmentDescriptor.h */, >+ D001D9B121B0C8A80023B9BC /* WebGPURenderPassColorAttachmentDescriptor.idl */, > D0EACF8C219403C9000FA75C /* WebGPURenderPassDescriptor.h */, > D0EACF8D219403C9000FA75C /* WebGPURenderPassDescriptor.idl */, > D0EACF8F21940A22000FA75C /* WebGPURenderPassEncoder.cpp */, >diff --git a/Source/WebCore/platform/graphics/gpu/GPUColor.h b/Source/WebCore/platform/graphics/gpu/GPUColor.h >new file mode 100644 >index 0000000000000000000000000000000000000000..02da52656de23d2624d6a1b8e356bd264adc1619 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gpu/GPUColor.h >@@ -0,0 +1,41 @@ >+/* >+ * 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 { >+ >+struct GPUColor { >+ float r; >+ float g; >+ float b; >+ float a; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h b/Source/WebCore/platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b9d4602a0a885afd8ebc88f9954d4cb60ea86e9a >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.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) >+ >+#include "GPUColor.h" >+#include "GPUTexture.h" >+ >+namespace WebCore { >+ >+struct GPURenderPassColorAttachmentDescriptor { >+ Ref<GPUTexture> attachment; >+ >+ GPUColor clearColor; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h b/Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h >index 5a24db363264309743d0db90d51ac5a410e6e017..edce9dee4b925534caf1dc59c8bda204235b6240 100644 >--- a/Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h >+++ b/Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h >@@ -27,12 +27,14 @@ > > #if ENABLE(WEBGPU) > >-#include "GPUTexture.h" >+#include "GPURenderPassColorAttachmentDescriptor.h" >+ >+#include <wtf/Vector.h> > > namespace WebCore { > > struct GPURenderPassDescriptor { >- Ref<GPUTexture> attachment; >+ Vector<GPURenderPassColorAttachmentDescriptor> colorAttachments; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm b/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm >index 38adb866b7a6aa6c0a8fd2b97b202737f16c58c4..2c582b0b32d8d412d8cd654a469aa7e6b9da7a48 100644 >--- a/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm >+++ b/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm >@@ -42,15 +42,18 @@ RefPtr<GPURenderPassEncoder> GPURenderPassEncoder::create(const GPUCommandBuffer > { > PlatformRenderPassEncoderSmartPtr mtlEncoder; > >+ // FIXME: Default to colorAttachments[0] and this loadOp, storeOp for now. >+ const auto& attachmentDescriptor = descriptor.colorAttachments[0]; >+ const auto& color = attachmentDescriptor.clearColor; >+ > BEGIN_BLOCK_OBJC_EXCEPTIONS; > > auto mtlDescriptor = adoptNS([MTLRenderPassDescriptor new]); > >- // FIXME: Default to colorAttachments[0] and this loadOp, storeOp, clearColor for now. >- mtlDescriptor.get().colorAttachments[0].texture = descriptor.attachment->platformTexture(); >+ mtlDescriptor.get().colorAttachments[0].texture = attachmentDescriptor.attachment->platformTexture(); > mtlDescriptor.get().colorAttachments[0].loadAction = MTLLoadActionClear; > mtlDescriptor.get().colorAttachments[0].storeAction = MTLStoreActionStore; >- mtlDescriptor.get().colorAttachments[0].clearColor = MTLClearColorMake(0.35, 0.65, 0.85, 1.0); >+ mtlDescriptor.get().colorAttachments[0].clearColor = MTLClearColorMake(color.r, color.g, color.b, color.a); > > mtlEncoder = retainPtr([buffer.platformCommandBuffer() renderCommandEncoderWithDescriptor:mtlDescriptor.get()]); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 828908e08aa61f61be2351e7ff02efb8fe3a5826..cb4d839f398d8f5fb9be15d003b34d175517d0f0 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2018-11-29 Justin Fan <justin_fan@apple.com> >+ >+ [WebGPU] Flesh out WebGPURenderPassDescriptor to match the WebGPU IDL >+ https://bugs.webkit.org/show_bug.cgi?id=192213 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Updating some tests to match the updated WebGPURenderPassDescriptor. >+ >+ * webgpu/js/basic-webgpu-functions.js: >+ (render): >+ * webgpu/render-command-encoding.html: >+ * webgpu/render-passes.html: >+ > 2018-11-29 Ryan Haddad <ryanhaddad@apple.com> > > REGRESSION (r238090): [ MacOS WK1 ] Layout Test imported/blink/compositing/squashing/squashing-into-ancestor-painted-layer.html is flaky >diff --git a/LayoutTests/webgpu/js/basic-webgpu-functions.js b/LayoutTests/webgpu/js/basic-webgpu-functions.js >index 50aa08efc2d38b21be95a2c954935684a55f4aa8..a996212d306e250c43d14f22c56858a661580acb 100644 >--- a/LayoutTests/webgpu/js/basic-webgpu-functions.js >+++ b/LayoutTests/webgpu/js/basic-webgpu-functions.js >@@ -137,10 +137,14 @@ function render() { > return; > } > >- // FIXME: Flesh out the rest of WebGPURenderPassDescriptor. >- // Default a loadOp, storeOp, and clearColor in the implementation for now. >+ // FIXME: Default a loadOp, and storeOp in the implementation for now. >+ const colorAttachmentDescriptor = { >+ attachment : textureView, >+ clearColor : { r:0.35, g:0.65, b:0.85, a:1.0 } >+ } >+ > let renderPassDescriptor = { >- attachment : textureView >+ colorAttachments : [colorAttachmentDescriptor] > } > > let renderPassEncoder = commandBuffer.beginRenderPass(renderPassDescriptor); >diff --git a/LayoutTests/webgpu/render-command-encoding.html b/LayoutTests/webgpu/render-command-encoding.html >index 5f824dde94e02c10261ce17d21e3f76b5359191e..872fb89ae26a9760dc4280858c6e062341e7bfd2 100644 >--- a/LayoutTests/webgpu/render-command-encoding.html >+++ b/LayoutTests/webgpu/render-command-encoding.html >@@ -12,10 +12,14 @@ > let commandBuffer, renderPassEncoder; > > function beginPass() { >- // FIXME: Flesh out the rest of WebGPURenderPassDescriptor. >- // Default a loadOp, storeOp, and clearColor in the implementation for now. >- const renderPassDescriptor = { >- attachment : context.getNextTexture().createDefaultTextureView() >+ // Default a loadOp, storeOp in the implementation for now. >+ const colorAttachmentDescriptor = { >+ attachment: context.getNextTexture().createDefaultTextureView(), >+ clearColor: { r: 0.35, g: 0.65, b: 0.85, a: 1.0 } >+ } >+ >+ let renderPassDescriptor = { >+ colorAttachments : [colorAttachmentDescriptor] > } > > renderPassEncoder = commandBuffer.beginRenderPass(renderPassDescriptor); >diff --git a/LayoutTests/webgpu/render-passes.html b/LayoutTests/webgpu/render-passes.html >index 286d47a1bb04b8e3c73a65acc3dcc5d9c9c172af..96c976fd04fa7866526ddec51a673ebc7575c8e1 100644 >--- a/LayoutTests/webgpu/render-passes.html >+++ b/LayoutTests/webgpu/render-passes.html >@@ -10,13 +10,15 @@ let commandBuffer, renderPassEncoder; > > function setUpBasicRenderPassEncoder() { > commandBuffer = defaultDevice.createCommandBuffer(); >- const texture = context.getNextTexture(); >- const textureView = texture.createDefaultTextureView(); > >- // FIXME: Flesh out the rest of WebGPURenderPassDescriptor. >- // Default a loadOp, storeOp, and clearColor in the implementation for now. >- const renderPassDescriptor = { >- attachment : textureView >+ // Default a loadOp, storeOp in the implementation for now. >+ const colorAttachmentDescriptor = { >+ attachment: context.getNextTexture().createDefaultTextureView(), >+ clearColor: { r: 0.35, g: 0.65, b: 0.85, a: 1.0 } >+ } >+ >+ let renderPassDescriptor = { >+ colorAttachments: [colorAttachmentDescriptor] > } > > renderPassEncoder = commandBuffer.beginRenderPass(renderPassDescriptor);
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 192213
:
356122
| 356134