Diff
Modified: trunk/LayoutTests/ChangeLog (242955 => 242956)
--- trunk/LayoutTests/ChangeLog 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/ChangeLog 2019-03-14 19:46:32 UTC (rev 242956)
@@ -1,3 +1,16 @@
+2019-03-14 Shawn Roberts <[email protected]>
+
+ Unreviewed, rolling out r242931.
+
+ Causing internal watch/tv OS build failures
+
+ Reverted changeset:
+
+ "[Web GPU] Updates to GPUCommandBuffer for new GPUCommandQueue
+ concept"
+ https://bugs.webkit.org/show_bug.cgi?id=195083
+ https://trac.webkit.org/changeset/242931
+
2019-03-14 Chris Dumez <[email protected]>
Device orientation's permission should only require a user gesture to prompt the user
Modified: trunk/LayoutTests/webgpu/blit-commands.html (242955 => 242956)
--- trunk/LayoutTests/webgpu/blit-commands.html 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/blit-commands.html 2019-03-14 19:46:32 UTC (rev 242956)
@@ -85,13 +85,12 @@
imageHeight: 0
};
- const commandEncoder = device.createCommandEncoder();
- commandEncoder.copyBufferToBuffer(bufferA, 0, bufferB, 0, imageData.data.byteLength);
- commandEncoder.copyBufferToTexture(bufferViewB, textureViewA, textureSize);
- commandEncoder.copyBufferToTexture(bufferViewB, textureViewA, textureSize);
- commandEncoder.copyTextureToTexture(textureViewA, textureViewB, textureSize);
- commandEncoder.copyTextureToBuffer(textureViewB, readBufferView, textureSize);
- device.getQueue().submit([commandEncoder.finish()]);
+ const commandBuffer = device.createCommandBuffer();
+ commandBuffer.copyBufferToBuffer(bufferA, 0, bufferB, 0, imageData.data.byteLength);
+ commandBuffer.copyBufferToTexture(bufferViewB, textureViewA, textureSize);
+ commandBuffer.copyTextureToTexture(textureViewA, textureViewB, textureSize);
+ commandBuffer.copyTextureToBuffer(textureViewB, readBufferView, textureSize);
+ device.getQueue().submit([commandBuffer]);
bufferA.destroy();
bufferB.destroy();
textureA.destroy();
Modified: trunk/LayoutTests/webgpu/buffer-command-buffer-races.html (242955 => 242956)
--- trunk/LayoutTests/webgpu/buffer-command-buffer-races.html 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/buffer-command-buffer-races.html 2019-03-14 19:46:32 UTC (rev 242956)
@@ -76,13 +76,13 @@
}
function drawAndSubmitCommands(device, pipeline, attachment, vertexBuffer, colorBuffer) {
- const commandEncoder = device.createCommandEncoder();
- const encoder = commandEncoder.beginRenderPass({ colorAttachments: [attachment] });
+ const commandBuffer = device.createCommandBuffer();
+ const encoder = commandBuffer.beginRenderPass({ colorAttachments: [attachment] });
encoder.setVertexBuffers(0, [vertexBuffer, colorBuffer], [0, 0]);
encoder.setPipeline(pipeline);
encoder.draw(3, 1, 0, 0);
encoder.endPass();
- device.getQueue().submit([commandEncoder.finish()]);
+ device.getQueue().submit([commandBuffer]);
}
async function test() {
Modified: trunk/LayoutTests/webgpu/buffer-resource-triangles.html (242955 => 242956)
--- trunk/LayoutTests/webgpu/buffer-resource-triangles.html 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/buffer-resource-triangles.html 2019-03-14 19:46:32 UTC (rev 242956)
@@ -194,8 +194,8 @@
});
Promise.all(bufferPromises).then(() => {
- const commandEncoder = device.createCommandEncoder();
- const passEncoder = beginBasicRenderPass(swapChain, commandEncoder);
+ const commandBuffer = device.createCommandBuffer();
+ const passEncoder = beginBasicRenderPass(swapChain, commandBuffer);
passEncoder.setPipeline(pipeline);
// Vertex data for upper triangles.
@@ -205,9 +205,9 @@
passEncoder.setVertexBuffers(0, [verticesBuffer], [0]);
passEncoder.draw(9, 1, 0, 0);
- passEncoder.endPass();
+ const endCommandBuffer = passEncoder.endPass();
const queue = device.getQueue();
- queue.submit([commandEncoder.finish()]);
+ queue.submit([endCommandBuffer]);
if (window.testRunner)
testRunner.notifyDone();
Modified: trunk/LayoutTests/webgpu/command-buffers-expected.txt (242955 => 242956)
--- trunk/LayoutTests/webgpu/command-buffers-expected.txt 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/command-buffers-expected.txt 2019-03-14 19:46:32 UTC (rev 242956)
@@ -1,3 +1,3 @@
-PASS Create a default GPUCommandEncoder.
+PASS Create a default GPUCommandBuffer.
Modified: trunk/LayoutTests/webgpu/command-buffers.html (242955 => 242956)
--- trunk/LayoutTests/webgpu/command-buffers.html 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/command-buffers.html 2019-03-14 19:46:32 UTC (rev 242956)
@@ -6,10 +6,10 @@
<script>
promise_test(async () => {
const device = await getBasicDevice();
- const commandEncoder = device.createCommandEncoder();
- assert_true(commandEncoder instanceof GPUCommandEncoder, "Successfully created GPUCommandEncoder.");
-}, "Create a default GPUCommandEncoder.");
+ const commandBuffer = device.createCommandBuffer();
+ assert_true(commandBuffer instanceof WebGPUCommandBuffer, "Successfully created GPUCommandBuffer.");
+}, "Create a default GPUCommandBuffer.");
-// FIXME: createCommandEncoder should take a GPUCommandEncoderDescriptor, which is currently an empty dictionary.
+// FIXME: createCommandBuffer should take a GPUCommandBufferDescriptor, which is currently an empty dictionary.
</script>
</html>
\ No newline at end of file
Modified: trunk/LayoutTests/webgpu/depth-enabled-triangle-strip.html (242955 => 242956)
--- trunk/LayoutTests/webgpu/depth-enabled-triangle-strip.html 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/depth-enabled-triangle-strip.html 2019-03-14 19:46:32 UTC (rev 242956)
@@ -89,7 +89,7 @@
const inputStateDescriptor = createInputStateDescriptor();
const depthStateDescriptor = createBasicDepthStateDescriptor();
const pipeline = createBasicPipeline(shaderModule, device, null, inputStateDescriptor, depthStateDescriptor);
- const commandEncoder = device.createCommandEncoder();
+ const commandBuffer = device.createCommandBuffer();
const basicAttachment = {
attachment: swapChain.getCurrentTexture().createDefaultTextureView(),
@@ -105,7 +105,7 @@
clearDepth: 1.0
};
- const encoder = commandEncoder.beginRenderPass({
+ const encoder = commandBuffer.beginRenderPass({
colorAttachments: [basicAttachment],
depthStencilAttachment: depthAttachment
});
@@ -115,7 +115,7 @@
encoder.draw(4, 2, 0, 0);
encoder.endPass();
- device.getQueue().submit([commandEncoder.finish()]);
+ device.getQueue().submit([commandBuffer]);
if (window.testRunner)
testRunner.notifyDone();
Modified: trunk/LayoutTests/webgpu/js/webgpu-functions.js (242955 => 242956)
--- trunk/LayoutTests/webgpu/js/webgpu-functions.js 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/js/webgpu-functions.js 2019-03-14 19:46:32 UTC (rev 242956)
@@ -66,7 +66,7 @@
return device.createRenderPipeline(pipelineDescriptor);
}
-function beginBasicRenderPass(swapChain, commandEncoder) {
+function beginBasicRenderPass(swapChain, commandBuffer) {
const basicAttachment = {
attachment: swapChain.getCurrentTexture().createDefaultTextureView(),
loadOp: "clear",
@@ -75,7 +75,7 @@
}
// FIXME: Flesh out the rest of WebGPURenderPassDescriptor.
- return commandEncoder.beginRenderPass({ colorAttachments : [basicAttachment] });
+ return commandBuffer.beginRenderPass({ colorAttachments : [basicAttachment] });
}
function encodeBasicCommands(renderPassEncoder, renderPipeline, vertexBuffer) {
@@ -83,5 +83,5 @@
renderPassEncoder.setVertexBuffers(0, [vertexBuffer], [0]);
renderPassEncoder.setPipeline(renderPipeline);
renderPassEncoder.draw(4, 1, 0, 0);
- renderPassEncoder.endPass();
+ return renderPassEncoder.endPass();
}
\ No newline at end of file
Modified: trunk/LayoutTests/webgpu/render-command-encoding.html (242955 => 242956)
--- trunk/LayoutTests/webgpu/render-command-encoding.html 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/render-command-encoding.html 2019-03-14 19:46:32 UTC (rev 242956)
@@ -34,14 +34,15 @@
const shaderModule = device.createShaderModule({ code: shaders });
const pipeline = createBasicPipeline(shaderModule, device);
- const commandEncoder = device.createCommandEncoder();
- assert_true(commandEncoder instanceof GPUCommandEncoder, "createCommandEncoder returned a GPUCommandEncoder");
+ const commandBuffer = device.createCommandBuffer();
+ assert_true(commandBuffer instanceof WebGPUCommandBuffer, "createCommandBuffer returned a WebGPUCommandBuffer");
- const encoder = beginBasicRenderPass(swapChain, commandEncoder);
+ const encoder = beginBasicRenderPass(swapChain, commandBuffer);
assert_true(encoder instanceof WebGPURenderPassEncoder, "beginRenderPass() returned a WebGPURenderPassEncoder");
encoder.setPipeline(pipeline);
- encoder.endPass();
+ const commandBufferEnd = encoder.endPass();
+ assert_true(commandBufferEnd instanceof WebGPUCommandBuffer, "endPass() returned a WebGPUCommandBuffer");
}, "WebGPURenderPassEncoder created and successfully ended");
</script>
Modified: trunk/LayoutTests/webgpu/simple-triangle-strip.html (242955 => 242956)
--- trunk/LayoutTests/webgpu/simple-triangle-strip.html 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/simple-triangle-strip.html 2019-03-14 19:46:32 UTC (rev 242956)
@@ -52,12 +52,12 @@
// FIXME: Replace with non-MSL shaders.
const shaderModule = device.createShaderModule({ code: shaderCode });
const pipeline = createBasicPipeline(shaderModule, device);
- const commandEncoder = device.createCommandEncoder();
- const passEncoder = beginBasicRenderPass(swapChain, commandEncoder);
- encodeBasicCommands(passEncoder, pipeline);
+ const commandBuffer = device.createCommandBuffer();
+ const passEncoder = beginBasicRenderPass(swapChain, commandBuffer);
+ const endCommandBuffer = encodeBasicCommands(passEncoder, pipeline);
const queue = device.getQueue();
- queue.submit([commandEncoder.finish()]);
+ queue.submit([endCommandBuffer]);
requestAnimationFrame(() => {
if (window.testRunner)
Modified: trunk/LayoutTests/webgpu/texture-triangle-strip.html (242955 => 242956)
--- trunk/LayoutTests/webgpu/texture-triangle-strip.html 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/texture-triangle-strip.html 2019-03-14 19:46:32 UTC (rev 242956)
@@ -186,7 +186,7 @@
// Pipeline and render
const pipeline = createBasicPipeline(shaderModule, device, pipelineLayout, inputStateDescriptor);
- const commandEncoder = device.createCommandEncoder();
+ const commandBuffer = device.createCommandBuffer();
const bufferCopyView = {
buffer: textureBuffer,
@@ -200,8 +200,8 @@
arrayLayer: 0,
origin: { x: 0, y: 0, z: 0 }
};
- commandEncoder.copyBufferToTexture(bufferCopyView, textureCopyView, textureSize);
- const passEncoder = beginBasicRenderPass(swapChain, commandEncoder);
+ commandBuffer.copyBufferToTexture(bufferCopyView, textureCopyView, textureSize);
+ const passEncoder = beginBasicRenderPass(swapChain, commandBuffer);
passEncoder.setPipeline(pipeline);
passEncoder.setBindGroup(bindGroupIndex, bindGroup);
passEncoder.setVertexBuffers(positionBufferIndex, [positionBuffer, textureCoordBuffer], [0, 0]);
@@ -209,7 +209,7 @@
passEncoder.endPass();
const queue = device.getQueue();
- queue.submit([commandEncoder.finish()]);
+ queue.submit([commandBuffer]);
positionBuffer.destroy();
textureCoordBuffer.destroy();
texture.destroy();
Modified: trunk/LayoutTests/webgpu/vertex-buffer-triangle-strip.html (242955 => 242956)
--- trunk/LayoutTests/webgpu/vertex-buffer-triangle-strip.html 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/LayoutTests/webgpu/vertex-buffer-triangle-strip.html 2019-03-14 19:46:32 UTC (rev 242956)
@@ -91,11 +91,11 @@
const vertexBuffer = createVertexBuffer(device);
const inputStateDescriptor = createInputStateDescriptor();
const pipeline = createBasicPipeline(shaderModule, device, null, inputStateDescriptor);
- const commandEncoder = device.createCommandEncoder();
- const passEncoder = beginBasicRenderPass(swapChain, commandEncoder);
- encodeBasicCommands(passEncoder, pipeline, vertexBuffer);
+ const commandBuffer = device.createCommandBuffer();
+ const passEncoder = beginBasicRenderPass(swapChain, commandBuffer);
+ const endCommandBuffer = encodeBasicCommands(passEncoder, pipeline, vertexBuffer);
const queue = device.getQueue();
- queue.submit([commandEncoder.finish()]);
+ queue.submit([endCommandBuffer]);
vertexBuffer.destroy();
if (window.testRunner)
Modified: trunk/Source/WebCore/CMakeLists.txt (242955 => 242956)
--- trunk/Source/WebCore/CMakeLists.txt 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/CMakeLists.txt 2019-03-14 19:46:32 UTC (rev 242956)
@@ -494,7 +494,6 @@
Modules/webgpu/WebGPUBuffer.idl
Modules/webgpu/WebGPUBufferBinding.idl
Modules/webgpu/WebGPUCommandBuffer.idl
- Modules/webgpu/WebGPUCommandEncoder.idl
Modules/webgpu/WebGPUDevice.idl
Modules/webgpu/WebGPUPipelineDescriptorBase.idl
Modules/webgpu/WebGPUPipelineLayout.idl
Modified: trunk/Source/WebCore/ChangeLog (242955 => 242956)
--- trunk/Source/WebCore/ChangeLog 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/ChangeLog 2019-03-14 19:46:32 UTC (rev 242956)
@@ -1,3 +1,16 @@
+2019-03-14 Shawn Roberts <[email protected]>
+
+ Unreviewed, rolling out r242931.
+
+ Causing internal watch/tv OS build failures
+
+ Reverted changeset:
+
+ "[Web GPU] Updates to GPUCommandBuffer for new GPUCommandQueue
+ concept"
+ https://bugs.webkit.org/show_bug.cgi?id=195083
+ https://trac.webkit.org/changeset/242931
+
2019-03-14 Chris Dumez <[email protected]>
Device orientation's permission should only require a user gesture to prompt the user
Modified: trunk/Source/WebCore/DerivedSources.make (242955 => 242956)
--- trunk/Source/WebCore/DerivedSources.make 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/DerivedSources.make 2019-03-14 19:46:32 UTC (rev 242956)
@@ -404,7 +404,6 @@
$(WebCore)/Modules/webgpu/WebGPUBuffer.idl \
$(WebCore)/Modules/webgpu/WebGPUBufferBinding.idl \
$(WebCore)/Modules/webgpu/WebGPUCommandBuffer.idl \
- $(WebCore)/Modules/webgpu/WebGPUCommandEncoder.idl \
$(WebCore)/Modules/webgpu/WebGPUDevice.idl \
$(WebCore)/Modules/webgpu/WebGPUQueue.idl \
$(WebCore)/Modules/webgpu/WebGPUPipelineDescriptorBase.idl \
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp 2019-03-14 19:46:32 UTC (rev 242956)
@@ -28,18 +28,112 @@
#if ENABLE(WEBGPU)
+#include "GPURenderPassDescriptor.h"
+#include "GPURenderPassEncoder.h"
+#include "WebGPUBuffer.h"
+#include "WebGPURenderPassDescriptor.h"
+#include "WebGPURenderPassEncoder.h"
+#include "WebGPUTexture.h"
+#include <wtf/Optional.h>
+
namespace WebCore {
-Ref<WebGPUCommandBuffer> WebGPUCommandBuffer::create(RefPtr<GPUCommandBuffer>&& buffer)
+Optional<GPUBufferCopyView> WebGPUBufferCopyView::tryCreateGPUBufferCopyView() const
{
+ if (!buffer || !buffer->buffer()) {
+ LOG(WebGPU, "GPUCommandEncoder: Invalid buffer for copy!");
+ return WTF::nullopt;
+ }
+
+ // FIXME: Add Web GPU validation.
+
+ return GPUBufferCopyView { buffer->buffer().releaseNonNull(), *this };
+}
+
+Optional<GPUTextureCopyView> WebGPUTextureCopyView::tryCreateGPUTextureCopyView() const
+{
+ if (!texture || !texture->texture()) {
+ LOG(WebGPU, "GPUCommandEncoder: Invalid texture for copy!");
+ return WTF::nullopt;
+ }
+
+ // FIXME: Add Web GPU validation.
+
+ return GPUTextureCopyView { texture->texture().releaseNonNull(), *this };
+}
+
+Ref<WebGPUCommandBuffer> WebGPUCommandBuffer::create(Ref<GPUCommandBuffer>&& buffer)
+{
return adoptRef(*new WebGPUCommandBuffer(WTFMove(buffer)));
}
-WebGPUCommandBuffer::WebGPUCommandBuffer(RefPtr<GPUCommandBuffer>&& buffer)
+WebGPUCommandBuffer::WebGPUCommandBuffer(Ref<GPUCommandBuffer>&& buffer)
: m_commandBuffer(WTFMove(buffer))
{
}
+RefPtr<WebGPURenderPassEncoder> WebGPUCommandBuffer::beginRenderPass(WebGPURenderPassDescriptor&& descriptor)
+{
+ auto gpuDescriptor = descriptor.tryCreateGPURenderPassDescriptor();
+ if (!gpuDescriptor)
+ return nullptr;
+
+ if (auto encoder = GPURenderPassEncoder::tryCreate(m_commandBuffer.copyRef(), WTFMove(*gpuDescriptor)))
+ return WebGPURenderPassEncoder::create(*this, encoder.releaseNonNull());
+ return nullptr;
+}
+
+void WebGPUCommandBuffer::copyBufferToBuffer(const WebGPUBuffer& src, unsigned long srcOffset, const WebGPUBuffer& dst, unsigned long dstOffset, unsigned long size)
+{
+ if (!src.buffer() || !dst.buffer()) {
+ LOG(WebGPU, "GPUCommandBuffer::copyBufferToBuffer(): Invalid GPUBuffer!");
+ return;
+ }
+
+ // FIXME: Add Web GPU validation.
+
+ m_commandBuffer->copyBufferToBuffer(src.buffer().releaseNonNull(), srcOffset, dst.buffer().releaseNonNull(), dstOffset, size);
+}
+
+void WebGPUCommandBuffer::copyBufferToTexture(const WebGPUBufferCopyView& srcBuffer, const WebGPUTextureCopyView& dstTexture, const GPUExtent3D& size)
+{
+ auto gpuBufferView = srcBuffer.tryCreateGPUBufferCopyView();
+ auto gpuTextureView = dstTexture.tryCreateGPUTextureCopyView();
+
+ if (!gpuBufferView || !gpuTextureView)
+ return;
+
+ // FIXME: Add Web GPU validation.
+
+ m_commandBuffer->copyBufferToTexture(WTFMove(*gpuBufferView), WTFMove(*gpuTextureView), size);
+}
+
+void WebGPUCommandBuffer::copyTextureToBuffer(const WebGPUTextureCopyView& srcTexture, const WebGPUBufferCopyView& dstBuffer, const GPUExtent3D& size)
+{
+ auto gpuTextureView = srcTexture.tryCreateGPUTextureCopyView();
+ auto gpuBufferView = dstBuffer.tryCreateGPUBufferCopyView();
+
+ if (!gpuTextureView || !gpuBufferView)
+ return;
+
+ // FIXME: Add Web GPU validation.
+
+ m_commandBuffer->copyTextureToBuffer(WTFMove(*gpuTextureView), WTFMove(*gpuBufferView), size);
+}
+
+void WebGPUCommandBuffer::copyTextureToTexture(const WebGPUTextureCopyView& src, const WebGPUTextureCopyView& dst, const GPUExtent3D& size)
+{
+ auto gpuSrcView = src.tryCreateGPUTextureCopyView();
+ auto gpuDstView = dst.tryCreateGPUTextureCopyView();
+
+ if (!gpuSrcView || !gpuDstView)
+ return;
+
+ // FIXME: Add Web GPU validation.
+
+ m_commandBuffer->copyTextureToTexture(WTFMove(*gpuSrcView), WTFMove(*gpuDstView), size);
+}
+
} // namespace WebCore
#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h 2019-03-14 19:46:32 UTC (rev 242956)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,21 +28,46 @@
#if ENABLE(WEBGPU)
#include "GPUCommandBuffer.h"
+
#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
namespace WebCore {
+class WebGPUBuffer;
+class WebGPURenderPassEncoder;
+class WebGPUTexture;
+
+struct GPUExtent3D;
+struct WebGPURenderPassDescriptor;
+
+struct WebGPUBufferCopyView : GPUBufferCopyViewBase {
+ Optional<GPUBufferCopyView> tryCreateGPUBufferCopyView() const;
+
+ RefPtr<WebGPUBuffer> buffer;
+};
+
+struct WebGPUTextureCopyView : GPUTextureCopyViewBase {
+ Optional<GPUTextureCopyView> tryCreateGPUTextureCopyView() const;
+
+ RefPtr<WebGPUTexture> texture;
+};
+
class WebGPUCommandBuffer : public RefCounted<WebGPUCommandBuffer> {
public:
- static Ref<WebGPUCommandBuffer> create(RefPtr<GPUCommandBuffer>&&);
+ static Ref<WebGPUCommandBuffer> create(Ref<GPUCommandBuffer>&&);
- GPUCommandBuffer* commandBuffer() { return m_commandBuffer.get(); }
+ GPUCommandBuffer& commandBuffer() const { return m_commandBuffer.get(); }
+ RefPtr<WebGPURenderPassEncoder> beginRenderPass(WebGPURenderPassDescriptor&&);
+ 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&);
+ void copyTextureToTexture(const WebGPUTextureCopyView&, const WebGPUTextureCopyView&, const GPUExtent3D&);
+
private:
- WebGPUCommandBuffer(RefPtr<GPUCommandBuffer>&&);
+ WebGPUCommandBuffer(Ref<GPUCommandBuffer>&&);
- RefPtr<GPUCommandBuffer> m_commandBuffer;
+ Ref<GPUCommandBuffer> m_commandBuffer;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.idl (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.idl 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.idl 2019-03-14 19:46:32 UTC (rev 242956)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -24,10 +24,60 @@
*/
// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+typedef unsigned long u32;
+typedef unsigned long long u64;
+
[
Conditional=WEBGPU,
EnabledAtRuntime=WebGPU,
- ImplementationLacksVTable,
- InterfaceName=GPUCommandBuffer
+ ImplementedAs=WebGPUBufferCopyView
+] dictionary GPUBufferCopyView {
+ WebGPUBuffer buffer;
+ u64 offset;
+ u64 rowPitch;
+ u32 imageHeight;
+};
+
+[
+ Conditional=WEBGPU,
+ EnabledAtRuntime=WebGPU,
+ ImplementedAs=WebGPUTextureCopyView
+] dictionary GPUTextureCopyView {
+ WebGPUTexture texture;
+ u32 mipLevel;
+ u32 arrayLayer;
+ GPUOrigin3D origin;
+};
+
+[
+ Conditional=WEBGPU,
+ EnabledAtRuntime=WebGPU,
+ ImplementationLacksVTable
] interface WebGPUCommandBuffer {
+ WebGPURenderPassEncoder beginRenderPass(WebGPURenderPassDescriptor descriptor);
+
+ void copyBufferToBuffer(
+ WebGPUBuffer src,
+ u64 srcOffset,
+ WebGPUBuffer dst,
+ u64 dstOffset,
+ u64 size);
+
+ void copyBufferToTexture(
+ GPUBufferCopyView source,
+ GPUTextureCopyView destination,
+ GPUExtent3D copySize);
+
+ void copyTextureToBuffer(
+ GPUTextureCopyView source,
+ GPUBufferCopyView destination,
+ GPUExtent3D copySize);
+
+ void copyTextureToTexture(
+ GPUTextureCopyView source,
+ GPUTextureCopyView destination,
+ GPUExtent3D copySize);
+
+ // Not Yet Implemented
+ // WebGPUComputePassEncoder beginComputePass();
};
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.cpp 2019-03-14 19:46:32 UTC (rev 242956)
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebGPUCommandEncoder.h"
-
-#if ENABLE(WEBGPU)
-
-#include "GPURenderPassDescriptor.h"
-#include "GPURenderPassEncoder.h"
-#include "WebGPUBuffer.h"
-#include "WebGPURenderPassDescriptor.h"
-#include "WebGPURenderPassEncoder.h"
-#include "WebGPUTexture.h"
-#include <wtf/Optional.h>
-
-namespace WebCore {
-
-Optional<GPUBufferCopyView> WebGPUBufferCopyView::tryCreateGPUBufferCopyView() const
-{
- if (!buffer || !buffer->buffer()) {
- LOG(WebGPU, "WebGPUCommandEncoder: Invalid buffer for copy!");
- return WTF::nullopt;
- }
-
- // FIXME: Add Web GPU validation.
-
- return GPUBufferCopyView { buffer->buffer().releaseNonNull(), *this };
-}
-
-Optional<GPUTextureCopyView> WebGPUTextureCopyView::tryCreateGPUTextureCopyView() const
-{
- if (!texture || !texture->texture()) {
- LOG(WebGPU, "WebGPUCommandEncoder: Invalid texture for copy!");
- return WTF::nullopt;
- }
-
- // FIXME: Add Web GPU validation.
-
- return GPUTextureCopyView { texture->texture().releaseNonNull(), *this };
-}
-
-Ref<WebGPUCommandEncoder> WebGPUCommandEncoder::create(RefPtr<GPUCommandBuffer>&& buffer)
-{
- return adoptRef(*new WebGPUCommandEncoder(WTFMove(buffer)));
-}
-
-WebGPUCommandEncoder::WebGPUCommandEncoder(RefPtr<GPUCommandBuffer>&& buffer)
- : m_commandBuffer(WTFMove(buffer))
-{
-}
-
-Ref<WebGPURenderPassEncoder> WebGPUCommandEncoder::beginRenderPass(WebGPURenderPassDescriptor&& descriptor)
-{
- if (!m_commandBuffer) {
- LOG(WebGPU, "WebGPUCommandEncoder::beginRenderPass(): Invalid operation!");
- return WebGPURenderPassEncoder::create(*this, nullptr);
- }
- auto gpuDescriptor = descriptor.tryCreateGPURenderPassDescriptor();
- if (!gpuDescriptor)
- return WebGPURenderPassEncoder::create(*this, nullptr);
-
- auto encoder = GPURenderPassEncoder::tryCreate(makeRef(*m_commandBuffer), WTFMove(*gpuDescriptor));
- return WebGPURenderPassEncoder::create(*this, WTFMove(encoder));
-}
-
-void WebGPUCommandEncoder::copyBufferToBuffer(const WebGPUBuffer& src, unsigned long srcOffset, const WebGPUBuffer& dst, unsigned long dstOffset, unsigned long size)
-{
- if (!m_commandBuffer) {
- LOG(WebGPU, "WebGPUCommandEncoder::copyBufferToBuffer(): Invalid operation!");
- return;
- }
- if (!src.buffer() || !dst.buffer()) {
- LOG(WebGPU, "WebGPUCommandEncoder::copyBufferToBuffer(): Invalid GPUBuffer!");
- return;
- }
-
- // FIXME: Add Web GPU validation.
-
- m_commandBuffer->copyBufferToBuffer(makeRef(*src.buffer()), srcOffset, makeRef(*dst.buffer()), dstOffset, size);
-}
-
-void WebGPUCommandEncoder::copyBufferToTexture(const WebGPUBufferCopyView& srcBuffer, const WebGPUTextureCopyView& dstTexture, const GPUExtent3D& size)
-{
- if (!m_commandBuffer) {
- LOG(WebGPU, "WebGPUCommandEncoder::copyBufferToTexture(): Invalid operation!");
- return;
- }
- auto gpuBufferView = srcBuffer.tryCreateGPUBufferCopyView();
- auto gpuTextureView = dstTexture.tryCreateGPUTextureCopyView();
-
- if (!gpuBufferView || !gpuTextureView)
- return;
-
- // FIXME: Add Web GPU validation.
-
- m_commandBuffer->copyBufferToTexture(WTFMove(*gpuBufferView), WTFMove(*gpuTextureView), size);
-}
-
-void WebGPUCommandEncoder::copyTextureToBuffer(const WebGPUTextureCopyView& srcTexture, const WebGPUBufferCopyView& dstBuffer, const GPUExtent3D& size)
-{
- if (!m_commandBuffer) {
- LOG(WebGPU, "WebGPUCommandEncoder::copyTextureToBuffer(): Invalid operation!");
- return;
- }
- auto gpuTextureView = srcTexture.tryCreateGPUTextureCopyView();
- auto gpuBufferView = dstBuffer.tryCreateGPUBufferCopyView();
-
- if (!gpuTextureView || !gpuBufferView)
- return;
-
- // FIXME: Add Web GPU validation.
-
- m_commandBuffer->copyTextureToBuffer(WTFMove(*gpuTextureView), WTFMove(*gpuBufferView), size);
-}
-
-void WebGPUCommandEncoder::copyTextureToTexture(const WebGPUTextureCopyView& src, const WebGPUTextureCopyView& dst, const GPUExtent3D& size)
-{
- if (!m_commandBuffer) {
- LOG(WebGPU, "WebGPUCommandEncoder::copyTextureToTexture(): Invalid operation!");
- return;
- }
- auto gpuSrcView = src.tryCreateGPUTextureCopyView();
- auto gpuDstView = dst.tryCreateGPUTextureCopyView();
-
- if (!gpuSrcView || !gpuDstView)
- return;
-
- // FIXME: Add Web GPU validation.
-
- m_commandBuffer->copyTextureToTexture(WTFMove(*gpuSrcView), WTFMove(*gpuDstView), size);
-}
-
-Ref<WebGPUCommandBuffer> WebGPUCommandEncoder::finish()
-{
- if (!m_commandBuffer) {
- LOG(WebGPU, "WebGPUCommandEncoder::finish(): Invalid operation!");
- return WebGPUCommandBuffer::create(nullptr);
- }
- // Passes the referenced GPUCommandBuffer to the WebGPUCommandBuffer, invalidating this WebGPUCommandEncoder.
- return WebGPUCommandBuffer::create(m_commandBuffer.releaseNonNull());
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.h 2019-03-14 19:46:32 UTC (rev 242956)
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-#include "GPUCommandBuffer.h"
-#include "WebGPUCommandBuffer.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class WebGPUBuffer;
-class WebGPURenderPassEncoder;
-class WebGPUTexture;
-
-struct GPUExtent3D;
-struct WebGPURenderPassDescriptor;
-
-struct WebGPUBufferCopyView : GPUBufferCopyViewBase {
- Optional<GPUBufferCopyView> tryCreateGPUBufferCopyView() const;
-
- RefPtr<WebGPUBuffer> buffer;
-};
-
-struct WebGPUTextureCopyView : GPUTextureCopyViewBase {
- Optional<GPUTextureCopyView> tryCreateGPUTextureCopyView() const;
-
- RefPtr<WebGPUTexture> texture;
-};
-
-class WebGPUCommandEncoder : public RefCounted<WebGPUCommandEncoder> {
-public:
- static Ref<WebGPUCommandEncoder> create(RefPtr<GPUCommandBuffer>&&);
-
- Ref<WebGPURenderPassEncoder> beginRenderPass(WebGPURenderPassDescriptor&&);
- 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&);
- void copyTextureToTexture(const WebGPUTextureCopyView&, const WebGPUTextureCopyView&, const GPUExtent3D&);
- Ref<WebGPUCommandBuffer> finish();
-
-private:
- WebGPUCommandEncoder(RefPtr<GPUCommandBuffer>&&);
-
- RefPtr<GPUCommandBuffer> m_commandBuffer;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl 2019-03-14 19:46:32 UTC (rev 242956)
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
-
-typedef unsigned long u32;
-typedef unsigned long long u64;
-
-[
- Conditional=WEBGPU,
- EnabledAtRuntime=WebGPU,
- ImplementedAs=WebGPUBufferCopyView
-] dictionary GPUBufferCopyView {
- WebGPUBuffer buffer;
- u64 offset;
- u64 rowPitch;
- u32 imageHeight;
-};
-
-[
- Conditional=WEBGPU,
- EnabledAtRuntime=WebGPU,
- ImplementedAs=WebGPUTextureCopyView
-] dictionary GPUTextureCopyView {
- WebGPUTexture texture;
- u32 mipLevel;
- u32 arrayLayer;
- GPUOrigin3D origin;
-};
-
-[
- Conditional=WEBGPU,
- EnabledAtRuntime=WebGPU,
- ImplementationLacksVTable,
- InterfaceName=GPUCommandEncoder
-] interface WebGPUCommandEncoder {
- WebGPURenderPassEncoder beginRenderPass(WebGPURenderPassDescriptor descriptor);
-
- void copyBufferToBuffer(
- WebGPUBuffer src,
- u64 srcOffset,
- WebGPUBuffer dst,
- u64 dstOffset,
- u64 size);
-
- void copyBufferToTexture(
- GPUBufferCopyView source,
- GPUTextureCopyView destination,
- GPUExtent3D copySize);
-
- void copyTextureToBuffer(
- GPUTextureCopyView source,
- GPUBufferCopyView destination,
- GPUExtent3D copySize);
-
- void copyTextureToTexture(
- GPUTextureCopyView source,
- GPUTextureCopyView destination,
- GPUExtent3D copySize);
-
- WebGPUCommandBuffer finish();
-
- // Not Yet Implemented
- // WebGPUComputePassEncoder beginComputePass();
-};
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp 2019-03-14 19:46:32 UTC (rev 242956)
@@ -47,7 +47,7 @@
#include "WebGPUBindGroupLayout.h"
#include "WebGPUBuffer.h"
#include "WebGPUBufferBinding.h"
-#include "WebGPUCommandEncoder.h"
+#include "WebGPUCommandBuffer.h"
#include "WebGPUPipelineLayout.h"
#include "WebGPUPipelineLayoutDescriptor.h"
#include "WebGPUPipelineStageDescriptor.h"
@@ -137,10 +137,11 @@
return WebGPURenderPipeline::create(WTFMove(pipeline));
}
-Ref<WebGPUCommandEncoder> WebGPUDevice::createCommandEncoder() const
+RefPtr<WebGPUCommandBuffer> WebGPUDevice::createCommandBuffer() const
{
- auto commandBuffer = m_device->tryCreateCommandBuffer();
- return WebGPUCommandEncoder::create(WTFMove(commandBuffer));
+ if (auto commandBuffer = m_device->createCommandBuffer())
+ return WebGPUCommandBuffer::create(commandBuffer.releaseNonNull());
+ return nullptr;
}
Ref<WebGPUSwapChain> WebGPUDevice::createSwapChain(const WebGPUSwapChainDescriptor& descriptor) const
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h 2019-03-14 19:46:32 UTC (rev 242956)
@@ -41,7 +41,7 @@
class WebGPUBindGroup;
class WebGPUBindGroupLayout;
class WebGPUBuffer;
-class WebGPUCommandEncoder;
+class WebGPUCommandBuffer;
class WebGPUPipelineLayout;
class WebGPURenderPipeline;
class WebGPUSampler;
@@ -76,7 +76,7 @@
RefPtr<WebGPUShaderModule> createShaderModule(WebGPUShaderModuleDescriptor&&) const;
Ref<WebGPURenderPipeline> createRenderPipeline(const WebGPURenderPipelineDescriptor&) const;
- Ref<WebGPUCommandEncoder> createCommandEncoder() const;
+ RefPtr<WebGPUCommandBuffer> createCommandBuffer() const;
Ref<WebGPUSwapChain> createSwapChain(const WebGPUSwapChainDescriptor&) const;
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl 2019-03-14 19:46:32 UTC (rev 242956)
@@ -54,8 +54,8 @@
WebGPUShaderModule createShaderModule(WebGPUShaderModuleDescriptor descriptor);
WebGPURenderPipeline createRenderPipeline(WebGPURenderPipelineDescriptor descriptor);
- // FIXME: Currently, GPUCommandEncoderDescriptor is an empty dictionary.
- WebGPUCommandEncoder createCommandEncoder(/*GPUCommandEncoderDescriptor descriptor*/);
+ // FIXME: Currently, WebGPUCommandBufferDescriptor is an empty dictionary.
+ WebGPUCommandBuffer createCommandBuffer(/*WebGPUCommandBufferDescriptor descriptor*/);
WebGPUSwapChain createSwapChain(WebGPUSwapChainDescriptor descriptor);
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp 2019-03-14 19:46:32 UTC (rev 242956)
@@ -35,50 +35,39 @@
namespace WebCore {
-WebGPUProgrammablePassEncoder::WebGPUProgrammablePassEncoder(Ref<WebGPUCommandEncoder>&& creator)
+WebGPUProgrammablePassEncoder::WebGPUProgrammablePassEncoder(Ref<WebGPUCommandBuffer>&& creator)
: m_commandBuffer(WTFMove(creator))
{
}
-void WebGPUProgrammablePassEncoder::endPass()
+Ref<WebGPUCommandBuffer> WebGPUProgrammablePassEncoder::endPass()
{
- if (!passEncoder()) {
- LOG(WebGPU, "GPUProgrammablePassEncoder::endPass(): Invalid operation!");
- return;
- }
- passEncoder()->endPass();
+ passEncoder().endPass();
+ return m_commandBuffer.copyRef();
}
void WebGPUProgrammablePassEncoder::setBindGroup(unsigned index, WebGPUBindGroup& bindGroup) const
{
- if (!passEncoder()) {
- LOG(WebGPU, "GPUProgrammablePassEncoder::setBindGroup(): Invalid operation!");
- return;
- }
// Maximum number of bind groups supported in Web GPU.
if (index >= 4) {
- LOG(WebGPU, "GPUProgrammablePassEncoder::setBindGroup(): Invalid index!");
+ LOG(WebGPU, "WebGPUProgrammablePassEncoder::setBindGroup(): Invalid index!");
return;
}
if (!bindGroup.bindGroup()) {
- LOG(WebGPU, "GPUProgrammablePassEncoder::setBindGroup(): Invalid WebGPUBindGroup!");
+ LOG(WebGPU, "WebGPUProgrammablePassEncoder::setBindGroup(): Invalid WebGPUBindGroup!");
return;
}
// FIXME: Any validation (e.g. index duplicates, not in pipeline layout).
- passEncoder()->setBindGroup(index, *bindGroup.bindGroup());
+ passEncoder().setBindGroup(index, *bindGroup.bindGroup());
}
void WebGPUProgrammablePassEncoder::setPipeline(const WebGPURenderPipeline& pipeline)
{
- if (!passEncoder()) {
- LOG(WebGPU, "GPUProgrammablePassEncoder::setPipeline(): Invalid operation!");
- return;
- }
if (!pipeline.renderPipeline()) {
LOG(WebGPU, "GPUProgrammablePassEncoder::setPipeline(): Invalid pipeline!");
return;
}
- passEncoder()->setPipeline(makeRef(*pipeline.renderPipeline()));
+ passEncoder().setPipeline(makeRef(*pipeline.renderPipeline()));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h 2019-03-14 19:46:32 UTC (rev 242956)
@@ -27,7 +27,7 @@
#if ENABLE(WEBGPU)
-#include "WebGPUCommandEncoder.h"
+#include "WebGPUCommandBuffer.h"
#include <wtf/RefCounted.h>
namespace WebCore {
@@ -40,17 +40,17 @@
public:
virtual ~WebGPUProgrammablePassEncoder() = default;
- void endPass();
+ Ref<WebGPUCommandBuffer> endPass();
void setBindGroup(unsigned, WebGPUBindGroup&) const;
void setPipeline(const WebGPURenderPipeline&);
protected:
- WebGPUProgrammablePassEncoder(Ref<WebGPUCommandEncoder>&&);
+ WebGPUProgrammablePassEncoder(Ref<WebGPUCommandBuffer>&&);
- virtual GPUProgrammablePassEncoder* passEncoder() const = 0;
+ virtual GPUProgrammablePassEncoder& passEncoder() const = 0;
private:
- Ref<WebGPUCommandEncoder> m_commandBuffer;
+ Ref<WebGPUCommandBuffer> m_commandBuffer;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.idl (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.idl 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.idl 2019-03-14 19:46:32 UTC (rev 242956)
@@ -31,7 +31,7 @@
EnabledAtRuntime=WebGPU,
SkipVTableValidation
] interface WebGPUProgrammablePassEncoder {
- void endPass();
+ WebGPUCommandBuffer endPass();
void setBindGroup(u32 index, WebGPUBindGroup bindGroup/*, optional sequence<u32> dynamicOffsets*/);
void setPipeline(WebGPURenderPipeline pipeline); // FIXME: Support WebGPUComputePipelines.
};
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.cpp (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.cpp 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.cpp 2019-03-14 19:46:32 UTC (rev 242956)
@@ -30,7 +30,6 @@
#include "GPUCommandBuffer.h"
#include "GPUQueue.h"
-#include "Logging.h"
#include "WebGPUCommandBuffer.h"
namespace WebCore {
@@ -45,19 +44,11 @@
{
}
-void WebGPUQueue::submit(const Vector<RefPtr<WebGPUCommandBuffer>>& buffers)
+void WebGPUQueue::submit(Vector<RefPtr<WebGPUCommandBuffer>>&& buffers)
{
- Vector<Ref<GPUCommandBuffer>> gpuBuffers;
- gpuBuffers.reserveCapacity(buffers.size());
-
- for (auto& buffer : buffers) {
- if (!buffer || !buffer->commandBuffer()) {
- LOG(WebGPU, "GPUQueue::submit(): Invalid GPUCommandBuffer in list!");
- return;
- }
- gpuBuffers.uncheckedAppend(makeRef(*buffer->commandBuffer()));
- }
-
+ auto gpuBuffers = buffers.map([] (auto& buffer) -> Ref<GPUCommandBuffer> {
+ return buffer->commandBuffer();
+ });
m_queue->submit(WTFMove(gpuBuffers));
}
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.h (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.h 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.h 2019-03-14 19:46:32 UTC (rev 242956)
@@ -41,7 +41,7 @@
public:
static RefPtr<WebGPUQueue> create(RefPtr<GPUQueue>&&);
- void submit(const Vector<RefPtr<WebGPUCommandBuffer>>&);
+ void submit(Vector<RefPtr<WebGPUCommandBuffer>>&&);
String label() const { return m_queue->label(); }
void setLabel(const String& label) { m_queue->setLabel(label); }
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.idl (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.idl 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.idl 2019-03-14 19:46:32 UTC (rev 242956)
@@ -34,4 +34,4 @@
// FIXME: Unimplemented.
// void signal(WebGPUFence fence, u64 signalValue);
// void wait(WebGPUFence fence, u64 valueToWait);
-};
+};
\ No newline at end of file
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp 2019-03-14 19:46:32 UTC (rev 242956)
@@ -36,12 +36,12 @@
namespace WebCore {
-Ref<WebGPURenderPassEncoder> WebGPURenderPassEncoder::create(Ref<WebGPUCommandEncoder>&& commandBuffer, RefPtr<GPURenderPassEncoder>&& encoder)
+Ref<WebGPURenderPassEncoder> WebGPURenderPassEncoder::create(Ref<WebGPUCommandBuffer>&& commandBuffer, Ref<GPURenderPassEncoder>&& encoder)
{
return adoptRef(*new WebGPURenderPassEncoder(WTFMove(commandBuffer), WTFMove(encoder)));
}
-WebGPURenderPassEncoder::WebGPURenderPassEncoder(Ref<WebGPUCommandEncoder>&& creator, RefPtr<GPURenderPassEncoder>&& encoder)
+WebGPURenderPassEncoder::WebGPURenderPassEncoder(Ref<WebGPUCommandBuffer>&& creator, Ref<GPURenderPassEncoder>&& encoder)
: WebGPUProgrammablePassEncoder(WTFMove(creator))
, m_passEncoder(WTFMove(encoder))
{
@@ -52,14 +52,11 @@
#if !LOG_DISABLED
const char* const functionName = "GPURenderPassEncoder::setVertexBuffers()";
#endif
- if (!m_passEncoder) {
- LOG(WebGPU, "%s: Invalid operation!", functionName);
- return;
- }
if (buffers.isEmpty() || buffers.size() != offsets.size()) {
LOG(WebGPU, "%s: Invalid number of buffers or offsets!", functionName);
return;
}
+
if (startSlot + buffers.size() > maxVertexBuffers) {
LOG(WebGPU, "%s: Invalid startSlot %lu for %lu buffers!", functionName, startSlot, buffers.size());
return;
@@ -87,15 +84,11 @@
void WebGPURenderPassEncoder::draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance)
{
- if (!m_passEncoder) {
- LOG(WebGPU, "GPURenderPassEncoder::draw(): Invalid operation!");
- return;
- }
// FIXME: What kind of validation do we need to handle here?
m_passEncoder->draw(vertexCount, instanceCount, firstVertex, firstInstance);
}
-GPUProgrammablePassEncoder* WebGPURenderPassEncoder::passEncoder() const
+GPUProgrammablePassEncoder& WebGPURenderPassEncoder::passEncoder() const
{
return m_passEncoder.get();
}
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h 2019-03-14 19:46:32 UTC (rev 242956)
@@ -40,17 +40,17 @@
class WebGPURenderPassEncoder final : public WebGPUProgrammablePassEncoder {
public:
- static Ref<WebGPURenderPassEncoder> create(Ref<WebGPUCommandEncoder>&&, RefPtr<GPURenderPassEncoder>&&);
+ static Ref<WebGPURenderPassEncoder> create(Ref<WebGPUCommandBuffer>&&, Ref<GPURenderPassEncoder>&&);
void setVertexBuffers(unsigned long, Vector<RefPtr<WebGPUBuffer>>&&, Vector<unsigned long long>&&);
void draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance);
private:
- WebGPURenderPassEncoder(Ref<WebGPUCommandEncoder>&&, RefPtr<GPURenderPassEncoder>&&);
+ WebGPURenderPassEncoder(Ref<WebGPUCommandBuffer>&&, Ref<GPURenderPassEncoder>&&);
- GPUProgrammablePassEncoder* passEncoder() const final;
+ GPUProgrammablePassEncoder& passEncoder() const final;
- RefPtr<GPURenderPassEncoder> m_passEncoder;
+ Ref<GPURenderPassEncoder> m_passEncoder;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp (242955 => 242956)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp 2019-03-14 19:46:32 UTC (rev 242956)
@@ -50,7 +50,7 @@
return WebGPUTexture::create(nullptr);
}
m_currentTexture = WebGPUTexture::create(m_swapChain->tryGetCurrentTexture());
- return makeRef(*m_currentTexture);
+ return m_currentTexture.releaseNonNull();
}
void WebGPUSwapChain::destroy()
Modified: trunk/Source/WebCore/Sources.txt (242955 => 242956)
--- trunk/Source/WebCore/Sources.txt 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/Sources.txt 2019-03-14 19:46:32 UTC (rev 242956)
@@ -352,11 +352,10 @@
Modules/webgpu/WebGPU.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/WebGPUDevice.cpp
Modules/webgpu/WebGPUQueue.cpp
Modules/webgpu/WebGPUPipelineLayout.cpp
@@ -3340,7 +3339,6 @@
JSWebGPUBuffer.cpp
JSWebGPUBufferBinding.cpp
JSWebGPUCommandBuffer.cpp
-JSWebGPUCommandEncoder.cpp
JSWebGPUDevice.cpp
JSWebGPUQueue.cpp
JSWebGPUPipelineDescriptorBase.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (242955 => 242956)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-03-14 19:46:32 UTC (rev 242956)
@@ -14086,9 +14086,6 @@
D05A99E621C9BF2C00032B75 /* WebGPUPipelineLayout.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUPipelineLayout.idl; sourceTree = "<group>"; };
D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FormatBlockCommand.cpp; sourceTree = "<group>"; };
D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FormatBlockCommand.h; sourceTree = "<group>"; };
- D05DD6DD223884060097A834 /* WebGPUCommandBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUCommandBuffer.cpp; sourceTree = "<group>"; };
- D05DD6DE223884070097A834 /* WebGPUCommandBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUCommandBuffer.h; sourceTree = "<group>"; };
- D05DD6DF223884070097A834 /* WebGPUCommandBuffer.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUCommandBuffer.idl; sourceTree = "<group>"; };
D060D88421825D5F00339318 /* WebGPUShaderModuleDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderModuleDescriptor.idl; sourceTree = "<group>"; };
D060D8872182697000339318 /* WebGPUShaderModuleDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUShaderModuleDescriptor.h; sourceTree = "<group>"; };
D0615FCC217FE5C6008A48A8 /* WebGPUShaderModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUShaderModule.h; sourceTree = "<group>"; };
@@ -14198,9 +14195,9 @@
D0DA0BE6217930E2007FE2AC /* WebGPUSwapChain.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUSwapChain.idl; sourceTree = "<group>"; };
D0DE8FB8222E09E200882550 /* GPUShaderStageBit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUShaderStageBit.h; sourceTree = "<group>"; };
D0DE8FB9222E09E200882550 /* GPUShaderStageBit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUShaderStageBit.idl; sourceTree = "<group>"; };
- D0EACF7621937228000FA75C /* WebGPUCommandEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUCommandEncoder.h; sourceTree = "<group>"; };
- D0EACF7721937228000FA75C /* WebGPUCommandEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUCommandEncoder.cpp; sourceTree = "<group>"; };
- D0EACF7821937228000FA75C /* WebGPUCommandEncoder.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUCommandEncoder.idl; sourceTree = "<group>"; };
+ D0EACF7621937228000FA75C /* WebGPUCommandBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUCommandBuffer.h; sourceTree = "<group>"; };
+ D0EACF7721937228000FA75C /* WebGPUCommandBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUCommandBuffer.cpp; sourceTree = "<group>"; };
+ D0EACF7821937228000FA75C /* WebGPUCommandBuffer.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUCommandBuffer.idl; sourceTree = "<group>"; };
D0EACF842193B02E000FA75C /* WebGPUTexture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUTexture.h; sourceTree = "<group>"; };
D0EACF852193B02E000FA75C /* WebGPUTexture.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUTexture.cpp; sourceTree = "<group>"; };
D0EACF862193B02E000FA75C /* WebGPUTexture.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUTexture.idl; sourceTree = "<group>"; };
@@ -26179,12 +26176,9 @@
D0D8648E21B70676003C983C /* WebGPUBuffer.idl */,
D0BE104C21E68F1500E42A89 /* WebGPUBufferBinding.h */,
D0BE104D21E68F1500E42A89 /* WebGPUBufferBinding.idl */,
- D05DD6DD223884060097A834 /* WebGPUCommandBuffer.cpp */,
- D05DD6DE223884070097A834 /* WebGPUCommandBuffer.h */,
- D05DD6DF223884070097A834 /* WebGPUCommandBuffer.idl */,
- D0EACF7721937228000FA75C /* WebGPUCommandEncoder.cpp */,
- D0EACF7621937228000FA75C /* WebGPUCommandEncoder.h */,
- D0EACF7821937228000FA75C /* WebGPUCommandEncoder.idl */,
+ D0EACF7721937228000FA75C /* WebGPUCommandBuffer.cpp */,
+ D0EACF7621937228000FA75C /* WebGPUCommandBuffer.h */,
+ D0EACF7821937228000FA75C /* WebGPUCommandBuffer.idl */,
D00F595321701D8C000D71DB /* WebGPUDevice.cpp */,
D00F595221701D8C000D71DB /* WebGPUDevice.h */,
D00F595421701D8C000D71DB /* WebGPUDevice.idl */,
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (242955 => 242956)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2019-03-14 19:46:32 UTC (rev 242956)
@@ -84,8 +84,6 @@
macro(GPUBufferUsage) \
macro(GPUCanvasContext) \
macro(GPUShaderModule) \
- macro(GPUCommandBuffer) \
- macro(GPUCommandEncoder) \
macro(GPUShaderStageBit) \
macro(GPUSwapChain) \
macro(GPUTextureUsage) \
@@ -203,6 +201,7 @@
macro(WebGPUBindGroup) \
macro(WebGPUBindGroupLayout) \
macro(WebGPUBuffer) \
+ macro(WebGPUCommandBuffer) \
macro(WebGPUDevice) \
macro(WebGPUIndexFormat) \
macro(WebGPUInputStepMode) \
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h (242955 => 242956)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h 2019-03-14 19:46:32 UTC (rev 242956)
@@ -27,9 +27,7 @@
#if ENABLE(WEBGPU)
-#include "GPUBuffer.h"
#include "GPUOrigin3D.h"
-#include "GPUTexture.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/RetainPtr.h>
@@ -40,7 +38,9 @@
namespace WebCore {
+class GPUBuffer;
class GPUDevice;
+class GPUTexture;
struct GPUExtent3D;
@@ -81,7 +81,7 @@
class GPUCommandBuffer : public RefCounted<GPUCommandBuffer> {
public:
- static RefPtr<GPUCommandBuffer> tryCreate(const GPUDevice&);
+ static RefPtr<GPUCommandBuffer> create(GPUDevice&);
PlatformCommandBuffer* platformCommandBuffer() const { return m_platformCommandBuffer.get(); }
const Vector<Ref<GPUBuffer>>& usedBuffers() const { return m_usedBuffers; }
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp (242955 => 242956)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp 2019-03-14 19:46:32 UTC (rev 242956)
@@ -83,9 +83,9 @@
return GPURenderPipeline::create(*this, WTFMove(descriptor));
}
-RefPtr<GPUCommandBuffer> GPUDevice::tryCreateCommandBuffer() const
+RefPtr<GPUCommandBuffer> GPUDevice::createCommandBuffer()
{
- return GPUCommandBuffer::tryCreate(*this);
+ return GPUCommandBuffer::create(*this);
}
RefPtr<GPUSwapChain> GPUDevice::tryCreateSwapChain(const GPUSwapChainDescriptor& descriptor, int width, int height) const
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h (242955 => 242956)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h 2019-03-14 19:46:32 UTC (rev 242956)
@@ -37,6 +37,9 @@
namespace WebCore {
+using PlatformDevice = MTLDevice;
+using PlatformDeviceSmartPtr = RetainPtr<MTLDevice>;
+
class GPUBindGroupLayout;
class GPUBuffer;
class GPUCommandBuffer;
@@ -55,9 +58,6 @@
struct GPUSamplerDescriptor;
struct GPUShaderModuleDescriptor;
struct GPUTextureDescriptor;
-
-using PlatformDevice = MTLDevice;
-using PlatformDeviceSmartPtr = RetainPtr<MTLDevice>;
class GPUDevice : public RefCounted<GPUDevice>, public CanMakeWeakPtr<GPUDevice> {
public:
@@ -73,7 +73,7 @@
RefPtr<GPUShaderModule> createShaderModule(GPUShaderModuleDescriptor&&) const;
RefPtr<GPURenderPipeline> createRenderPipeline(GPURenderPipelineDescriptor&&) const;
- RefPtr<GPUCommandBuffer> tryCreateCommandBuffer() const;
+ RefPtr<GPUCommandBuffer> createCommandBuffer();
RefPtr<GPUSwapChain> tryCreateSwapChain(const GPUSwapChainDescriptor&, int width, int height) const;
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm (242955 => 242956)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm 2019-03-14 19:31:52 UTC (rev 242955)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm 2019-03-14 19:46:32 UTC (rev 242956)
@@ -28,9 +28,11 @@
#if ENABLE(WEBGPU)
+#import "GPUBuffer.h"
#import "GPUDevice.h"
#import "GPUExtent3D.h"
#import "GPUQueue.h"
+#import "GPUTexture.h"
#import "Logging.h"
#import <Metal/Metal.h>
@@ -39,7 +41,7 @@
namespace WebCore {
-RefPtr<GPUCommandBuffer> GPUCommandBuffer::tryCreate(const GPUDevice& device)
+RefPtr<GPUCommandBuffer> GPUCommandBuffer::create(GPUDevice& device)
{
if (!device.platformDevice()) {
LOG(WebGPU, "GPUCommandBuffer::create(): Invalid GPUDevice!");