[Web GPU] API updates: GPUTexture.createDefaultView and type-safe GPURenderPassEncode...
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Mar 2019 19:07:56 +0000 (19:07 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Mar 2019 19:07:56 +0000 (19:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195896

Reviewed by Jon Lee.

Source/WebCore:

Rename createDefaultTextureView -> createDefaultView and move setPipeline from GPUProgrammablePassEncoder to GPURenderPassEncoder.

Existing tests updated for createDefaultView name.

* Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
(WebCore::WebGPUProgrammablePassEncoder::setPipeline): Deleted.
* Modules/webgpu/WebGPUProgrammablePassEncoder.h:
* Modules/webgpu/WebGPUProgrammablePassEncoder.idl:
* Modules/webgpu/WebGPURenderPassEncoder.cpp:
(WebCore::WebGPURenderPassEncoder::setPipeline):
* Modules/webgpu/WebGPURenderPassEncoder.h:
* Modules/webgpu/WebGPURenderPassEncoder.idl:
* Modules/webgpu/WebGPUTexture.cpp:
(WebCore::WebGPUTexture::createDefaultView):
(WebCore::WebGPUTexture::createDefaultTextureView): Deleted.
* Modules/webgpu/WebGPUTexture.h:
* Modules/webgpu/WebGPUTexture.idl:
* platform/graphics/gpu/GPUProgrammablePassEncoder.h:
* platform/graphics/gpu/GPURenderPassEncoder.h:

LayoutTests:

Rename createDefaultTextureView -> createDefaultView.

* webgpu/buffer-command-buffer-races.html:
* webgpu/depth-enabled-triangle-strip.html:
* webgpu/js/webgpu-functions.js:
(beginBasicRenderPass):
* webgpu/texture-triangle-strip.html:
* webgpu/textures-textureviews.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243089 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/ChangeLog
LayoutTests/webgpu/buffer-command-buffer-races.html
LayoutTests/webgpu/depth-enabled-triangle-strip.html
LayoutTests/webgpu/js/webgpu-functions.js
LayoutTests/webgpu/texture-triangle-strip.html
LayoutTests/webgpu/textures-textureviews.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp
Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h
Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.idl
Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp
Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h
Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.idl
Source/WebCore/Modules/webgpu/WebGPUTexture.cpp
Source/WebCore/Modules/webgpu/WebGPUTexture.h
Source/WebCore/Modules/webgpu/WebGPUTexture.idl
Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h
Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h

index 90c7d1c..07f26a9 100644 (file)
@@ -1,3 +1,19 @@
+2019-03-18  Justin Fan  <justin_fan@apple.com>
+
+        [Web GPU] API updates: GPUTexture.createDefaultView and type-safe GPURenderPassEncoder.setPipeline
+        https://bugs.webkit.org/show_bug.cgi?id=195896
+
+        Reviewed by Jon Lee.
+
+        Rename createDefaultTextureView -> createDefaultView.
+
+        * webgpu/buffer-command-buffer-races.html:
+        * webgpu/depth-enabled-triangle-strip.html:
+        * webgpu/js/webgpu-functions.js:
+        (beginBasicRenderPass):
+        * webgpu/texture-triangle-strip.html:
+        * webgpu/textures-textureviews.html:
+
 2019-03-18  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: HAR Extension for `serverIPAddress` port number
index 9994ded..3edb64b 100644 (file)
@@ -107,7 +107,7 @@ async function test() {
     colorBuffer.setSubData(0, greenArray.buffer);
 
     const attachment = {
-        attachment: swapChain.getCurrentTexture().createDefaultTextureView(),
+        attachment: swapChain.getCurrentTexture().createDefaultView(),
         loadOp: "load",
         storeOp: "store",
         clearColor: { r: 1, g: 0, b: 0, a: 1 }
index 540718d..9353b2c 100644 (file)
@@ -92,14 +92,14 @@ async function test() {
     const commandEncoder = device.createCommandEncoder();
 
     const basicAttachment = {
-        attachment: swapChain.getCurrentTexture().createDefaultTextureView(),
+        attachment: swapChain.getCurrentTexture().createDefaultView(),
         loadOp: "clear",
         storeOp: "store",
         clearColor: { r: 1.0, g: 0, b: 0, a: 1.0 }
     };
 
     const depthAttachment = {
-        attachment: createBasicDepthTexture(canvas, device).createDefaultTextureView(),
+        attachment: createBasicDepthTexture(canvas, device).createDefaultView(),
         depthLoadOp: "clear",
         depthStoreOp: "store",
         clearDepth: 1.0
index 2417baf..2f677f8 100644 (file)
@@ -68,7 +68,7 @@ function createBasicPipeline(shaderModule, device, pipelineLayout, inputStateDes
 
 function beginBasicRenderPass(swapChain, commandEncoder) {
     const basicAttachment = {
-        attachment: swapChain.getCurrentTexture().createDefaultTextureView(),
+        attachment: swapChain.getCurrentTexture().createDefaultView(),
         loadOp: "clear",
         storeOp: "store",
         clearColor: { r: 1.0, g: 0, b: 0, a: 1.0 }
index b9deb12..2f04694 100644 (file)
@@ -171,7 +171,7 @@ async function test() {
 
     const textureBinding = { 
         binding: textureBindingNum, 
-        resource: texture.createDefaultTextureView() 
+        resource: texture.createDefaultView() 
     };
     const samplerBinding = {
         binding: samplerBindingNum,
index 179a02d..b3f665b 100644 (file)
@@ -33,7 +33,7 @@ promise_test(async () => {
     const texture = swapChain.getCurrentTexture();
     assert_true(texture instanceof WebGPUTexture, "Successfully acquired next texture.");
 
-    const textureView = texture.createDefaultTextureView();
+    const textureView = texture.createDefaultView();
     assert_true(textureView instanceof WebGPUTextureView, "Successfully created texture view from next texture.");
 }, "Create texture view from swap chain.");
 
index 429493e..b73aed2 100644 (file)
@@ -1,3 +1,30 @@
+2019-03-18  Justin Fan  <justin_fan@apple.com>
+
+        [Web GPU] API updates: GPUTexture.createDefaultView and type-safe GPURenderPassEncoder.setPipeline
+        https://bugs.webkit.org/show_bug.cgi?id=195896
+
+        Reviewed by Jon Lee.
+
+        Rename createDefaultTextureView -> createDefaultView and move setPipeline from GPUProgrammablePassEncoder to GPURenderPassEncoder.
+
+        Existing tests updated for createDefaultView name.
+
+        * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
+        (WebCore::WebGPUProgrammablePassEncoder::setPipeline): Deleted.
+        * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
+        * Modules/webgpu/WebGPUProgrammablePassEncoder.idl:
+        * Modules/webgpu/WebGPURenderPassEncoder.cpp:
+        (WebCore::WebGPURenderPassEncoder::setPipeline):
+        * Modules/webgpu/WebGPURenderPassEncoder.h:
+        * Modules/webgpu/WebGPURenderPassEncoder.idl:
+        * Modules/webgpu/WebGPUTexture.cpp:
+        (WebCore::WebGPUTexture::createDefaultView):
+        (WebCore::WebGPUTexture::createDefaultTextureView): Deleted.
+        * Modules/webgpu/WebGPUTexture.h:
+        * Modules/webgpu/WebGPUTexture.idl:
+        * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
+        * platform/graphics/gpu/GPURenderPassEncoder.h:
+
 2019-03-18  Chris Dumez  <cdumez@apple.com>
 
         [iOS] The network process sometimes gets killed for trying to suspend while holding locked files
index 2cdeca7..53f0d64 100644 (file)
@@ -68,19 +68,6 @@ void WebGPUProgrammablePassEncoder::setBindGroup(unsigned index, WebGPUBindGroup
     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()));
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)
index 356ecb3..7beb804 100644 (file)
@@ -42,7 +42,6 @@ public:
 
     void endPass();
     void setBindGroup(unsigned, WebGPUBindGroup&) const;
-    void setPipeline(const WebGPURenderPipeline&);
 
 protected:
     WebGPUProgrammablePassEncoder(Ref<WebGPUCommandEncoder>&&);
index 57718c2..70fc1fe 100644 (file)
@@ -33,5 +33,4 @@ typedef unsigned long u32;
 ] interface WebGPUProgrammablePassEncoder {
     void endPass();
     void setBindGroup(u32 index, WebGPUBindGroup bindGroup/*, optional sequence<u32> dynamicOffsets*/);
-    void setPipeline(WebGPURenderPipeline pipeline); // FIXME: Support WebGPUComputePipelines.
 };
index ff58aa4..b001480 100644 (file)
@@ -47,6 +47,19 @@ WebGPURenderPassEncoder::WebGPURenderPassEncoder(Ref<WebGPUCommandEncoder>&& cre
 {
 }
 
+void WebGPURenderPassEncoder::setPipeline(const WebGPURenderPipeline& pipeline)
+{
+    if (!m_passEncoder) {
+        LOG(WebGPU, "GPUProgrammablePassEncoder::setPipeline(): Invalid operation!");
+        return;
+    }
+    if (!pipeline.renderPipeline()) {
+        LOG(WebGPU, "GPUProgrammablePassEncoder::setPipeline(): Invalid pipeline!");
+        return;
+    }
+    m_passEncoder->setPipeline(makeRef(*pipeline.renderPipeline()));
+}
+
 void WebGPURenderPassEncoder::setVertexBuffers(unsigned long startSlot, Vector<RefPtr<WebGPUBuffer>>&& buffers, Vector<unsigned long long>&& offsets)
 {
 #if !LOG_DISABLED
index 479279c..568b2f3 100644 (file)
@@ -42,6 +42,7 @@ class WebGPURenderPassEncoder final : public WebGPUProgrammablePassEncoder {
 public:
     static Ref<WebGPURenderPassEncoder> create(Ref<WebGPUCommandEncoder>&&, RefPtr<GPURenderPassEncoder>&&);
 
+    void setPipeline(const WebGPURenderPipeline&);
     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);
 
index d3f8054..0091327 100644 (file)
@@ -32,6 +32,8 @@ typedef unsigned long long u64;
     EnabledAtRuntime=WebGPU,
     JSGenerateToJSObject
 ] interface WebGPURenderPassEncoder : WebGPUProgrammablePassEncoder {
+    void setPipeline(WebGPURenderPipeline pipeline);
+
     void setVertexBuffers(u32 startSlot, sequence<WebGPUBuffer> buffers, sequence<u64> offsets);
 
     void draw(u32 vertexCount, u32 instanceCount, u32 firstVertex, u32 firstInstance);
index c800ff8..07da060 100644 (file)
@@ -42,10 +42,10 @@ WebGPUTexture::WebGPUTexture(RefPtr<GPUTexture>&& texture)
 {
 }
 
-Ref<WebGPUTextureView> WebGPUTexture::createDefaultTextureView()
+Ref<WebGPUTextureView> WebGPUTexture::createDefaultView()
 {
     if (!m_texture) {
-        LOG(WebGPU, "GPUTexture::createDefaultTextureView(): Invalid operation!");
+        LOG(WebGPU, "GPUTexture::createDefaultView(): Invalid operation!");
         return WebGPUTextureView::create(nullptr);
     }
 
index f9fcfe4..c8c49ff 100644 (file)
@@ -41,7 +41,7 @@ public:
 
     RefPtr<GPUTexture> texture() const { return m_texture; }
 
-    Ref<WebGPUTextureView> createDefaultTextureView();
+    Ref<WebGPUTextureView> createDefaultView();
     void destroy();
 
 private:
index 449572c..6f55e74 100644 (file)
@@ -29,7 +29,7 @@
     EnabledAtRuntime=WebGPU,
     ImplementationLacksVTable
 ] interface WebGPUTexture {
-    WebGPUTextureView createDefaultTextureView();
+    WebGPUTextureView createDefaultView();
     void destroy();
 
     // Not Yet Implemented:
index 271b695..143d554 100644 (file)
@@ -50,7 +50,6 @@ public:
 
     virtual void endPass();
     void setBindGroup(unsigned, GPUBindGroup&);
-    virtual void setPipeline(Ref<const GPURenderPipeline>&&) = 0;
 
 protected:
     GPUProgrammablePassEncoder(Ref<GPUCommandBuffer>&&);
index bc5e024..e053ce0 100644 (file)
@@ -52,7 +52,7 @@ public:
     static RefPtr<GPURenderPassEncoder> tryCreate(Ref<GPUCommandBuffer>&&, GPURenderPassDescriptor&&);
 
     void endPass() final;
-    void setPipeline(Ref<const GPURenderPipeline>&&) 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);