Diff
Modified: trunk/LayoutTests/ChangeLog (243456 => 243457)
--- trunk/LayoutTests/ChangeLog 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/LayoutTests/ChangeLog 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,5 +1,17 @@
2019-03-25 Truitt Savell <[email protected]>
+ Unreviewed, rolling out r243419.
+
+ Caused Mac WK2 testers to crash and become unresponsive.
+
+ Reverted changeset:
+
+ "[Web GPU] Prototype compute pipeline with MSL"
+ https://bugs.webkit.org/show_bug.cgi?id=196107
+ https://trac.webkit.org/changeset/243419
+
+2019-03-25 Truitt Savell <[email protected]>
+
Unreviewed, rolling out r243438.
243319 Caused Mac WK2 testers to crash and become
Deleted: trunk/LayoutTests/webgpu/compute-squares-expected.txt (243456 => 243457)
--- trunk/LayoutTests/webgpu/compute-squares-expected.txt 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/LayoutTests/webgpu/compute-squares-expected.txt 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1 +0,0 @@
-
Deleted: trunk/LayoutTests/webgpu/compute-squares.html (243456 => 243457)
--- trunk/LayoutTests/webgpu/compute-squares.html 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/LayoutTests/webgpu/compute-squares.html 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,78 +0,0 @@
-<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] -->
-<meta charset=utf-8>
-<title>Execute a simple compute shader with Web GPU.</title>
-<body>
-<script src=""
-<script src=""
-<script src=""
-<script>
-if (window.testRunner)
- testRunner.waitUntilDone();
-
-const data = "" Uint32Array([2, 3, 4, 5, 6, 7, 8, 9, 10]);
-
-const dataBinding = 0;
-const bindGroupIndex = 0;
-
-const shaderCode = `
-#include <metal_stdlib>
-
-struct Data {
- device unsigned* numbers [[id(${dataBinding})]];
-};
-
-kernel void compute(device Data& data [[buffer(${bindGroupIndex})]], unsigned gid [[thread_position_in_grid]])
-{
- if (gid >= ${data.length})
- return;
-
- unsigned original = data.numbers[gid];
- data.numbers[gid] = original * original;
-}
-`
-
-promise_test(async () => {
-
- const device = await getBasicDevice();
-
- const shaderModule = device.createShaderModule({ code: shaderCode, isWHLSL: false });
- const computeStageDescriptor = { module: shaderModule, entryPoint: "compute" };
- const pipeline = device.createComputePipeline({ computeStage: computeStageDescriptor });
-
- const dataBuffer = device.createBuffer({ size: data.byteLength, usage: GPUBufferUsage.STORAGE | GPUBufferUsage.TRANSFER_DST | GPUBufferUsage.MAP_READ });
- dataBuffer.setSubData(0, data.buffer);
-
- const bgLayoutBinding = { binding: dataBinding, visibility: GPUShaderStageBit.COMPUTE, type: "storage-buffer" };
- const bgLayout = device.createBindGroupLayout({ bindings: [bgLayoutBinding] });
-
- const bufferBinding = { buffer: dataBuffer, offset: 0, size: data.byteLength };
- const bgBinding = { binding: dataBinding, resource: bufferBinding };
-
- const bindGroupDescriptor = { layout: bgLayout, bindings: [bgBinding] };
- const bindGroup = device.createBindGroup(bindGroupDescriptor);
-
- const commandEncoder = device.createCommandEncoder();
- const passEncoder = commandEncoder.beginComputePass();
-
- passEncoder.setBindGroup(bindGroupIndex, bindGroup);
-
- passEncoder.setPipeline(pipeline);
-
- passEncoder.dispatch(data.length, 1, 1);
- passEncoder.endPass();
-
- device.getQueue().submit([commandEncoder.finish()]);
-
- const readDataArrayBuffer = await dataBuffer.mapReadAsync();
- assert_not_equals(readDataArrayBuffer, null, "Async read promise resolved successfully");
-
- const readData = new Uint32Array(readDataArrayBuffer);
-
- for (var i = 0; i < readData.length; ++i)
- assert_equals(readData[i], data[i] * data[i], "Data was succesfully squared");
-
- if (window.testRunner)
- testRunner.notifyDone();
-}, "Successfully executed a basic compute pass");
-</script>
-</body>
\ No newline at end of file
Modified: trunk/LayoutTests/webgpu/whlsl.html (243456 => 243457)
--- trunk/LayoutTests/webgpu/whlsl.html 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/LayoutTests/webgpu/whlsl.html 2019-03-25 21:12:25 UTC (rev 243457)
@@ -93,7 +93,7 @@
const swapChainDescriptor = {context, format: "bgra8unorm"};
const swapChain = device.createSwapChain(swapChainDescriptor);
const outputTexture = swapChain.getCurrentTexture();
- const outputTextureView = outputTexture.createDefaultView();
+ const outputTextureView = outputTexture.createDefaultView(); // createDefaultView()
const commandEncoder = device.createCommandEncoder(); // {}
const red = {r: 0, g: 0, b: 1, a: 1};
Modified: trunk/Source/WebCore/CMakeLists.txt (243456 => 243457)
--- trunk/Source/WebCore/CMakeLists.txt 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/CMakeLists.txt 2019-03-25 21:12:25 UTC (rev 243457)
@@ -495,9 +495,6 @@
Modules/webgpu/WebGPUBufferBinding.idl
Modules/webgpu/WebGPUCommandBuffer.idl
Modules/webgpu/WebGPUCommandEncoder.idl
- Modules/webgpu/WebGPUComputePassEncoder.idl
- Modules/webgpu/WebGPUComputePipeline.idl
- Modules/webgpu/WebGPUComputePipelineDescriptor.idl
Modules/webgpu/WebGPUDevice.idl
Modules/webgpu/WebGPUPipelineDescriptorBase.idl
Modules/webgpu/WebGPUPipelineLayout.idl
Modified: trunk/Source/WebCore/ChangeLog (243456 => 243457)
--- trunk/Source/WebCore/ChangeLog 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/ChangeLog 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,5 +1,17 @@
2019-03-25 Truitt Savell <[email protected]>
+ Unreviewed, rolling out r243419.
+
+ Caused Mac WK2 testers to crash and become unresponsive.
+
+ Reverted changeset:
+
+ "[Web GPU] Prototype compute pipeline with MSL"
+ https://bugs.webkit.org/show_bug.cgi?id=196107
+ https://trac.webkit.org/changeset/243419
+
+2019-03-25 Truitt Savell <[email protected]>
+
Unreviewed, rolling out r243438.
243319 Caused Mac WK2 testers to crash and become
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (243456 => 243457)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2019-03-25 21:12:25 UTC (rev 243457)
@@ -367,9 +367,6 @@
$(PROJECT_DIR)/Modules/webgpu/WebGPUColor.idl
$(PROJECT_DIR)/Modules/webgpu/WebGPUCommandBuffer.idl
$(PROJECT_DIR)/Modules/webgpu/WebGPUCommandEncoder.idl
-$(PROJECT_DIR)/Modules/webgpu/WebGPUComputePassEncoder.idl
-$(PROJECT_DIR)/Modules/webgpu/WebGPUComputePipeline.idl
-$(PROJECT_DIR)/Modules/webgpu/WebGPUComputePipelineDescriptor.idl
$(PROJECT_DIR)/Modules/webgpu/WebGPUDevice.idl
$(PROJECT_DIR)/Modules/webgpu/WebGPUIndexFormat.idl
$(PROJECT_DIR)/Modules/webgpu/WebGPUInputStateDescriptor.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (243456 => 243457)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1931,12 +1931,6 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUCommandBuffer.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUCommandEncoder.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUCommandEncoder.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePassEncoder.cpp
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePassEncoder.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePipeline.cpp
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePipeline.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePipelineDescriptor.cpp
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUComputePipelineDescriptor.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUDevice.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUDevice.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSWebGPUIndexFormat.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (243456 => 243457)
--- trunk/Source/WebCore/DerivedSources.make 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/DerivedSources.make 2019-03-25 21:12:25 UTC (rev 243457)
@@ -407,9 +407,6 @@
$(WebCore)/Modules/webgpu/WebGPUBufferBinding.idl \
$(WebCore)/Modules/webgpu/WebGPUCommandBuffer.idl \
$(WebCore)/Modules/webgpu/WebGPUCommandEncoder.idl \
- $(WebCore)/Modules/webgpu/WebGPUComputePassEncoder.idl \
- $(WebCore)/Modules/webgpu/WebGPUComputePipeline.idl \
- $(WebCore)/Modules/webgpu/WebGPUComputePipelineDescriptor.idl \
$(WebCore)/Modules/webgpu/WebGPUDevice.idl \
$(WebCore)/Modules/webgpu/WebGPUQueue.idl \
$(WebCore)/Modules/webgpu/WebGPUPipelineDescriptorBase.idl \
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -29,7 +29,6 @@
#include "WHLSLNameContext.h"
#include "WHLSLVisitor.h"
-#include <wtf/HashSet.h>
namespace WebCore {
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -28,11 +28,9 @@
#if ENABLE(WEBGPU)
-#include "GPUComputePassEncoder.h"
#include "GPURenderPassDescriptor.h"
#include "GPURenderPassEncoder.h"
#include "WebGPUBuffer.h"
-#include "WebGPUComputePassEncoder.h"
#include "WebGPURenderPassDescriptor.h"
#include "WebGPURenderPassEncoder.h"
#include "WebGPUTexture.h"
@@ -78,26 +76,16 @@
{
if (!m_commandBuffer) {
LOG(WebGPU, "WebGPUCommandEncoder::beginRenderPass(): Invalid operation!");
- return WebGPURenderPassEncoder::create(nullptr);
+ return WebGPURenderPassEncoder::create(*this, nullptr);
}
auto gpuDescriptor = descriptor.tryCreateGPURenderPassDescriptor();
if (!gpuDescriptor)
- return WebGPURenderPassEncoder::create(nullptr);
+ return WebGPURenderPassEncoder::create(*this, nullptr);
auto encoder = GPURenderPassEncoder::tryCreate(makeRef(*m_commandBuffer), WTFMove(*gpuDescriptor));
- return WebGPURenderPassEncoder::create(WTFMove(encoder));
+ return WebGPURenderPassEncoder::create(*this, WTFMove(encoder));
}
-Ref<WebGPUComputePassEncoder> WebGPUCommandEncoder::beginComputePass()
-{
- if (!m_commandBuffer) {
- LOG(WebGPU, "WebGPUCommandEncoder::beginComputePass(): Invalid operation!");
- return WebGPUComputePassEncoder::create(nullptr);
- }
- auto encoder = GPUComputePassEncoder::tryCreate(makeRef(*m_commandBuffer));
- return WebGPUComputePassEncoder::create(WTFMove(encoder));
-}
-
void WebGPUCommandEncoder::copyBufferToBuffer(const WebGPUBuffer& src, unsigned long srcOffset, const WebGPUBuffer& dst, unsigned long dstOffset, unsigned long size)
{
if (!m_commandBuffer) {
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -35,7 +35,6 @@
namespace WebCore {
class WebGPUBuffer;
-class WebGPUComputePassEncoder;
class WebGPURenderPassEncoder;
class WebGPUTexture;
@@ -59,7 +58,6 @@
static Ref<WebGPUCommandEncoder> create(RefPtr<GPUCommandBuffer>&&);
Ref<WebGPURenderPassEncoder> beginRenderPass(WebGPURenderPassDescriptor&&);
- Ref<WebGPUComputePassEncoder> beginComputePass();
void copyBufferToBuffer(const WebGPUBuffer&, unsigned long srcOffset, const WebGPUBuffer&, unsigned long dstOffset, unsigned long size);
void copyBufferToTexture(const WebGPUBufferCopyView&, const WebGPUTextureCopyView&, const GPUExtent3D&);
void copyTextureToBuffer(const WebGPUTextureCopyView&, const WebGPUBufferCopyView&, const GPUExtent3D&);
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl 2019-03-25 21:12:25 UTC (rev 243457)
@@ -56,7 +56,6 @@
InterfaceName=GPUCommandEncoder
] interface WebGPUCommandEncoder {
WebGPURenderPassEncoder beginRenderPass(WebGPURenderPassDescriptor descriptor);
- WebGPUComputePassEncoder beginComputePass();
void copyBufferToBuffer(
WebGPUBuffer src,
@@ -81,4 +80,7 @@
GPUExtent3D copySize);
WebGPUCommandBuffer finish();
+
+ // Not Yet Implemented
+ // WebGPUComputePassEncoder beginComputePass();
};
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,83 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "WebGPUComputePassEncoder.h"
-
-#if ENABLE(WEBGPU)
-
-#include "GPUComputePassEncoder.h"
-#include "GPUProgrammablePassEncoder.h"
-#include "WebGPUComputePipeline.h"
-
-namespace WebCore {
-
-Ref<WebGPUComputePassEncoder> WebGPUComputePassEncoder::create(RefPtr<GPUComputePassEncoder>&& encoder)
-{
- return adoptRef(*new WebGPUComputePassEncoder(WTFMove(encoder)));
-}
-
-WebGPUComputePassEncoder::WebGPUComputePassEncoder(RefPtr<GPUComputePassEncoder>&& encoder)
- : m_passEncoder { WTFMove(encoder) }
-{
-}
-
-void WebGPUComputePassEncoder::setPipeline(const WebGPUComputePipeline& pipeline)
-{
- if (!m_passEncoder) {
- LOG(WebGPU, "GPUComputePassEncoder::setPipeline(): Invalid operation!");
- return;
- }
- if (!pipeline.computePipeline()) {
- LOG(WebGPU, "GPUComputePassEncoder::setPipeline(): Invalid pipeline!");
- return;
- }
- m_passEncoder->setPipeline(makeRef(*pipeline.computePipeline()));
-}
-
-void WebGPUComputePassEncoder::dispatch(unsigned x, unsigned y, unsigned z)
-{
- if (!m_passEncoder) {
- LOG(WebGPU, "GPUComputePassEncoder::dispatch(): Invalid operation!");
- return;
- }
-
- // FIXME: Add Web GPU validation.
- m_passEncoder->dispatch(x, y, z);
-}
-
-GPUProgrammablePassEncoder* WebGPUComputePassEncoder::passEncoder()
-{
- return m_passEncoder.get();
-}
-
-const GPUProgrammablePassEncoder* WebGPUComputePassEncoder::passEncoder() const
-{
- return m_passEncoder.get();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.h (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,57 +0,0 @@
-/*
- * 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 "WebGPUProgrammablePassEncoder.h"
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class GPUComputePassEncoder;
-class GPUProgrammablePassEncoder;
-class WebGPUComputePipeline;
-
-class WebGPUComputePassEncoder : public WebGPUProgrammablePassEncoder {
-public:
- static Ref<WebGPUComputePassEncoder> create(RefPtr<GPUComputePassEncoder>&&);
-
- void setPipeline(const WebGPUComputePipeline&);
- void dispatch(unsigned x, unsigned y, unsigned z);
-
-private:
- WebGPUComputePassEncoder(RefPtr<GPUComputePassEncoder>&&);
-
- GPUProgrammablePassEncoder* passEncoder() final;
- const GPUProgrammablePassEncoder* passEncoder() const final;
-
- RefPtr<GPUComputePassEncoder> m_passEncoder;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.idl (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.idl 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.idl 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
-
-typedef unsigned long u32;
-
-[
- Conditional=WEBGPU,
- EnabledAtRuntime=WebGPU,
- InterfaceName=GPUComputePassEncoder,
- JSGenerateToJSObject
-] interface WebGPUComputePassEncoder : WebGPUProgrammablePassEncoder {
- void setPipeline(WebGPUComputePipeline pipeline);
- void dispatch(u32 x, u32 y, u32 z);
-
- // TODO add missing commands
-};
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "WebGPUComputePipeline.h"
-
-#if ENABLE(WEBGPU)
-
-namespace WebCore {
-
-Ref<WebGPUComputePipeline> WebGPUComputePipeline::create(RefPtr<GPUComputePipeline>&& pipeline)
-{
- return adoptRef(*new WebGPUComputePipeline(WTFMove(pipeline)));
-}
-
-WebGPUComputePipeline::WebGPUComputePipeline(RefPtr<GPUComputePipeline>&& pipeline)
- : m_computePipeline { WTFMove(pipeline) }
-{
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.h (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,50 +0,0 @@
-/*
- * 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 "GPUComputePipeline.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class WebGPUComputePipeline : public RefCounted<WebGPUComputePipeline> {
-public:
- static Ref<WebGPUComputePipeline> create(RefPtr<GPUComputePipeline>&&);
-
- const GPUComputePipeline* computePipeline() const { return m_computePipeline.get(); }
-
-private:
- WebGPUComputePipeline(RefPtr<GPUComputePipeline>&&);
-
- RefPtr<GPUComputePipeline> m_computePipeline;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.idl (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.idl 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipeline.idl 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,33 +0,0 @@
-/*
- * 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,
- ImplementationLacksVTable,
- InterfaceName=GPUComputePipeline
-] interface WebGPUComputePipeline {
-};
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "WebGPUComputePipelineDescriptor.h"
-
-#if ENABLE(WEBGPU)
-
-#include "GPUComputePipelineDescriptor.h"
-#include "Logging.h"
-
-namespace WebCore {
-
-Optional<GPUComputePipelineDescriptor> WebGPUComputePipelineDescriptor::tryCreateGPUComputePipelineDescriptor() const
-{
- auto pipelineLayout = layout ? makeRefPtr(layout->pipelineLayout()) : nullptr;
-
- auto compute = computeStage.tryCreateGPUPipelineStageDescriptor();
- if (!compute) {
- LOG(WebGPU, "GPUDevice::createComputePipeline(): Invalid GPUPipelineStageDescriptor!");
- return WTF::nullopt;
- }
-
- return GPUComputePipelineDescriptor { WTFMove(pipelineLayout), WTFMove(*compute) };
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.h (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,46 +0,0 @@
-/*
- * 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 "WebGPUPipelineDescriptorBase.h"
-#include "WebGPUPipelineStageDescriptor.h"
-#include <wtf/Optional.h>
-
-namespace WebCore {
-
-struct GPUComputePipelineDescriptor;
-
-struct WebGPUComputePipelineDescriptor : WebGPUPipelineDescriptorBase {
- Optional<GPUComputePipelineDescriptor> tryCreateGPUComputePipelineDescriptor() const;
-
- WebGPUPipelineStageDescriptor computeStage;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.idl (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.idl 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUComputePipelineDescriptor.idl 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,32 +0,0 @@
-/*
- * 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 WebGPUComputePipelineDescriptor : WebGPUPipelineDescriptorBase {
- required WebGPUPipelineStageDescriptor computeStage;
-};
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -49,8 +49,6 @@
#include "WebGPUBuffer.h"
#include "WebGPUBufferBinding.h"
#include "WebGPUCommandEncoder.h"
-#include "WebGPUComputePipeline.h"
-#include "WebGPUComputePipelineDescriptor.h"
#include "WebGPUPipelineLayout.h"
#include "WebGPUPipelineLayoutDescriptor.h"
#include "WebGPUPipelineStageDescriptor.h"
@@ -139,16 +137,6 @@
return WebGPURenderPipeline::create(WTFMove(pipeline));
}
-Ref<WebGPUComputePipeline> WebGPUDevice::createComputePipeline(const WebGPUComputePipelineDescriptor& descriptor) const
-{
- auto gpuDescriptor = descriptor.tryCreateGPUComputePipelineDescriptor();
- if (!gpuDescriptor)
- return WebGPUComputePipeline::create(nullptr);
-
- auto pipeline = m_device->tryCreateComputePipeline(*gpuDescriptor);
- return WebGPUComputePipeline::create(WTFMove(pipeline));
-}
-
Ref<WebGPUCommandEncoder> WebGPUDevice::createCommandEncoder() const
{
auto commandBuffer = m_device->tryCreateCommandBuffer();
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -42,7 +42,6 @@
class WebGPUBindGroupLayout;
class WebGPUBuffer;
class WebGPUCommandEncoder;
-class WebGPUComputePipeline;
class WebGPUPipelineLayout;
class WebGPURenderPipeline;
class WebGPUSampler;
@@ -55,7 +54,6 @@
struct GPUSamplerDescriptor;
struct GPUTextureDescriptor;
struct WebGPUBindGroupDescriptor;
-struct WebGPUComputePipelineDescriptor;
struct WebGPUPipelineLayoutDescriptor;
struct WebGPURenderPipelineDescriptor;
struct WebGPUShaderModuleDescriptor;
@@ -77,7 +75,6 @@
RefPtr<WebGPUShaderModule> createShaderModule(WebGPUShaderModuleDescriptor&&) const;
Ref<WebGPURenderPipeline> createRenderPipeline(const WebGPURenderPipelineDescriptor&) const;
- Ref<WebGPUComputePipeline> createComputePipeline(const WebGPUComputePipelineDescriptor&) const;
Ref<WebGPUCommandEncoder> createCommandEncoder() const;
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl 2019-03-25 21:12:25 UTC (rev 243457)
@@ -53,7 +53,6 @@
WebGPUShaderModule createShaderModule(WebGPUShaderModuleDescriptor descriptor);
WebGPURenderPipeline createRenderPipeline(WebGPURenderPipelineDescriptor descriptor);
- WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor);
// FIXME: Currently, GPUCommandEncoderDescriptor is an empty dictionary.
WebGPUCommandEncoder createCommandEncoder(/*GPUCommandEncoderDescriptor descriptor*/);
@@ -66,6 +65,7 @@
// readonly attribute WebGPUExtensions extensions;
// readonly attribute WebGPULimits limits;
+ // WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor);
// WebGPUFence createFence(WebGPUFenceDescriptor descriptor);
// attribute WebGPULogCallback onLog;
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "WebGPUPipelineStageDescriptor.h"
-
-#if ENABLE(WEBGPU)
-
-namespace WebCore {
-
-Optional<GPUPipelineStageDescriptor> WebGPUPipelineStageDescriptor::tryCreateGPUPipelineStageDescriptor() const
-{
- if (!module || !module->module() || entryPoint.isEmpty())
- return WTF::nullopt;
-
- return GPUPipelineStageDescriptor { makeRef(*module->module()), *this };
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -31,9 +31,15 @@
#include "GPUProgrammablePassEncoder.h"
#include "Logging.h"
#include "WebGPUBindGroup.h"
+#include "WebGPURenderPipeline.h"
namespace WebCore {
+WebGPUProgrammablePassEncoder::WebGPUProgrammablePassEncoder(Ref<WebGPUCommandEncoder>&& creator)
+ : m_commandBuffer(WTFMove(creator))
+{
+}
+
void WebGPUProgrammablePassEncoder::endPass()
{
if (!passEncoder()) {
@@ -43,7 +49,7 @@
passEncoder()->endPass();
}
-void WebGPUProgrammablePassEncoder::setBindGroup(unsigned index, WebGPUBindGroup& bindGroup)
+void WebGPUProgrammablePassEncoder::setBindGroup(unsigned index, WebGPUBindGroup& bindGroup) const
{
if (!passEncoder()) {
LOG(WebGPU, "GPUProgrammablePassEncoder::setBindGroup(): Invalid operation!");
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -27,6 +27,7 @@
#if ENABLE(WEBGPU)
+#include "WebGPUCommandEncoder.h"
#include <wtf/RefCounted.h>
namespace WebCore {
@@ -33,6 +34,7 @@
class GPUProgrammablePassEncoder;
class WebGPUBindGroup;
+class WebGPURenderPipeline;
class WebGPUProgrammablePassEncoder : public RefCounted<WebGPUProgrammablePassEncoder> {
public:
@@ -39,13 +41,15 @@
virtual ~WebGPUProgrammablePassEncoder() = default;
void endPass();
- void setBindGroup(unsigned, WebGPUBindGroup&);
+ void setBindGroup(unsigned, WebGPUBindGroup&) const;
protected:
- WebGPUProgrammablePassEncoder() = default;
+ WebGPUProgrammablePassEncoder(Ref<WebGPUCommandEncoder>&&);
- virtual GPUProgrammablePassEncoder* passEncoder() = 0;
- virtual const GPUProgrammablePassEncoder* passEncoder() const = 0;
+ virtual GPUProgrammablePassEncoder* passEncoder() const = 0;
+
+private:
+ Ref<WebGPUCommandEncoder> m_commandBuffer;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -33,17 +33,17 @@
#include "GPURenderPassEncoder.h"
#include "Logging.h"
#include "WebGPUBuffer.h"
-#include "WebGPURenderPipeline.h"
namespace WebCore {
-Ref<WebGPURenderPassEncoder> WebGPURenderPassEncoder::create(RefPtr<GPURenderPassEncoder>&& encoder)
+Ref<WebGPURenderPassEncoder> WebGPURenderPassEncoder::create(Ref<WebGPUCommandEncoder>&& commandBuffer, RefPtr<GPURenderPassEncoder>&& encoder)
{
- return adoptRef(*new WebGPURenderPassEncoder(WTFMove(encoder)));
+ return adoptRef(*new WebGPURenderPassEncoder(WTFMove(commandBuffer), WTFMove(encoder)));
}
-WebGPURenderPassEncoder::WebGPURenderPassEncoder(RefPtr<GPURenderPassEncoder>&& encoder)
- : m_passEncoder { WTFMove(encoder) }
+WebGPURenderPassEncoder::WebGPURenderPassEncoder(Ref<WebGPUCommandEncoder>&& creator, RefPtr<GPURenderPassEncoder>&& encoder)
+ : WebGPUProgrammablePassEncoder(WTFMove(creator))
+ , m_passEncoder(WTFMove(encoder))
{
}
@@ -50,11 +50,11 @@
void WebGPURenderPassEncoder::setPipeline(const WebGPURenderPipeline& pipeline)
{
if (!m_passEncoder) {
- LOG(WebGPU, "GPURenderPassEncoder::setPipeline(): Invalid operation!");
+ LOG(WebGPU, "GPUProgrammablePassEncoder::setPipeline(): Invalid operation!");
return;
}
if (!pipeline.renderPipeline()) {
- LOG(WebGPU, "GPURenderPassEncoder::setPipeline(): Invalid pipeline!");
+ LOG(WebGPU, "GPUProgrammablePassEncoder::setPipeline(): Invalid pipeline!");
return;
}
m_passEncoder->setPipeline(makeRef(*pipeline.renderPipeline()));
@@ -108,16 +108,11 @@
m_passEncoder->draw(vertexCount, instanceCount, firstVertex, firstInstance);
}
-GPUProgrammablePassEncoder* WebGPURenderPassEncoder::passEncoder()
+GPUProgrammablePassEncoder* WebGPURenderPassEncoder::passEncoder() const
{
return m_passEncoder.get();
}
-const GPUProgrammablePassEncoder* WebGPURenderPassEncoder::passEncoder() const
-{
- return m_passEncoder.get();
-}
-
} // namespace WebCore
#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -28,6 +28,7 @@
#if ENABLE(WEBGPU)
#include "WebGPUProgrammablePassEncoder.h"
+
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -36,11 +37,10 @@
class GPUProgrammablePassEncoder;
class GPURenderPassEncoder;
class WebGPUBuffer;
-class WebGPURenderPipeline;
class WebGPURenderPassEncoder final : public WebGPUProgrammablePassEncoder {
public:
- static Ref<WebGPURenderPassEncoder> create(RefPtr<GPURenderPassEncoder>&&);
+ static Ref<WebGPURenderPassEncoder> create(Ref<WebGPUCommandEncoder>&&, RefPtr<GPURenderPassEncoder>&&);
void setPipeline(const WebGPURenderPipeline&);
void setVertexBuffers(unsigned long, Vector<RefPtr<WebGPUBuffer>>&&, Vector<unsigned long long>&&);
@@ -47,10 +47,9 @@
void draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance);
private:
- WebGPURenderPassEncoder(RefPtr<GPURenderPassEncoder>&&);
+ WebGPURenderPassEncoder(Ref<WebGPUCommandEncoder>&&, RefPtr<GPURenderPassEncoder>&&);
- GPUProgrammablePassEncoder* passEncoder() final;
- const GPUProgrammablePassEncoder* passEncoder() const final;
+ GPUProgrammablePassEncoder* passEncoder() const final;
RefPtr<GPURenderPassEncoder> m_passEncoder;
};
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -28,6 +28,8 @@
#if ENABLE(WEBGPU)
+#include "GPURenderPipeline.h"
+
namespace WebCore {
Ref<WebGPURenderPipeline> WebGPURenderPipeline::create(RefPtr<GPURenderPipeline>&& pipeline)
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -28,6 +28,7 @@
#if ENABLE(WEBGPU)
#include "GPURenderPipeline.h"
+
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.cpp (243456 => 243457)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -28,10 +28,16 @@
#if ENABLE(WEBGPU)
-#include "Logging.h"
-
namespace WebCore {
+Optional<GPUPipelineStageDescriptor> WebGPUPipelineStageDescriptor::tryCreateGPUPipelineStageDescriptor() const
+{
+ if (!module || !module->module() || entryPoint.isEmpty())
+ return WTF::nullopt;
+
+ return GPUPipelineStageDescriptor { makeRef(*module->module()), *this };
+}
+
Optional<GPURenderPipelineDescriptor> WebGPURenderPipelineDescriptor::tryCreateGPURenderPipelineDescriptor() const
{
auto pipelineLayout = layout ? makeRefPtr(layout->pipelineLayout()) : nullptr;
Modified: trunk/Source/WebCore/Sources.txt (243456 => 243457)
--- trunk/Source/WebCore/Sources.txt 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/Sources.txt 2019-03-25 21:12:25 UTC (rev 243457)
@@ -348,20 +348,16 @@
Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp
Modules/webgpu/WHLSL/WHLSLPrepare.cpp
Modules/webgpu/WebGPU.cpp
-Modules/webgpu/WebGPUAdapter.cpp
Modules/webgpu/WebGPUBindGroup.cpp
Modules/webgpu/WebGPUBindGroupDescriptor.cpp
+Modules/webgpu/WebGPUCommandBuffer.cpp
+Modules/webgpu/WebGPUCommandEncoder.cpp
+Modules/webgpu/WebGPUAdapter.cpp
Modules/webgpu/WebGPUBindGroupLayout.cpp
Modules/webgpu/WebGPUBuffer.cpp
-Modules/webgpu/WebGPUCommandBuffer.cpp
-Modules/webgpu/WebGPUCommandEncoder.cpp
-Modules/webgpu/WebGPUComputePassEncoder.cpp
-Modules/webgpu/WebGPUComputePipeline.cpp
-Modules/webgpu/WebGPUComputePipelineDescriptor.cpp
Modules/webgpu/WebGPUDevice.cpp
Modules/webgpu/WebGPUQueue.cpp
Modules/webgpu/WebGPUPipelineLayout.cpp
-Modules/webgpu/WebGPUPipelineStageDescriptor.cpp
Modules/webgpu/WebGPUProgrammablePassEncoder.cpp
Modules/webgpu/WebGPURenderPassDescriptor.cpp
Modules/webgpu/WebGPURenderPassEncoder.cpp
@@ -3336,9 +3332,6 @@
JSWebGPUBufferBinding.cpp
JSWebGPUCommandBuffer.cpp
JSWebGPUCommandEncoder.cpp
-JSWebGPUComputePassEncoder.cpp
-JSWebGPUComputePipeline.cpp
-JSWebGPUComputePipelineDescriptor.cpp
JSWebGPUDevice.cpp
JSWebGPUQueue.cpp
JSWebGPUPipelineDescriptorBase.cpp
Modified: trunk/Source/WebCore/SourcesCocoa.txt (243456 => 243457)
--- trunk/Source/WebCore/SourcesCocoa.txt 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2019-03-25 21:12:25 UTC (rev 243457)
@@ -322,8 +322,6 @@
platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm
platform/graphics/gpu/cocoa/GPUBufferMetal.mm
platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm
-platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm
-platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm
platform/graphics/gpu/cocoa/GPUDeviceMetal.mm
platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm
platform/graphics/gpu/cocoa/GPUQueueMetal.mm
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (243456 => 243457)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-25 21:12:25 UTC (rev 243457)
@@ -14009,9 +14009,6 @@
D003288621C9A4E500622AA6 /* GPUPipelineLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUPipelineLayout.h; sourceTree = "<group>"; };
D003288721C9A4E500622AA6 /* GPUPipelineLayout.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUPipelineLayout.cpp; sourceTree = "<group>"; };
D003914122248D400098998C /* GPUProgrammablePassEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUProgrammablePassEncoder.cpp; sourceTree = "<group>"; };
- D00D77FD2242ED450043F12C /* WebGPUComputePassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUComputePassEncoder.h; sourceTree = "<group>"; };
- D00D77FE2242ED450043F12C /* WebGPUComputePassEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUComputePassEncoder.cpp; sourceTree = "<group>"; };
- D00D77FF2242ED450043F12C /* WebGPUComputePassEncoder.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUComputePassEncoder.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>"; };
@@ -14151,18 +14148,6 @@
D087CE3E21ACA94200BDE174 /* GPUSwapChainMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUSwapChainMetal.mm; sourceTree = "<group>"; };
D087CE3F21ACA94200BDE174 /* GPUTextureMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUTextureMetal.mm; sourceTree = "<group>"; };
D087CE4021ACA94200BDE174 /* GPUShaderModuleMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUShaderModuleMetal.mm; sourceTree = "<group>"; };
- D08903342240601D00F3F440 /* WebGPUComputePipelineDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUComputePipelineDescriptor.h; sourceTree = "<group>"; };
- D08903352240601D00F3F440 /* WebGPUComputePipelineDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUComputePipelineDescriptor.idl; sourceTree = "<group>"; };
- D0890337224061AC00F3F440 /* WebGPUPipelineStageDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUPipelineStageDescriptor.cpp; sourceTree = "<group>"; };
- D08903382240628900F3F440 /* WebGPUComputePipelineDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUComputePipelineDescriptor.cpp; sourceTree = "<group>"; };
- D08903392240642D00F3F440 /* GPUComputePipelineDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUComputePipelineDescriptor.h; sourceTree = "<group>"; };
- D089033A224179B500F3F440 /* GPUComputePipeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUComputePipeline.h; sourceTree = "<group>"; };
- D089033B224179B500F3F440 /* GPUComputePipelineMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUComputePipelineMetal.mm; sourceTree = "<group>"; };
- D089033C2241A99F00F3F440 /* WebGPUComputePipeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUComputePipeline.h; sourceTree = "<group>"; };
- D089033D2241A99F00F3F440 /* WebGPUComputePipeline.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUComputePipeline.cpp; sourceTree = "<group>"; };
- D089033E2241A99F00F3F440 /* WebGPUComputePipeline.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUComputePipeline.idl; sourceTree = "<group>"; };
- D089033F2241CE4600F3F440 /* GPUComputePassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUComputePassEncoder.h; sourceTree = "<group>"; };
- D08903402241CE4600F3F440 /* GPUComputePassEncoderMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUComputePassEncoderMetal.mm; sourceTree = "<group>"; };
D08AA02D220D0B9C0058C502 /* GPULoadOp.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPULoadOp.idl; sourceTree = "<group>"; };
D08AA02F220D0BD50058C502 /* GPULoadOp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPULoadOp.h; sourceTree = "<group>"; };
D08AA031220D0CE60058C502 /* GPUStoreOp.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUStoreOp.idl; sourceTree = "<group>"; };
@@ -18608,9 +18593,6 @@
D0ADB28B2237842E00A22935 /* GPUColorStateDescriptor.h */,
312FF8BD21A4C2F100EB199D /* GPUCommandBuffer.h */,
D03C849C21FFC7FC0002227F /* GPUCompareFunction.h */,
- D089033F2241CE4600F3F440 /* GPUComputePassEncoder.h */,
- D089033A224179B500F3F440 /* GPUComputePipeline.h */,
- D08903392240642D00F3F440 /* GPUComputePipelineDescriptor.h */,
D03C849A21FFC6670002227F /* GPUDepthStencilStateDescriptor.h */,
312FF8BF21A4C2F100EB199D /* GPUDevice.cpp */,
312FF8BE21A4C2F100EB199D /* GPUDevice.h */,
@@ -26265,15 +26247,6 @@
D0EACF7721937228000FA75C /* WebGPUCommandEncoder.cpp */,
D0EACF7621937228000FA75C /* WebGPUCommandEncoder.h */,
D0EACF7821937228000FA75C /* WebGPUCommandEncoder.idl */,
- D00D77FE2242ED450043F12C /* WebGPUComputePassEncoder.cpp */,
- D00D77FD2242ED450043F12C /* WebGPUComputePassEncoder.h */,
- D00D77FF2242ED450043F12C /* WebGPUComputePassEncoder.idl */,
- D089033D2241A99F00F3F440 /* WebGPUComputePipeline.cpp */,
- D089033C2241A99F00F3F440 /* WebGPUComputePipeline.h */,
- D089033E2241A99F00F3F440 /* WebGPUComputePipeline.idl */,
- D08903382240628900F3F440 /* WebGPUComputePipelineDescriptor.cpp */,
- D08903342240601D00F3F440 /* WebGPUComputePipelineDescriptor.h */,
- D08903352240601D00F3F440 /* WebGPUComputePipelineDescriptor.idl */,
D00F595321701D8C000D71DB /* WebGPUDevice.cpp */,
D00F595221701D8C000D71DB /* WebGPUDevice.h */,
D00F595421701D8C000D71DB /* WebGPUDevice.idl */,
@@ -26285,7 +26258,6 @@
D05A99E621C9BF2C00032B75 /* WebGPUPipelineLayout.idl */,
D05A99E121C9B50F00032B75 /* WebGPUPipelineLayoutDescriptor.h */,
D05A99E221C9B50F00032B75 /* WebGPUPipelineLayoutDescriptor.idl */,
- D0890337224061AC00F3F440 /* WebGPUPipelineStageDescriptor.cpp */,
D0C419EB2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.h */,
D0C419EC2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.idl */,
D0EACF9221940A5B000FA75C /* WebGPUProgrammablePassEncoder.cpp */,
@@ -26335,8 +26307,6 @@
D085E64A2236DEAE00C3E1E2 /* GPUBindGroupMetal.mm */,
D0D8649121B760C4003C983C /* GPUBufferMetal.mm */,
D087CE3821ACA94200BDE174 /* GPUCommandBufferMetal.mm */,
- D08903402241CE4600F3F440 /* GPUComputePassEncoderMetal.mm */,
- D089033B224179B500F3F440 /* GPUComputePipelineMetal.mm */,
D087CE3C21ACA94200BDE174 /* GPUDeviceMetal.mm */,
D087CE3B21ACA94200BDE174 /* GPUProgrammablePassEncoderMetal.mm */,
D087CE3921ACA94200BDE174 /* GPUQueueMetal.mm */,
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (243456 => 243457)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -86,8 +86,6 @@
macro(GPUShaderModule) \
macro(GPUCommandBuffer) \
macro(GPUCommandEncoder) \
- macro(GPUComputePassEncoder) \
- macro(GPUComputePipeline) \
macro(GPUShaderStageBit) \
macro(GPUSwapChain) \
macro(GPUTextureUsage) \
Modified: trunk/Source/WebCore/platform/cocoa/VideoFullscreenModel.h (243456 => 243457)
--- trunk/Source/WebCore/platform/cocoa/VideoFullscreenModel.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/cocoa/VideoFullscreenModel.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -34,7 +34,6 @@
#include "MediaPlayerEnums.h"
#include "PlaybackSessionModel.h"
#include <wtf/CompletionHandler.h>
-#include <wtf/WeakPtr.h>
#if PLATFORM(IOS_FAMILY)
OBJC_CLASS AVPlayerViewController;
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroup.h (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroup.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroup.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -27,12 +27,12 @@
#if ENABLE(WEBGPU)
-#include "GPUBuffer.h"
-#include "GPUTexture.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
+#include "GPUBuffer.h"
+#include "GPUTexture.h"
OBJC_PROTOCOL(MTLBuffer);
@@ -45,9 +45,8 @@
static RefPtr<GPUBindGroup> tryCreate(const GPUBindGroupDescriptor&);
#if USE(METAL)
- const MTLBuffer *vertexArgsBuffer() const { return m_vertexArgsBuffer.get(); }
- const MTLBuffer *fragmentArgsBuffer() const { return m_fragmentArgsBuffer.get(); }
- const MTLBuffer *computeArgsBuffer() const { return m_computeArgsBuffer.get(); }
+ MTLBuffer *vertexArgsBuffer() { return m_vertexArgsBuffer.get(); }
+ MTLBuffer *fragmentArgsBuffer() { return m_fragmentArgsBuffer.get(); }
#endif
const Vector<Ref<GPUBuffer>>& boundBuffers() const { return m_boundBuffers; }
const Vector<Ref<GPUTexture>>& boundTextures() const { return m_boundTextures; }
@@ -54,11 +53,10 @@
private:
#if USE(METAL)
- GPUBindGroup(RetainPtr<MTLBuffer>&& vertexBuffer, RetainPtr<MTLBuffer>&& fragmentBuffer, RetainPtr<MTLBuffer>&& computeArgsBuffer, Vector<Ref<GPUBuffer>>&&, Vector<Ref<GPUTexture>>&&);
+ GPUBindGroup(RetainPtr<MTLBuffer>&& vertexBuffer, RetainPtr<MTLBuffer>&& fragmentBuffer, Vector<Ref<GPUBuffer>>&&, Vector<Ref<GPUTexture>>&&);
RetainPtr<MTLBuffer> m_vertexArgsBuffer;
RetainPtr<MTLBuffer> m_fragmentArgsBuffer;
- RetainPtr<MTLBuffer> m_computeArgsBuffer;
#endif
Vector<Ref<GPUBuffer>> m_boundBuffers;
Vector<Ref<GPUTexture>> m_boundTextures;
Deleted: trunk/Source/WebCore/platform/graphics/gpu/GPUComputePassEncoder.h (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUComputePassEncoder.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUComputePassEncoder.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,68 +0,0 @@
-/*
- * 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 "GPUComputePipeline.h"
-#include "GPUProgrammablePassEncoder.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/RetainPtr.h>
-
-OBJC_PROTOCOL(MTLComputeCommandEncoder);
-
-namespace WebCore {
-
-using PlatformComputePassEncoder = MTLComputeCommandEncoder;
-using PlatformComputePassEncoderSmartPtr = RetainPtr<MTLComputeCommandEncoder>;
-
-class GPUComputePassEncoder : public GPUProgrammablePassEncoder {
-public:
- static RefPtr<GPUComputePassEncoder> tryCreate(Ref<GPUCommandBuffer>&&);
-
- void setPipeline(Ref<const GPUComputePipeline>&&);
- void dispatch(unsigned x, unsigned y, unsigned z);
-
-private:
- GPUComputePassEncoder(Ref<GPUCommandBuffer>&&, PlatformComputePassEncoderSmartPtr&&);
- ~GPUComputePassEncoder() { endPass(); }
-
- // GPUProgrammablePassEncoder
- const PlatformProgrammablePassEncoder* platformPassEncoder() const final;
- void invalidateEncoder() final { m_platformComputePassEncoder = nullptr; }
-#if USE(METAL)
- void useResource(const MTLResource *, unsigned usage) final;
- void setComputeBuffer(const MTLBuffer *, unsigned offset, unsigned index) final;
-#endif
-
- PlatformComputePassEncoderSmartPtr m_platformComputePassEncoder;
- RefPtr<const GPUComputePipeline> m_pipeline;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/platform/graphics/gpu/GPUComputePipeline.h (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUComputePipeline.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUComputePipeline.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/RetainPtr.h>
-
-OBJC_PROTOCOL(MTLComputePipelineState);
-
-namespace WebCore {
-
-class GPUDevice;
-
-struct GPUComputePipelineDescriptor;
-
-using PlatformComputePipeline = MTLComputePipelineState;
-using PlatformComputePipelineSmartPtr = RetainPtr<MTLComputePipelineState>;
-
-class GPUComputePipeline : public RefCounted<GPUComputePipeline> {
-public:
- static RefPtr<GPUComputePipeline> tryCreate(const GPUDevice&, const GPUComputePipelineDescriptor&);
-
- const PlatformComputePipeline* platformComputePipeline() const { return m_platformComputePipeline.get(); }
-
-private:
- GPUComputePipeline(PlatformComputePipelineSmartPtr&&);
-
- PlatformComputePipelineSmartPtr m_platformComputePipeline;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/platform/graphics/gpu/GPUComputePipelineDescriptor.h (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUComputePipelineDescriptor.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUComputePipelineDescriptor.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,47 +0,0 @@
-/*
- * 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 "GPUPipelineDescriptorBase.h"
-#include "GPUPipelineStageDescriptor.h"
-
-namespace WebCore {
-
-struct GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
- GPUComputePipelineDescriptor(RefPtr<GPUPipelineLayout>&& layout, GPUPipelineStageDescriptor&& compute)
- : GPUPipelineDescriptorBase { WTFMove(layout) }
- , computeStage { WTFMove(compute) }
- {
- }
-
- GPUPipelineStageDescriptor computeStage;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp 2019-03-25 21:12:25 UTC (rev 243457)
@@ -33,8 +33,6 @@
#include "GPUBuffer.h"
#include "GPUBufferDescriptor.h"
#include "GPUCommandBuffer.h"
-#include "GPUComputePipeline.h"
-#include "GPUComputePipelineDescriptor.h"
#include "GPUPipelineLayout.h"
#include "GPUPipelineLayoutDescriptor.h"
#include "GPURenderPipeline.h"
@@ -44,7 +42,6 @@
#include "GPUShaderModule.h"
#include "GPUShaderModuleDescriptor.h"
#include "GPUSwapChain.h"
-#include "GPUSwapChainDescriptor.h"
#include "GPUTexture.h"
#include "GPUTextureDescriptor.h"
#include <wtf/Optional.h>
@@ -86,11 +83,6 @@
return GPURenderPipeline::create(*this, WTFMove(descriptor));
}
-RefPtr<GPUComputePipeline> GPUDevice::tryCreateComputePipeline(const GPUComputePipelineDescriptor& descriptor) const
-{
- return GPUComputePipeline::tryCreate(*this, descriptor);
-}
-
RefPtr<GPUCommandBuffer> GPUDevice::tryCreateCommandBuffer() const
{
return GPUCommandBuffer::tryCreate(*this);
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -28,6 +28,7 @@
#if ENABLE(WEBGPU)
#include "GPUQueue.h"
+#include "GPUSwapChainDescriptor.h"
#include <wtf/RefCounted.h>
#include <wtf/RetainPtr.h>
#include <wtf/WeakPtr.h>
@@ -39,7 +40,6 @@
class GPUBindGroupLayout;
class GPUBuffer;
class GPUCommandBuffer;
-class GPUComputePipeline;
class GPUPipelineLayout;
class GPURenderPipeline;
class GPUSampler;
@@ -49,13 +49,11 @@
struct GPUBindGroupLayoutDescriptor;
struct GPUBufferDescriptor;
-struct GPUComputePipelineDescriptor;
struct GPUPipelineLayoutDescriptor;
struct GPURenderPipelineDescriptor;
struct GPURequestAdapterOptions;
struct GPUSamplerDescriptor;
struct GPUShaderModuleDescriptor;
-struct GPUSwapChainDescriptor;
struct GPUTextureDescriptor;
using PlatformDevice = MTLDevice;
@@ -74,7 +72,6 @@
RefPtr<GPUShaderModule> createShaderModule(GPUShaderModuleDescriptor&&) const;
RefPtr<GPURenderPipeline> createRenderPipeline(GPURenderPipelineDescriptor&&) const;
- RefPtr<GPUComputePipeline> tryCreateComputePipeline(const GPUComputePipelineDescriptor&) const;
RefPtr<GPUCommandBuffer> tryCreateCommandBuffer() const;
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUPipelineDescriptorBase.h (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUPipelineDescriptorBase.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUPipelineDescriptorBase.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -29,7 +29,7 @@
#include "GPUPipelineLayout.h"
#include "GPUPipelineStageDescriptor.h"
-#include <wtf/RefPtr.h>
+
#include <wtf/Vector.h>
namespace WebCore {
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -28,7 +28,6 @@
#if ENABLE(WEBGPU)
#include "GPUBindGroupBinding.h"
-#include "GPUCommandBuffer.h"
#include <wtf/RefCounted.h>
#if USE(METAL)
@@ -40,6 +39,7 @@
namespace WebCore {
class GPUBindGroup;
+class GPUCommandBuffer;
class GPURenderPipeline;
using PlatformProgrammablePassEncoder = MTLCommandEncoder;
@@ -48,7 +48,7 @@
public:
virtual ~GPUProgrammablePassEncoder() = default;
- void endPass();
+ virtual void endPass();
void setBindGroup(unsigned, GPUBindGroup&);
protected:
@@ -55,18 +55,15 @@
GPUProgrammablePassEncoder(Ref<GPUCommandBuffer>&&);
GPUCommandBuffer& commandBuffer() const { return m_commandBuffer.get(); }
- virtual const PlatformProgrammablePassEncoder* platformPassEncoder() const = 0;
+ virtual PlatformProgrammablePassEncoder* platformPassEncoder() const = 0;
private:
- virtual void invalidateEncoder() = 0;
#if USE(METAL)
- virtual void useResource(const MTLResource *, unsigned) = 0;
+ virtual void useResource(MTLResource *, unsigned) = 0;
// Render command encoder methods.
- virtual void setVertexBuffer(const MTLBuffer *, unsigned, unsigned) { }
- virtual void setFragmentBuffer(const MTLBuffer *, unsigned, unsigned) { }
- // Compute.
- virtual void setComputeBuffer(const MTLBuffer *, unsigned, unsigned) { }
+ virtual void setVertexBuffer(MTLBuffer *, unsigned, unsigned) { }
+ virtual void setFragmentBuffer(MTLBuffer *, unsigned, unsigned) { }
#endif // USE(METAL)
Ref<GPUCommandBuffer> m_commandBuffer;
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -51,21 +51,23 @@
public:
static RefPtr<GPURenderPassEncoder> tryCreate(Ref<GPUCommandBuffer>&&, GPURenderPassDescriptor&&);
+ void endPass() final;
void setPipeline(Ref<const GPURenderPipeline>&&);
+
void setVertexBuffers(unsigned long, Vector<Ref<GPUBuffer>>&&, Vector<unsigned long long>&&);
void draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance);
private:
GPURenderPassEncoder(Ref<GPUCommandBuffer>&&, PlatformRenderPassEncoderSmartPtr&&);
- ~GPURenderPassEncoder() { endPass(); }
+ ~GPURenderPassEncoder() { endPass(); } // Ensure that encoding has ended before release.
+ PlatformProgrammablePassEncoder* platformPassEncoder() const final;
+
+#if USE(METAL)
// GPUProgrammablePassEncoder
- const PlatformProgrammablePassEncoder* platformPassEncoder() const final;
- void invalidateEncoder() final { m_platformRenderPassEncoder = nullptr; }
-#if USE(METAL)
- void useResource(const MTLResource *, unsigned usage) final;
- void setVertexBuffer(const MTLBuffer *, unsigned offset, unsigned index) final;
- void setFragmentBuffer(const MTLBuffer *, unsigned offset, unsigned index) final;
+ void useResource(MTLResource *, unsigned usage) final;
+ void setVertexBuffer(MTLBuffer *, unsigned offset, unsigned index) final;
+ void setFragmentBuffer(MTLBuffer *, unsigned offset, unsigned index) final;
#endif // USE(METAL)
PlatformRenderPassEncoderSmartPtr m_platformRenderPassEncoder;
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h 2019-03-25 21:12:25 UTC (rev 243457)
@@ -61,6 +61,7 @@
RetainPtr<MTLDepthStencilState> m_depthStencilState;
#endif // USE(METAL)
PlatformRenderPipelineSmartPtr m_platformRenderPipeline;
+ RefPtr<GPUPipelineLayout> m_layout;
GPUPrimitiveTopology m_primitiveTopology;
};
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm 2019-03-25 21:12:25 UTC (rev 243457)
@@ -31,7 +31,9 @@
#import "GPUBindGroupBinding.h"
#import "GPUBindGroupDescriptor.h"
#import "GPUBindGroupLayout.h"
+#import "GPUBuffer.h"
#import "GPUSampler.h"
+#import "GPUTexture.h"
#import "Logging.h"
#import <Metal/Metal.h>
#import <wtf/BlockObjCExceptions.h>
@@ -75,7 +77,7 @@
END_BLOCK_OBJC_EXCEPTIONS;
}
-static MTLSamplerState *tryGetResourceAsMTLSamplerState(const GPUBindingResource& resource, const char* const functionName)
+static RefPtr<GPUSampler> tryGetResourceAsSampler(const GPUBindingResource& resource, const char* const functionName)
{
#if LOG_DISABLED
UNUSED_PARAM(functionName);
@@ -84,11 +86,12 @@
LOG(WebGPU, "%s: Resource is not a GPUSampler!", functionName);
return nullptr;
}
- auto samplerState = WTF::get<Ref<GPUSampler>>(resource)->platformSampler();
- if (!samplerState)
+ auto& samplerRef = WTF::get<Ref<GPUSampler>>(resource);
+ if (!samplerRef->platformSampler()) {
LOG(WebGPU, "%s: Invalid MTLSamplerState in GPUSampler binding!", functionName);
-
- return samplerState;
+ return nullptr;
+ }
+ return samplerRef.copyRef();
}
static void setSamplerOnEncoder(MTLArgumentEncoder *argumentEncoder, MTLSamplerState *sampler, unsigned index)
@@ -132,7 +135,7 @@
MTLArgumentEncoder *vertexEncoder = descriptor.layout->vertexEncoder();
MTLArgumentEncoder *fragmentEncoder = descriptor.layout->fragmentEncoder();
- MTLArgumentEncoder *computeEncoder = descriptor.layout->computeEncoder();
+ // FIXME: Finish support for compute.
RetainPtr<MTLBuffer> vertexArgsBuffer;
if (vertexEncoder && !(vertexArgsBuffer = tryCreateArgumentBuffer(vertexEncoder))) {
@@ -144,11 +147,6 @@
LOG(WebGPU, "%s: Unable to create MTLBuffer for fragment argument buffer!", functionName);
return nullptr;
}
- RetainPtr<MTLBuffer> computeArgsBuffer;
- if (computeEncoder && !(computeArgsBuffer = tryCreateArgumentBuffer(computeEncoder))) {
- LOG(WebGPU, "%s: Unable to create MTLBuffer for compute argument buffer!", functionName);
- return nullptr;
- }
Vector<Ref<GPUBuffer>> boundBuffers;
Vector<Ref<GPUTexture>> boundTextures;
@@ -156,60 +154,45 @@
// Set each resource on each MTLArgumentEncoder it should be visible on.
const auto& layoutBindingsMap = descriptor.layout->bindingsMap();
for (const auto& resourceBinding : descriptor.bindings) {
- auto index = resourceBinding.binding;
- auto layoutIterator = layoutBindingsMap.find(index);
+ auto layoutIterator = layoutBindingsMap.find(resourceBinding.binding);
if (layoutIterator == layoutBindingsMap.end()) {
- LOG(WebGPU, "%s: GPUBindGroupBinding %lu not found in GPUBindGroupLayout!", functionName, index);
+ LOG(WebGPU, "%s: GPUBindGroupBinding %lu not found in GPUBindGroupLayout!", functionName, resourceBinding.binding);
return nullptr;
}
auto layoutBinding = layoutIterator->value;
if (layoutBinding.visibility == GPUShaderStageBit::Flags::None)
continue;
-
- bool isForVertex = layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex;
- bool isForFragment = layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment;
- bool isForCompute = layoutBinding.visibility & GPUShaderStageBit::Flags::Compute;
-
- if (isForVertex && !vertexEncoder) {
- LOG(WebGPU, "%s: No vertex argument encoder found for binding %lu!", functionName, index);
+ if ((layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex) && !vertexEncoder) {
+ LOG(WebGPU, "%s: No vertex encoder found for binding %lu!", functionName, resourceBinding.binding);
return nullptr;
}
- if (isForFragment && !fragmentEncoder) {
- LOG(WebGPU, "%s: No fragment argument encoder found for binding %lu!", functionName, index);
+ if ((layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment) && !fragmentEncoder) {
+ LOG(WebGPU, "%s: No fragment encoder found for binding %lu!", functionName, resourceBinding.binding);
return nullptr;
}
- if (isForCompute && !computeEncoder) {
- LOG(WebGPU, "%s: No compute argument encoder found for binding %lu!", functionName, index);
- return nullptr;
- }
-
+
switch (layoutBinding.type) {
// FIXME: Support more resource types.
- // FIXME: We could avoid this ugly switch-on-type using virtual functions if GPUBindingResource is refactored as a base class rather than a Variant.
case GPUBindingType::UniformBuffer:
case GPUBindingType::StorageBuffer: {
auto bufferResource = tryGetResourceAsBufferBinding(resourceBinding.resource, functionName);
if (!bufferResource)
return nullptr;
- if (isForVertex)
- setBufferOnEncoder(vertexEncoder, *bufferResource, index);
- if (isForFragment)
- setBufferOnEncoder(fragmentEncoder, *bufferResource, index);
- if (isForCompute)
- setBufferOnEncoder(computeEncoder, *bufferResource, index);
+ if (layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex)
+ setBufferOnEncoder(vertexEncoder, *bufferResource, resourceBinding.binding);
+ if (layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment)
+ setBufferOnEncoder(fragmentEncoder, *bufferResource, resourceBinding.binding);
boundBuffers.append(bufferResource->buffer.copyRef());
break;
}
case GPUBindingType::Sampler: {
- auto samplerState = tryGetResourceAsMTLSamplerState(resourceBinding.resource, functionName);
- if (!samplerState)
+ auto samplerResource = tryGetResourceAsSampler(resourceBinding.resource, functionName);
+ if (!samplerResource)
return nullptr;
- if (isForVertex)
- setSamplerOnEncoder(vertexEncoder, samplerState, index);
- if (isForFragment)
- setSamplerOnEncoder(fragmentEncoder, samplerState, index);
- if (isForCompute)
- setSamplerOnEncoder(computeEncoder, samplerState, index);
+ if (layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex)
+ setSamplerOnEncoder(vertexEncoder, samplerResource->platformSampler(), resourceBinding.binding);
+ if (layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment)
+ setSamplerOnEncoder(fragmentEncoder, samplerResource->platformSampler(), resourceBinding.binding);
break;
}
case GPUBindingType::SampledTexture: {
@@ -216,12 +199,10 @@
auto textureResource = tryGetResourceAsTexture(resourceBinding.resource, functionName);
if (!textureResource)
return nullptr;
- if (isForVertex)
- setTextureOnEncoder(vertexEncoder, textureResource->platformTexture(), index);
- if (isForFragment)
- setTextureOnEncoder(fragmentEncoder, textureResource->platformTexture(), index);
- if (isForCompute)
- setTextureOnEncoder(computeEncoder, textureResource->platformTexture(), index);
+ if (layoutBinding.visibility & GPUShaderStageBit::Flags::Vertex)
+ setTextureOnEncoder(vertexEncoder, textureResource->platformTexture(), resourceBinding.binding);
+ if (layoutBinding.visibility & GPUShaderStageBit::Flags::Fragment)
+ setTextureOnEncoder(fragmentEncoder, textureResource->platformTexture(), resourceBinding.binding);
boundTextures.append(textureResource.releaseNonNull());
break;
}
@@ -231,13 +212,12 @@
}
}
- return adoptRef(new GPUBindGroup(WTFMove(vertexArgsBuffer), WTFMove(fragmentArgsBuffer), WTFMove(computeArgsBuffer), WTFMove(boundBuffers), WTFMove(boundTextures)));
+ return adoptRef(new GPUBindGroup(WTFMove(vertexArgsBuffer), WTFMove(fragmentArgsBuffer), WTFMove(boundBuffers), WTFMove(boundTextures)));
}
-GPUBindGroup::GPUBindGroup(RetainPtr<MTLBuffer>&& vertexBuffer, RetainPtr<MTLBuffer>&& fragmentBuffer, RetainPtr<MTLBuffer>&& computeBuffer, Vector<Ref<GPUBuffer>>&& buffers, Vector<Ref<GPUTexture>>&& textures)
+GPUBindGroup::GPUBindGroup(RetainPtr<MTLBuffer>&& vertexBuffer, RetainPtr<MTLBuffer>&& fragmentBuffer, Vector<Ref<GPUBuffer>>&& buffers, Vector<Ref<GPUTexture>>&& textures)
: m_vertexArgsBuffer(WTFMove(vertexBuffer))
, m_fragmentArgsBuffer(WTFMove(fragmentBuffer))
- , m_computeArgsBuffer(WTFMove(computeBuffer))
, m_boundBuffers(WTFMove(buffers))
, m_boundTextures(WTFMove(textures))
{
Deleted: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePassEncoderMetal.mm 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,137 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "GPUComputePassEncoder.h"
-
-#if ENABLE(WEBGPU)
-
-#include "GPUComputePipeline.h"
-#include "Logging.h"
-#include <Metal/Metal.h>
-#include <wtf/BlockObjCExceptions.h>
-
-namespace WebCore {
-
-RefPtr<GPUComputePassEncoder> GPUComputePassEncoder::tryCreate(Ref<GPUCommandBuffer>&& buffer)
-{
- if (buffer->isEncodingPass()) {
- LOG(WebGPU, "GPUComputePassEncoder::tryCreate(): Existing pass encoder must be ended first!");
- return nullptr;
- }
-
- buffer->endBlitEncoding();
-
- RetainPtr<MTLComputeCommandEncoder> mtlEncoder;
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- mtlEncoder = [buffer->platformCommandBuffer() computeCommandEncoder];
- END_BLOCK_OBJC_EXCEPTIONS;
-
- if (!mtlEncoder) {
- LOG(WebGPU, "GPUComputePassEncoder::tryCreate(): Unable to create MTLComputeCommandEncoder!");
- return nullptr;
- }
-
- return adoptRef(new GPUComputePassEncoder(WTFMove(buffer), WTFMove(mtlEncoder)));
-}
-
-GPUComputePassEncoder::GPUComputePassEncoder(Ref<GPUCommandBuffer>&& buffer, RetainPtr<MTLComputeCommandEncoder>&& encoder)
- : GPUProgrammablePassEncoder(WTFMove(buffer))
- , m_platformComputePassEncoder(WTFMove(encoder))
-{
-}
-
-void GPUComputePassEncoder::setPipeline(Ref<const GPUComputePipeline>&& pipeline)
-{
- if (!m_platformComputePassEncoder) {
- LOG(WebGPU, "GPUComputePassEncoder::setPipeline(): Invalid operation!");
- return;
- }
-
- ASSERT(pipeline->platformComputePipeline());
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [m_platformComputePassEncoder setComputePipelineState:pipeline->platformComputePipeline()];
- END_BLOCK_OBJC_EXCEPTIONS;
-
- m_pipeline = WTFMove(pipeline);
-}
-
-void GPUComputePassEncoder::dispatch(unsigned x, unsigned y, unsigned z)
-{
- if (!m_platformComputePassEncoder) {
- LOG(WebGPU, "GPUComputePassEncoder::dispatch(): Invalid operation!");
- return;
- }
-
- if (!m_pipeline) {
- LOG(WebGPU, "GPUComputePassEncoder::dispatch(): No valid GPUComputePipeline found!");
- return;
- }
-
- auto pipelineState = m_pipeline->platformComputePipeline();
- ASSERT(pipelineState);
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- // FIXME: This should be gleaned from the shader if not using MSL. For now, use the docs' example calculation.
- auto w = pipelineState.threadExecutionWidth;
- auto h = pipelineState.maxTotalThreadsPerThreadgroup / w;
- auto threadsPerThreadgroup = MTLSizeMake(w, h, 1);
-
- [m_platformComputePassEncoder dispatchThreads:MTLSizeMake(x, y, z) threadsPerThreadgroup:threadsPerThreadgroup];
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-const MTLCommandEncoder *GPUComputePassEncoder::platformPassEncoder() const
-{
- return m_platformComputePassEncoder.get();
-}
-
-#if USE(METAL)
-
-void GPUComputePassEncoder::useResource(const MTLResource *resource, unsigned usage)
-{
- ASSERT(m_platformComputePassEncoder);
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [m_platformComputePassEncoder useResource:resource usage:usage];
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void GPUComputePassEncoder::setComputeBuffer(const MTLBuffer * buffer, unsigned offset, unsigned index)
-{
- ASSERT(m_platformComputePassEncoder);
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [m_platformComputePassEncoder setBuffer:buffer offset:offset atIndex:index];
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-#endif
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm 2019-03-25 21:12:25 UTC (rev 243457)
@@ -1,100 +0,0 @@
-/*
- * 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.
- */
-
-#import "config.h"
-#import "GPUComputePipeline.h"
-
-#if ENABLE(WEBGPU)
-
-#import "GPUComputePipelineDescriptor.h"
-#import "GPUDevice.h"
-#import "Logging.h"
-#import <Metal/Metal.h>
-#import <wtf/BlockObjCExceptions.h>
-
-OBJC_PROTOCOL(MTLFunction);
-
-namespace WebCore {
-
-static RetainPtr<MTLFunction> tryCreateMtlComputeFunction(const GPUPipelineStageDescriptor& stage)
-{
- if (!stage.module->platformShaderModule() || stage.entryPoint.isNull()) {
- LOG(WebGPU, "GPUComputePipeline::tryCreate(): Invalid GPUShaderModule!");
- return nullptr;
- }
-
- RetainPtr<MTLFunction> function;
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- function = adoptNS([stage.module->platformShaderModule() newFunctionWithName:stage.entryPoint]);
- END_BLOCK_OBJC_EXCEPTIONS;
-
- if (!function)
- LOG(WebGPU, "GPUComputePipeline::tryCreate(): Cannot create compute MTLFunction \"%s\"!", stage.entryPoint.utf8().data());
-
- return function;
-}
-
-static RetainPtr<MTLComputePipelineState> tryCreateMTLComputePipelineState(const GPUDevice& device, const GPUComputePipelineDescriptor& descriptor)
-{
- if (!device.platformDevice()) {
- LOG(WebGPU, "GPUComputePipeline::tryCreate(): Invalid GPUDevice!");
- return nullptr;
- }
-
- auto computeFunction = tryCreateMtlComputeFunction(descriptor.computeStage);
- if (!computeFunction)
- return nullptr;
-
- RetainPtr<MTLComputePipelineState> pipelineState;
- NSError *error = nil;
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- pipelineState = adoptNS([device.platformDevice() newComputePipelineStateWithFunction:computeFunction.get() error:&error]);
- END_BLOCK_OBJC_EXCEPTIONS;
-
- if (!pipelineState)
- LOG(WebGPU, "GPUComputePipeline::tryCreate(): %s!", error ? error.localizedDescription.UTF8String : "Unable to create MTLComputePipelineState!");
-
- return pipelineState;
-}
-
-RefPtr<GPUComputePipeline> GPUComputePipeline::tryCreate(const GPUDevice& device, const GPUComputePipelineDescriptor& descriptor)
-{
- auto mtlPipeline = tryCreateMTLComputePipelineState(device, descriptor);
- if (!mtlPipeline)
- return nullptr;
-
- return adoptRef(new GPUComputePipeline(WTFMove(mtlPipeline)));
-}
-
-GPUComputePipeline::GPUComputePipeline(RetainPtr<MTLComputePipelineState>&& pipeline)
- : m_platformComputePipeline(WTFMove(pipeline))
-{
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm 2019-03-25 21:12:25 UTC (rev 243457)
@@ -29,6 +29,7 @@
#if ENABLE(WEBGPU)
#import "GPUBindGroup.h"
+#import "GPUCommandBuffer.h"
#import "Logging.h"
#import <Metal/Metal.h>
#import <wtf/BlockObjCExceptions.h>
@@ -37,14 +38,12 @@
void GPUProgrammablePassEncoder::endPass()
{
- if (!platformPassEncoder())
- return;
+ ASSERT(platformPassEncoder());
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[platformPassEncoder() endEncoding];
END_BLOCK_OBJC_EXCEPTIONS;
- invalidateEncoder();
m_commandBuffer->setIsEncodingPass(false);
}
@@ -59,8 +58,6 @@
setVertexBuffer(bindGroup.vertexArgsBuffer(), 0, index);
if (bindGroup.fragmentArgsBuffer())
setFragmentBuffer(bindGroup.fragmentArgsBuffer(), 0, index);
- if (bindGroup.computeArgsBuffer())
- setComputeBuffer(bindGroup.computeArgsBuffer(), 0, index);
for (auto& bufferRef : bindGroup.boundBuffers()) {
useResource(bufferRef->platformBuffer(), bufferRef->isReadOnly() ? MTLResourceUsageRead : MTLResourceUsageRead | MTLResourceUsageWrite);
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm 2019-03-25 21:12:25 UTC (rev 243457)
@@ -178,11 +178,19 @@
{
}
-const MTLCommandEncoder *GPURenderPassEncoder::platformPassEncoder() const
+MTLCommandEncoder *GPURenderPassEncoder::platformPassEncoder() const
{
return m_platformRenderPassEncoder.get();
}
+void GPURenderPassEncoder::endPass()
+{
+ if (!m_platformRenderPassEncoder)
+ return;
+ GPUProgrammablePassEncoder::endPass();
+ m_platformRenderPassEncoder = nullptr;
+}
+
void GPURenderPassEncoder::setPipeline(Ref<const GPURenderPipeline>&& pipeline)
{
if (!m_platformRenderPassEncoder) {
@@ -190,7 +198,7 @@
return;
}
- // FIXME: Metal throws an error if the MTLPipelineState's attachment formats do not match the MTLCommandEncoder's attachment formats.
+ // FIXME: Metal throws an error if the MTLPipelineState's attachment formats do not match the MTLCommandEncoder's attachment formats. Does this have to be validated at the Web GPU level?
BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -257,7 +265,6 @@
return;
}
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
[m_platformRenderPassEncoder
drawPrimitives:primitiveTypeForGPUPrimitiveTopology(m_pipeline->primitiveTopology())
vertexStart:firstVertex
@@ -264,33 +271,38 @@
vertexCount:vertexCount
instanceCount:instanceCount
baseInstance:firstInstance];
- END_BLOCK_OBJC_EXCEPTIONS;
}
#if USE(METAL)
-void GPURenderPassEncoder::useResource(const MTLResource *resource, unsigned usage)
+void GPURenderPassEncoder::useResource(MTLResource *resource, unsigned usage)
{
- ASSERT(m_platformRenderPassEncoder);
-
+ if (!m_platformRenderPassEncoder) {
+ LOG(WebGPU, "GPURenderPassEncoder: Invalid operation: Encoding is ended!");
+ return;
+ }
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[m_platformRenderPassEncoder useResource:resource usage:usage];
END_BLOCK_OBJC_EXCEPTIONS;
}
-void GPURenderPassEncoder::setVertexBuffer(const MTLBuffer *buffer, unsigned offset, unsigned index)
+void GPURenderPassEncoder::setVertexBuffer(MTLBuffer *buffer, unsigned offset, unsigned index)
{
- ASSERT(m_platformRenderPassEncoder);
-
+ if (!m_platformRenderPassEncoder) {
+ LOG(WebGPU, "GPURenderPassEncoder: Invalid operation: Encoding is ended!");
+ return;
+ }
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[m_platformRenderPassEncoder setVertexBuffer:buffer offset:offset atIndex:index];
END_BLOCK_OBJC_EXCEPTIONS;
}
-void GPURenderPassEncoder::setFragmentBuffer(const MTLBuffer *buffer, unsigned offset, unsigned index)
+void GPURenderPassEncoder::setFragmentBuffer(MTLBuffer *buffer, unsigned offset, unsigned index)
{
- ASSERT(m_platformRenderPassEncoder);
-
+ if (!m_platformRenderPassEncoder) {
+ LOG(WebGPU, "GPURenderPassEncoder: Invalid operation: Encoding is ended!");
+ return;
+ }
BEGIN_BLOCK_OBJC_EXCEPTIONS;
[m_platformRenderPassEncoder setFragmentBuffer:buffer offset:offset atIndex:index];
END_BLOCK_OBJC_EXCEPTIONS;
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm (243456 => 243457)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm 2019-03-25 21:12:25 UTC (rev 243457)
@@ -28,7 +28,6 @@
#if ENABLE(WEBGPU)
-#import "GPUDevice.h"
#import "GPULimits.h"
#import "GPUUtils.h"
#import "Logging.h"
@@ -442,6 +441,7 @@
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)
{
}
Modified: trunk/Source/WebCore/platform/text/mac/TextEncodingRegistryMac.mm (243456 => 243457)
--- trunk/Source/WebCore/platform/text/mac/TextEncodingRegistryMac.mm 2019-03-25 21:10:38 UTC (rev 243456)
+++ trunk/Source/WebCore/platform/text/mac/TextEncodingRegistryMac.mm 2019-03-25 21:12:25 UTC (rev 243457)
@@ -28,6 +28,7 @@
#if PLATFORM(MAC)
+#import <Carbon/Carbon.h>
#import <wtf/spi/cf/CFStringSPI.h>
namespace WebCore {