WebKit Bugzilla
Attachment 360650 Details for
Bug 194048
: [WebGPU] Support GPUDepthStencilStateDescriptor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-194048-20190130170338.patch (text/plain), 33.53 KB, created by
Justin Fan
on 2019-01-30 17:03:39 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Justin Fan
Created:
2019-01-30 17:03:39 PST
Size:
33.53 KB
patch
obsolete
>Subversion Revision: 240686 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 5ed3184efc2897dbe9a8cfdd0b131176d6e5a6ee..77fd55d9db90f6b49f7fb0f582fe54a345654842 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,49 @@ >+2019-01-30 Justin Fan <justin_fan@apple.com> >+ >+ [WebGPU] Support GPUDepthStencilStateDescriptor >+ https://bugs.webkit.org/show_bug.cgi?id=194048 >+ <rdar://problem/46289645> >+ >+ Reviewed by Dean Jackson. >+ >+ Implement GPUDepthStencilStateDescriptor to specify a MTLDepthStencilState that is set on the command encoder. >+ >+ Existing tests cover changes to pipeline. Behavior does not change as DepthStencilState has no effect >+ without a depth texture attached. >+ >+ New interface files added: >+ * Modules/webgpu/GPUCompareFunction.idl: >+ * Modules/webgpu/GPUDepthStencilStateDescriptor.idl: >+ * platform/graphics/gpu/GPUCompareFunction.h: >+ * platform/graphics/gpu/GPUDepthStencilStateDescriptor.h: >+ >+ Modifications: >+ * Modules/webgpu/WebGPUDevice.cpp: Include depthStencilState when creating pipeline. >+ (WebCore::WebGPUDevice::createRenderPipeline const): >+ * Modules/webgpu/WebGPURenderPipelineDescriptor.h: Add depthStencilState to the descriptor. >+ * Modules/webgpu/WebGPURenderPipelineDescriptor.idl: Ditto. >+ * platform/graphics/gpu/GPURenderPipeline.h: Ditto. >+ (WebCore::GPURenderPipeline::depthStencilState const): Getter. >+ (WebCore::GPURenderPipeline::platformRenderPipeline const): >+ * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Update constructor to take depthStencilState. >+ (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): >+ * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: Setting pipeline also sets the included depthStencilState. >+ (WebCore::GPURenderPassEncoder::setPipeline): >+ * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm: Convert DepthStencilStateDescriptor to MTLDepthStencilState. >+ (WebCore::validateAndConvertDepthCompareFunctionToMtl): >+ (WebCore::tryCreateMtlDepthStencilState): >+ (WebCore::tryCreateMtlRenderPipelineState): Refactored logic out of GPURenderPipeline::create. >+ (WebCore::GPURenderPipeline::create): >+ (WebCore::GPURenderPipeline::GPURenderPipeline): >+ >+ Added symbols for CompareFunction, DepthStencilStateDescriptor to the project: >+ * CMakeLists.txt: >+ * DerivedSources.make: >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ >+ * Modules/webgpu/WebGPUDevice.idl: Cleaned up IDL to match current version. >+ > 2019-01-29 Simon Fraser <simon.fraser@apple.com> > > REGRESSION(r240553): [iOS] Crash in ScrollingTree::updateTreeFromStateNode when attempting to log in to icloud.com >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 482cf6fd59cc39ad312680182f807f8696695700..d355e7b2a0695c3175c3dad6e65526137ee2c11a 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -462,6 +462,8 @@ set(WebCore_NON_SVG_IDL_FILES > Modules/webdriver/NavigatorWebDriver.idl > > Modules/webgpu/DOMWindowWebGPU.idl >+ Modules/webgpu/GPUCompareFunction.idl >+ Modules/webgpu/GPUDepthStencilStateDescriptor.idl > Modules/webgpu/WebGPU.idl > Modules/webgpu/WebGPUAdapter.idl > Modules/webgpu/WebGPUAdapterDescriptor.idl >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index cd6757664eec5e0c609ab2f69120c84aae9fd687..01d93ee89af0c94bda2cf51aab979e6401cb5faf 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -372,6 +372,8 @@ JS_BINDING_IDLS = \ > $(WebCore)/Modules/webdatabase/SQLTransactionErrorCallback.idl \ > $(WebCore)/Modules/webdriver/NavigatorWebDriver.idl \ > $(WebCore)/Modules/webgpu/DOMWindowWebGPU.idl \ >+ $(WebCore)/Modules/webgpu/GPUCompareFunction.idl \ >+ $(WebCore)/Modules/webgpu/GPUDepthStencilStateDescriptor.idl \ > $(WebCore)/Modules/webgpu/WebGPU.idl \ > $(WebCore)/Modules/webgpu/WebGPUAdapter.idl \ > $(WebCore)/Modules/webgpu/WebGPUAdapterDescriptor.idl \ >diff --git a/Source/WebCore/Modules/webgpu/GPUCompareFunction.idl b/Source/WebCore/Modules/webgpu/GPUCompareFunction.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..3292259993e2cf799db82c3cdf0846a97633f57c >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/GPUCompareFunction.idl >@@ -0,0 +1,39 @@ >+/* >+ * 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 GPUCompareFunction { >+ "never", >+ "less", >+ "equal", >+ "less-equal", >+ "greater", >+ "not-equal", >+ "greater-equal", >+ "always" >+}; >diff --git a/Source/WebCore/Modules/webgpu/GPUDepthStencilStateDescriptor.idl b/Source/WebCore/Modules/webgpu/GPUDepthStencilStateDescriptor.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..94745b215f14a5df3958a1c79ac1756744aa4a36 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/GPUDepthStencilStateDescriptor.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 >+ >+[ >+ Conditional=WEBGPU, >+ EnabledAtRuntime=WebGPU >+] dictionary GPUDepthStencilStateDescriptor { >+ boolean depthWriteEnabled; >+ GPUCompareFunction depthCompare; >+ >+/* Not Yet Implemented >+ GPUStencilStateFaceDescriptor stencilFront; >+ GPUStencilStateFaceDescriptor stencilBack; >+ >+ u32 stencilReadMask; >+ u32 stencilWriteMask; >+*/ >+}; >diff --git a/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp b/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp >index 70adec8306fea23377528dade7bb88ab2c2bd072..0d98e13db3f78815a3d41f9427beee525fca3391 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp >+++ b/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp >@@ -165,7 +165,7 @@ RefPtr<WebGPURenderPipeline> WebGPUDevice::createRenderPipeline(WebGPURenderPipe > return nullptr; > } > >- if (auto pipeline = m_device->createRenderPipeline(GPURenderPipelineDescriptor { WTFMove(pipelineLayout), WTFMove(*vertexStage), WTFMove(*fragmentStage), descriptor.primitiveTopology, WTFMove(descriptor.inputState) })) >+ if (auto pipeline = m_device->createRenderPipeline(GPURenderPipelineDescriptor { WTFMove(pipelineLayout), WTFMove(*vertexStage), WTFMove(*fragmentStage), descriptor.primitiveTopology, WTFMove(descriptor.depthStencilState), WTFMove(descriptor.inputState) })) > return WebGPURenderPipeline::create(pipeline.releaseNonNull()); > return nullptr; > } >diff --git a/Source/WebCore/Modules/webgpu/WebGPUDevice.idl b/Source/WebCore/Modules/webgpu/WebGPUDevice.idl >index f2b6774cd0de947bb54e849266f76abf8d7430ee..2c86b3c80b0b1b28495db49a8efaf9fa1dc0d714 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUDevice.idl >+++ b/Source/WebCore/Modules/webgpu/WebGPUDevice.idl >@@ -29,8 +29,6 @@ > EnabledAtRuntime=WebGPU, > ImplementationLacksVTable > ] interface WebGPUDevice { >- // readonly attribute WebGPUExtensions extensions; >- // readonly attribute WebGPULimits limits; > readonly attribute WebGPUAdapter adapter; > > WebGPUBuffer createBuffer(WebGPUBufferDescriptor descriptor); >@@ -48,18 +46,15 @@ > WebGPUQueue getQueue(); > > // FIXME: Unimplemented. >+ // readonly attribute WebGPUExtensions extensions; >+ // readonly attribute WebGPULimits limits; >+ > // WebGPUTexture createTexture(WebGPUTextureDescriptor descriptor); > // WebGPUSampler createSampler(WebGPUSamplerDescriptor descriptor); >- // >- // WebGPUBindGroup createBindGroup(WebGPUBindGroupDescriptor descriptor); >- // >- // WebGPUBlendState createBlendState(WebGPUBlendStateDescriptor descriptor); >- // WebGPUDepthStencilState createDepthStencilState(WebGPUDepthStencilStateDescriptor descriptor); >- // WebGPUInputState createInputState(WebGPUInputStateDescriptor descriptor); >- // WebGPUAttachmentState createAttachmentState(WebGPUAttachmentStateDescriptor descriptor); >+ > // WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor); > // WebGPUFence createFence(WebGPUFenceDescriptor descriptor); >- // >+ > // attribute WebGPULogCallback onLog; > // WebGPUObjectStatusQuery getObjectStatus(StatusableObject statusableObject); > }; >diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h b/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h >index c12f758a7bfce89aaa14c61d205cef93fd9a034b..04ea6882be811a6582cfd58a1d31cfecea38610c 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h >+++ b/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h >@@ -27,6 +27,7 @@ > > #if ENABLE(WEBGPU) > >+#include "GPUDepthStencilStateDescriptor.h" > #include "GPURenderPipelineDescriptor.h" > #include "WebGPUInputStateDescriptor.h" > #include "WebGPUPipelineDescriptorBase.h" >@@ -40,6 +41,7 @@ struct WebGPURenderPipelineDescriptor : WebGPUPipelineDescriptorBase { > WebGPUPipelineStageDescriptor vertexStage; > WebGPUPipelineStageDescriptor fragmentStage; > PrimitiveTopology primitiveTopology; >+ GPUDepthStencilStateDescriptor depthStencilState; > WebGPUInputStateDescriptor inputState; > }; > >diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl b/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl >index fddb628dfa40b9052f79892185608024ee390955..12bd71d373949aa4bf85eed692d3e0c0ba7d8eb9 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl >+++ b/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl >@@ -40,10 +40,10 @@ enum WebGPUPrimitiveTopology { > WebGPUPipelineStageDescriptor fragmentStage; > > WebGPUPrimitiveTopology primitiveTopology; >+ GPUDepthStencilStateDescriptor depthStencilState; > WebGPUInputStateDescriptor inputState; > /* To Be Implemented: > sequence<WebGPUBlendStateDescriptor> blendStates; >- WebGPUDepthStencilStateDescriptor depthStencilState; > WebGPUAttachmentsStateDescriptor attachmentsState; > // TODO other properties > */ >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index e073841a69457c07fa757a956b33a2ed8bc56cd7..c27d917330942bd808df22dd97662240c1ac5941 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -2762,6 +2762,8 @@ JSFillMode.cpp > JSFocusEvent.cpp > JSFontFace.cpp > JSFontFaceSet.cpp >+JSGPUCompareFunction.cpp >+JSGPUDepthStencilStateDescriptor.cpp > JSGainNode.cpp > JSGeolocation.cpp > JSGeoposition.cpp >@@ -3303,8 +3305,8 @@ JSWebGPUBuffer.cpp > JSWebGPUBufferBinding.cpp > JSWebGPUBufferDescriptor.cpp > JSWebGPUBufferUsage.cpp >-JSWebGPUCommandBuffer.cpp > JSWebGPUColor.cpp >+JSWebGPUCommandBuffer.cpp > JSWebGPUDevice.cpp > JSWebGPUIndexFormat.cpp > JSWebGPUInputStateDescriptor.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index e3c75e8c8633574d89e84bc0abbf1f1038abd30c..6ead73c98949762e2254002883780adf4e7a6a9b 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -1608,7 +1608,7 @@ > 51F645691F4539B900B54DED /* ServiceWorkerJobData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645661F45399F00B54DED /* ServiceWorkerJobData.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 51F6456A1F4539C000B54DED /* ServiceWorkerJobType.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645651F45399F00B54DED /* ServiceWorkerJobType.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 51F645971F4A686F00B54DED /* SWServerRegistration.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645941F4A684F00B54DED /* SWServerRegistration.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- 51F645D51FECDBCE00B54DED /* Process.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645D31FECDBC800B54DED /* Process.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 51F645D51FECDBCE00B54DED /* ProcessIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645D31FECDBC800B54DED /* ProcessIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 51F645E01FF4594E00B54DED /* MessagePortIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645DE1FF4594B00B54DED /* MessagePortIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 51F798F01BE880E7008AE491 /* IDBIndexInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F798EC1BE880D3008AE491 /* IDBIndexInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 51F886C01F32923100C193EF /* JSNavigatorServiceWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F886BF1F32920700C193EF /* JSNavigatorServiceWorker.h */; }; >@@ -14012,6 +14012,10 @@ > D03211CF21AC954E00763CF2 /* GPUProgrammablePassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUProgrammablePassEncoder.h; sourceTree = "<group>"; }; > D03211D021AC954F00763CF2 /* GPURenderPassDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPURenderPassDescriptor.h; sourceTree = "<group>"; }; > D036DD8D208FFC0C00F9F4B2 /* WebGLCompressedTextureASTC.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGLCompressedTextureASTC.idl; sourceTree = "<group>"; }; >+ D03C849A21FFC6670002227F /* GPUDepthStencilStateDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUDepthStencilStateDescriptor.h; sourceTree = "<group>"; }; >+ D03C849C21FFC7FC0002227F /* GPUCompareFunction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUCompareFunction.h; sourceTree = "<group>"; }; >+ D03C849E21FFCF000002227F /* GPUCompareFunction.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUCompareFunction.idl; sourceTree = "<group>"; }; >+ D03C84A221FFD7230002227F /* GPUDepthStencilStateDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUDepthStencilStateDescriptor.idl; sourceTree = "<group>"; }; > D045AD1D2168230B000A6E9B /* WebMetalLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebMetalLayer.mm; sourceTree = "<group>"; }; > D045AD1E21682449000A6E9B /* JSWebMetalRenderPassAttachmentDescriptorCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebMetalRenderPassAttachmentDescriptorCustom.cpp; sourceTree = "<group>"; }; > D045AD1F21682449000A6E9B /* JSWebMetalRenderingContextCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebMetalRenderingContextCustom.cpp; sourceTree = "<group>"; }; >@@ -18443,6 +18447,8 @@ > D0D8648721B64CAA003C983C /* GPUBufferDescriptor.h */, > D001D9AB21B0C7BF0023B9BC /* GPUColor.h */, > 312FF8BD21A4C2F100EB199D /* GPUCommandBuffer.h */, >+ D03C849C21FFC7FC0002227F /* GPUCompareFunction.h */, >+ D03C849A21FFC6670002227F /* GPUDepthStencilStateDescriptor.h */, > 312FF8BF21A4C2F100EB199D /* GPUDevice.cpp */, > 312FF8BE21A4C2F100EB199D /* GPUDevice.h */, > D0D8649921BA1B1F003C983C /* GPUInputStateDescriptor.h */, >@@ -26023,6 +26029,8 @@ > D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */, > D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */, > D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */, >+ D03C849E21FFCF000002227F /* GPUCompareFunction.idl */, >+ D03C84A221FFD7230002227F /* GPUDepthStencilStateDescriptor.idl */, > D00F5947216EFE54000D71DB /* WebGPU.cpp */, > D00F5946216EFE54000D71DB /* WebGPU.h */, > D00F5948216EFE54000D71DB /* WebGPU.idl */, >@@ -31047,6 +31055,7 @@ > BCBB8AB913F1AFB000734DF0 /* PODInterval.h in Headers */, > BCBB8ABA13F1AFB000734DF0 /* PODIntervalTree.h in Headers */, > BCBB8ABB13F1AFB000734DF0 /* PODRedBlackTree.h in Headers */, >+ 71B5AB2621F1D9F400376E5C /* PointerCaptureController.h in Headers */, > 317D3FF3215599F40034E3B9 /* PointerEvent.h in Headers */, > B2B1F7170D00CAA8004AEA64 /* PointerEventsHitRules.h in Headers */, > 3FF813A71DBA8640009BF001 /* PointerLockController.h in Headers */, >@@ -31071,7 +31080,7 @@ > A10DBF4718F92317000D70C6 /* PreviewLoaderClient.h in Headers */, > E4605FEC2166480900E53046 /* PrewarmInformation.h in Headers */, > B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */, >- 51F645D51FECDBCE00B54DED /* Process.h in Headers */, >+ 51F645D51FECDBCE00B54DED /* ProcessIdentifier.h in Headers */, > A8EA7EBC0A1945D000A8EF5F /* ProcessingInstruction.h in Headers */, > E42050172141901B0066EF3B /* ProcessWarming.h in Headers */, > E44613EC0CD681B500FADA75 /* ProgressEvent.h in Headers */, >@@ -31968,7 +31977,6 @@ > 26E944DD1AC4B4EA007B85B5 /* Term.h in Headers */, > 6550B6A6099DF0270090D781 /* Text.h in Headers */, > 93309E17099E64920056E581 /* TextAffinity.h in Headers */, >- 71B5AB2621F1D9F400376E5C /* PointerCaptureController.h in Headers */, > CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */, > 0F54DCE61881051D003EEDBB /* TextAutoSizing.h in Headers */, > B2C3DA340D006C1D00EF6F26 /* TextBoundaries.h in Headers */, >@@ -32824,7 +32832,6 @@ > buildActionMask = 2147483647; > files = ( > A9787CB41F5F5C6600C551C6 /* AccessibilityMediaObject.cpp in Sources */, >- 6B0A07F321FA4B5C00D57391 /* AdClickAttribution.cpp in Sources */, > 31A795C81888BCB500382F90 /* ANGLEInstancedArrays.cpp in Sources */, > 490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */, > CD0EEE0E14743F39003EAFA2 /* AudioDestinationIOS.cpp in Sources */, >diff --git a/Source/WebCore/platform/graphics/gpu/GPUCompareFunction.h b/Source/WebCore/platform/graphics/gpu/GPUCompareFunction.h >new file mode 100644 >index 0000000000000000000000000000000000000000..dde9f65c740f9af808e636e38eef9754f5923e67 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gpu/GPUCompareFunction.h >@@ -0,0 +1,45 @@ >+/* >+ * 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 GPUCompareFunction { >+ Never, >+ Less, >+ Equal, >+ LessEqual, >+ Greater, >+ NotEqual, >+ GreaterEqual, >+ Always >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/GPUDepthStencilStateDescriptor.h b/Source/WebCore/platform/graphics/gpu/GPUDepthStencilStateDescriptor.h >new file mode 100644 >index 0000000000000000000000000000000000000000..4a47d03b362a688b2d7910c7fb179bb1e99e06e4 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/gpu/GPUDepthStencilStateDescriptor.h >@@ -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. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "GPUCompareFunction.h" >+ >+namespace WebCore { >+ >+struct GPUDepthStencilStateDescriptor { >+ bool depthWriteEnabled; >+ GPUCompareFunction depthCompare; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h b/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h >index b302e342e77309a4aa2d9277b80f1735dba6d871..5b5b9c0fd601b6765a82fbc39b2072877bdce126 100644 >--- a/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h >+++ b/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h >@@ -28,12 +28,14 @@ > #if ENABLE(WEBGPU) > > #include "GPURenderPipelineDescriptor.h" >- > #include <wtf/RefCounted.h> > #include <wtf/RefPtr.h> > #include <wtf/RetainPtr.h> > >+#if USE(METAL) >+OBJC_PROTOCOL(MTLDepthStencilState); > OBJC_PROTOCOL(MTLRenderPipelineState); >+#endif // USE(METAL) > > namespace WebCore { > >@@ -47,13 +49,18 @@ class GPURenderPipeline : public RefCounted<GPURenderPipeline> { > public: > static RefPtr<GPURenderPipeline> create(const GPUDevice&, GPURenderPipelineDescriptor&&); > >+#if USE(METAL) >+ MTLDepthStencilState *depthStencilState() const { return m_depthStencilState.get(); } >+#endif > PlatformRenderPipeline* platformRenderPipeline() const { return m_platformRenderPipeline.get(); } >- > PrimitiveTopology primitiveTopology() const { return m_primitiveTopology; } > > private: >- GPURenderPipeline(PlatformRenderPipelineSmartPtr&&, GPURenderPipelineDescriptor&&); >+#if USE(METAL) >+ GPURenderPipeline(RetainPtr<MTLDepthStencilState>&&, PlatformRenderPipelineSmartPtr&&, GPURenderPipelineDescriptor&&); > >+ RetainPtr<MTLDepthStencilState> m_depthStencilState; >+#endif // USE(METAL) > PlatformRenderPipelineSmartPtr m_platformRenderPipeline; > RefPtr<GPUPipelineLayout> m_layout; > PrimitiveTopology m_primitiveTopology; >diff --git a/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h b/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h >index 3216833d907cf248d397b4dc8238d451153ad4e5..627531b76bb27ec6d25bf46b38ba1bde94a76c05 100644 >--- a/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h >+++ b/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h >@@ -27,6 +27,7 @@ > > #if ENABLE(WEBGPU) > >+#include "GPUDepthStencilStateDescriptor.h" > #include "GPUInputStateDescriptor.h" > #include "GPUPipelineDescriptorBase.h" > #include "GPUPipelineStageDescriptor.h" >@@ -44,11 +45,12 @@ struct GPURenderPipelineDescriptor : GPUPipelineDescriptorBase { > TriangleStrip > }; > >- GPURenderPipelineDescriptor(RefPtr<GPUPipelineLayout>&& layout, GPUPipelineStageDescriptor&& vertex, GPUPipelineStageDescriptor&& fragment, PrimitiveTopology topology, GPUInputStateDescriptor&& input) >+ GPURenderPipelineDescriptor(RefPtr<GPUPipelineLayout>&& layout, GPUPipelineStageDescriptor&& vertex, GPUPipelineStageDescriptor&& fragment, PrimitiveTopology topology, GPUDepthStencilStateDescriptor&& depth, GPUInputStateDescriptor&& input) > : GPUPipelineDescriptorBase { WTFMove(layout) } > , vertexStage(WTFMove(vertex)) > , fragmentStage(WTFMove(fragment)) > , primitiveTopology(topology) >+ , depthStencilState(WTFMove(depth)) > , inputState(WTFMove(input)) > { > } >@@ -56,6 +58,7 @@ struct GPURenderPipelineDescriptor : GPUPipelineDescriptorBase { > GPUPipelineStageDescriptor vertexStage; > GPUPipelineStageDescriptor fragmentStage; > PrimitiveTopology primitiveTopology; >+ GPUDepthStencilStateDescriptor depthStencilState; > GPUInputStateDescriptor inputState; > }; > >diff --git a/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm b/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm >index 594a3370a8449f1d7b9f2d78fa82f7f99267247e..aec40e479d71a8c8082c609b6d231c516c28fdb9 100644 >--- a/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm >+++ b/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm >@@ -80,7 +80,15 @@ PlatformProgrammablePassEncoder *GPURenderPassEncoder::platformPassEncoder() con > > void GPURenderPassEncoder::setPipeline(Ref<GPURenderPipeline>&& pipeline) > { >+ BEGIN_BLOCK_OBJC_EXCEPTIONS; >+ >+ if (pipeline->depthStencilState()) >+ [m_platformRenderPassEncoder setDepthStencilState:pipeline->depthStencilState()]; >+ > [m_platformRenderPassEncoder setRenderPipelineState:pipeline->platformRenderPipeline()]; >+ >+ END_BLOCK_OBJC_EXCEPTIONS; >+ > m_pipeline = WTFMove(pipeline); > } > >diff --git a/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm b/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm >index b4e8760b5cccd21282414e09eaf56b5c0f719268..58860eba5c8bb70d0ecf276815e2b826cf5b668d 100644 >--- a/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm >+++ b/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm >@@ -36,6 +36,75 @@ > > namespace WebCore { > >+static Optional<MTLCompareFunction> validateAndConvertDepthCompareFunctionToMtl(GPUCompareFunction func) >+{ >+ switch (func) { >+ case GPUCompareFunction::Never: >+ return MTLCompareFunctionNever; >+ case GPUCompareFunction::Less: >+ return MTLCompareFunctionLess; >+ case GPUCompareFunction::Equal: >+ return MTLCompareFunctionEqual; >+ case GPUCompareFunction::LessEqual: >+ return MTLCompareFunctionLessEqual; >+ case GPUCompareFunction::Greater: >+ return MTLCompareFunctionGreater; >+ case GPUCompareFunction::NotEqual: >+ return MTLCompareFunctionNotEqual; >+ case GPUCompareFunction::GreaterEqual: >+ return MTLCompareFunctionGreaterEqual; >+ case GPUCompareFunction::Always: >+ return MTLCompareFunctionAlways; >+ default: >+ return WTF::nullopt; >+ } >+} >+ >+static RetainPtr<MTLDepthStencilState> tryCreateMtlDepthStencilState(const char* const functionName, const GPUDepthStencilStateDescriptor& descriptor, const GPUDevice& device) >+{ >+#if LOG_DISABLED >+ UNUSED_PARAM(functionName); >+#endif >+ RetainPtr<MTLDepthStencilDescriptor> mtlDescriptor; >+ >+ BEGIN_BLOCK_OBJC_EXCEPTIONS; >+ >+ mtlDescriptor = adoptNS([MTLDepthStencilDescriptor new]); >+ >+ END_BLOCK_OBJC_EXCEPTIONS; >+ >+ if (!mtlDescriptor) { >+ LOG(WebGPU, "%s: Unable to create MTLDepthStencilDescriptor!", functionName); >+ return nullptr; >+ } >+ >+ auto mtlDepthCompare = validateAndConvertDepthCompareFunctionToMtl(descriptor.depthCompare); >+ if (!mtlDepthCompare) { >+ LOG(WebGPU, "%s: Invalid GPUCompareFunction in GPUDepthStencilStateDescriptor!", functionName); >+ return nullptr; >+ } >+ >+ mtlDescriptor.get().depthCompareFunction = *mtlDepthCompare; >+ mtlDescriptor.get().depthWriteEnabled = descriptor.depthWriteEnabled; >+ >+ // FIXME: Implement back/frontFaceStencil. >+ >+ RetainPtr<MTLDepthStencilState> state; >+ >+ BEGIN_BLOCK_OBJC_EXCEPTIONS; >+ >+ state = adoptNS([device.platformDevice() newDepthStencilStateWithDescriptor:mtlDescriptor.get()]); >+ >+ END_BLOCK_OBJC_EXCEPTIONS; >+ >+ if (!state) { >+ LOG(WebGPU, "%s: Error creating MTLDepthStencilState!", functionName); >+ return nullptr; >+ } >+ >+ return state; >+} >+ > static bool setFunctionsForPipelineDescriptor(const char* const functionName, MTLRenderPipelineDescriptor *mtlDescriptor, const GPURenderPipelineDescriptor& descriptor) > { > #if LOG_DISABLED >@@ -175,15 +244,8 @@ static bool setInputStateForPipelineDescriptor(const char* const functionName, M > return true; > } > >-RefPtr<GPURenderPipeline> GPURenderPipeline::create(const GPUDevice& device, GPURenderPipelineDescriptor&& descriptor) >+static RetainPtr<MTLRenderPipelineState> tryCreateMtlRenderPipelineState(const char* const functionName, const GPURenderPipelineDescriptor& descriptor, const GPUDevice& device) > { >- const char* const functionName = "GPURenderPipeline::create()"; >- >- if (!device.platformDevice()) { >- LOG(WebGPU, "%s: Invalid GPUDevice!", functionName); >- return nullptr; >- } >- > RetainPtr<MTLRenderPipelineDescriptor> mtlDescriptor; > > BEGIN_BLOCK_OBJC_EXCEPTIONS; >@@ -212,7 +274,7 @@ RefPtr<GPURenderPipeline> GPURenderPipeline::create(const GPUDevice& device, GPU > // FIXME: Get the pixelFormat as configured for the context/CAMetalLayer. > mtlDescriptor.get().colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm; > >- PlatformRenderPipelineSmartPtr pipeline; >+ RetainPtr<MTLRenderPipelineState> pipeline; > > BEGIN_BLOCK_OBJC_EXCEPTIONS; > >@@ -223,14 +285,31 @@ RefPtr<GPURenderPipeline> GPURenderPipeline::create(const GPUDevice& device, GPU > > END_BLOCK_OBJC_EXCEPTIONS; > >+ return pipeline; >+} >+ >+RefPtr<GPURenderPipeline> GPURenderPipeline::create(const GPUDevice& device, GPURenderPipelineDescriptor&& descriptor) >+{ >+ const char* const functionName = "GPURenderPipeline::create()"; >+ >+ if (!device.platformDevice()) { >+ LOG(WebGPU, "%s: Invalid GPUDevice!", functionName); >+ return nullptr; >+ } >+ >+ // Depth Stencil state is separate from the render pipeline state in Metal. >+ auto depthStencil = tryCreateMtlDepthStencilState(functionName, descriptor.depthStencilState, device); >+ >+ auto pipeline = tryCreateMtlRenderPipelineState(functionName, descriptor, device); > if (!pipeline) > return nullptr; > >- return adoptRef(new GPURenderPipeline(WTFMove(pipeline), WTFMove(descriptor))); >+ return adoptRef(new GPURenderPipeline(WTFMove(depthStencil), WTFMove(pipeline), WTFMove(descriptor))); > } > >-GPURenderPipeline::GPURenderPipeline(PlatformRenderPipelineSmartPtr&& pipeline, GPURenderPipelineDescriptor&& descriptor) >- : m_platformRenderPipeline(WTFMove(pipeline)) >+GPURenderPipeline::GPURenderPipeline(RetainPtr<MTLDepthStencilState>&& depthStencil, RetainPtr<MTLRenderPipelineState>&& pipeline, GPURenderPipelineDescriptor&& descriptor) >+ : m_depthStencilState(WTFMove(depthStencil)) >+ , m_platformRenderPipeline(WTFMove(pipeline)) > , m_layout(WTFMove(descriptor.layout)) > , m_primitiveTopology(descriptor.primitiveTopology) > {
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 194048
:
360626
| 360650