Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (240747 => 240748)
--- trunk/Source/WebCore/CMakeLists.txt 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/CMakeLists.txt 2019-01-31 02:15:06 UTC (rev 240748)
@@ -462,6 +462,8 @@
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
Modified: trunk/Source/WebCore/ChangeLog (240747 => 240748)
--- trunk/Source/WebCore/ChangeLog 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/ChangeLog 2019-01-31 02:15:06 UTC (rev 240748)
@@ -1,3 +1,49 @@
+2019-01-30 Justin Fan <[email protected]>
+
+ [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-30 Jer Noble <[email protected]>
[Cocoa][EME] persistent-usage-record data not issued after MediaKeySession.remove()
Modified: trunk/Source/WebCore/DerivedSources.make (240747 => 240748)
--- trunk/Source/WebCore/DerivedSources.make 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/DerivedSources.make 2019-01-31 02:15:06 UTC (rev 240748)
@@ -372,6 +372,8 @@
$(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 \
Copied: trunk/Source/WebCore/Modules/webgpu/GPUCompareFunction.idl (from rev 240747, trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl) (0 => 240748)
--- trunk/Source/WebCore/Modules/webgpu/GPUCompareFunction.idl (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUCompareFunction.idl 2019-01-31 02:15:06 UTC (rev 240748)
@@ -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"
+};
Copied: trunk/Source/WebCore/Modules/webgpu/GPUDepthStencilStateDescriptor.idl (from rev 240747, trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl) (0 => 240748)
--- trunk/Source/WebCore/Modules/webgpu/GPUDepthStencilStateDescriptor.idl (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUDepthStencilStateDescriptor.idl 2019-01-31 02:15:06 UTC (rev 240748)
@@ -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;
+*/
+};
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (240747 => 240748)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp 2019-01-31 02:15:06 UTC (rev 240748)
@@ -165,7 +165,7 @@
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;
}
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl (240747 => 240748)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl 2019-01-31 02:15:06 UTC (rev 240748)
@@ -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);
};
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h (240747 => 240748)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h 2019-01-31 02:15:06 UTC (rev 240748)
@@ -27,6 +27,7 @@
#if ENABLE(WEBGPU)
+#include "GPUDepthStencilStateDescriptor.h"
#include "GPURenderPipelineDescriptor.h"
#include "WebGPUInputStateDescriptor.h"
#include "WebGPUPipelineDescriptorBase.h"
@@ -40,6 +41,7 @@
WebGPUPipelineStageDescriptor vertexStage;
WebGPUPipelineStageDescriptor fragmentStage;
PrimitiveTopology primitiveTopology;
+ GPUDepthStencilStateDescriptor depthStencilState;
WebGPUInputStateDescriptor inputState;
};
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl (240747 => 240748)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl 2019-01-31 02:15:06 UTC (rev 240748)
@@ -40,10 +40,10 @@
WebGPUPipelineStageDescriptor fragmentStage;
WebGPUPrimitiveTopology primitiveTopology;
+ GPUDepthStencilStateDescriptor depthStencilState;
WebGPUInputStateDescriptor inputState;
/* To Be Implemented:
sequence<WebGPUBlendStateDescriptor> blendStates;
- WebGPUDepthStencilStateDescriptor depthStencilState;
WebGPUAttachmentsStateDescriptor attachmentsState;
// TODO other properties
*/
Modified: trunk/Source/WebCore/Sources.txt (240747 => 240748)
--- trunk/Source/WebCore/Sources.txt 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/Sources.txt 2019-01-31 02:15:06 UTC (rev 240748)
@@ -2762,6 +2762,8 @@
JSFocusEvent.cpp
JSFontFace.cpp
JSFontFaceSet.cpp
+JSGPUCompareFunction.cpp
+JSGPUDepthStencilStateDescriptor.cpp
JSGainNode.cpp
JSGeolocation.cpp
JSGeoposition.cpp
@@ -3303,8 +3305,8 @@
JSWebGPUBufferBinding.cpp
JSWebGPUBufferDescriptor.cpp
JSWebGPUBufferUsage.cpp
+JSWebGPUColor.cpp
JSWebGPUCommandBuffer.cpp
-JSWebGPUColor.cpp
JSWebGPUDevice.cpp
JSWebGPUIndexFormat.cpp
JSWebGPUInputStateDescriptor.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (240747 => 240748)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-01-31 02:15:06 UTC (rev 240748)
@@ -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 */,
Copied: trunk/Source/WebCore/platform/graphics/gpu/GPUCompareFunction.h (from rev 240747, trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h) (0 => 240748)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUCompareFunction.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUCompareFunction.h 2019-01-31 02:15:06 UTC (rev 240748)
@@ -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)
Copied: trunk/Source/WebCore/platform/graphics/gpu/GPUDepthStencilStateDescriptor.h (from rev 240747, trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h) (0 => 240748)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUDepthStencilStateDescriptor.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDepthStencilStateDescriptor.h 2019-01-31 02:15:06 UTC (rev 240748)
@@ -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)
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h (240747 => 240748)
--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h 2019-01-31 02:15:06 UTC (rev 240748)
@@ -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 @@
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;
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h (240747 => 240748)
--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h 2019-01-31 02:15:06 UTC (rev 240748)
@@ -27,6 +27,7 @@
#if ENABLE(WEBGPU)
+#include "GPUDepthStencilStateDescriptor.h"
#include "GPUInputStateDescriptor.h"
#include "GPUPipelineDescriptorBase.h"
#include "GPUPipelineStageDescriptor.h"
@@ -44,11 +45,12 @@
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 @@
GPUPipelineStageDescriptor vertexStage;
GPUPipelineStageDescriptor fragmentStage;
PrimitiveTopology primitiveTopology;
+ GPUDepthStencilStateDescriptor depthStencilState;
GPUInputStateDescriptor inputState;
};
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm (240747 => 240748)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm 2019-01-31 02:15:06 UTC (rev 240748)
@@ -80,7 +80,15 @@
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);
}
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm (240747 => 240748)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm 2019-01-31 01:55:27 UTC (rev 240747)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm 2019-01-31 02:15:06 UTC (rev 240748)
@@ -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 @@
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 @@
// 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 @@
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)
{