Diff
Modified: trunk/Source/WebGPU/ChangeLog (290254 => 290255)
--- trunk/Source/WebGPU/ChangeLog 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/ChangeLog 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,62 @@
2022-02-21 Myles C. Maxfield <[email protected]>
+ [WebGPU] Tracer bullet part 4: Move Device's construction methods to the files of the things they create
+ https://bugs.webkit.org/show_bug.cgi?id=236891
+
+ Reviewed by Dean Jackson.
+
+ Device is kind of a factory object, and has lots of methods which create
+ other objects in the API. To avoid Device.cpp becoming a catch-all place
+ for tons of unrelated creation routines, this patch moves the routine that
+ creates an X into X.mm.
+
+ * WebGPU/BindGroup.mm:
+ (WebGPU::Device::createBindGroup):
+ * WebGPU/BindGroupLayout.mm:
+ (WebGPU::Device::createBindGroupLayout):
+ * WebGPU/Buffer.mm:
+ (WebGPU::Device::createBuffer):
+ * WebGPU/CommandEncoder.mm:
+ (WebGPU::Device::createCommandEncoder):
+ * WebGPU/ComputePipeline.mm:
+ (WebGPU::Device::createComputePipeline):
+ (WebGPU::Device::createComputePipelineAsync):
+ * WebGPU/Device.mm:
+ (WebGPU::Device::createBindGroup): Deleted.
+ (WebGPU::Device::createBindGroupLayout): Deleted.
+ (WebGPU::Device::createBuffer): Deleted.
+ (WebGPU::Device::createCommandEncoder): Deleted.
+ (WebGPU::Device::createComputePipeline): Deleted.
+ (WebGPU::Device::createComputePipelineAsync): Deleted.
+ (WebGPU::Device::createPipelineLayout): Deleted.
+ (WebGPU::Device::createQuerySet): Deleted.
+ (WebGPU::Device::createRenderBundleEncoder): Deleted.
+ (WebGPU::Device::createRenderPipeline): Deleted.
+ (WebGPU::Device::createRenderPipelineAsync): Deleted.
+ (WebGPU::Device::createSampler): Deleted.
+ (WebGPU::Device::createShaderModule): Deleted.
+ (WebGPU::Device::createSwapChain): Deleted.
+ (WebGPU::Device::createTexture): Deleted.
+ * WebGPU/PipelineLayout.mm:
+ (WebGPU::Device::createPipelineLayout):
+ * WebGPU/QuerySet.mm:
+ (WebGPU::Device::createQuerySet):
+ * WebGPU/RenderBundleEncoder.mm:
+ (WebGPU::Device::createRenderBundleEncoder):
+ * WebGPU/RenderPipeline.mm:
+ (WebGPU::Device::createRenderPipeline):
+ (WebGPU::Device::createRenderPipelineAsync):
+ * WebGPU/Sampler.mm:
+ (WebGPU::Device::createSampler):
+ * WebGPU/ShaderModule.mm:
+ (WebGPU::Device::createShaderModule):
+ * WebGPU/SwapChain.mm:
+ (WebGPU::Device::createSwapChain):
+ * WebGPU/Texture.mm:
+ (WebGPU::Device::createTexture):
+
+2022-02-21 Myles C. Maxfield <[email protected]>
+
[WebGPU] Tracer bullet part 3: Tweak WGSL API
https://bugs.webkit.org/show_bug.cgi?id=236889
Modified: trunk/Source/WebGPU/WebGPU/BindGroup.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/BindGroup.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/BindGroup.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,10 +26,17 @@
#import "config.h"
#import "BindGroup.h"
+#import "Device.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<BindGroup> Device::createBindGroup(const WGPUBindGroupDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return BindGroup::create();
+}
+
BindGroup::BindGroup() = default;
BindGroup::~BindGroup() = default;
Modified: trunk/Source/WebGPU/WebGPU/BindGroupLayout.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/BindGroupLayout.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/BindGroupLayout.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,10 +26,17 @@
#import "config.h"
#import "BindGroupLayout.h"
+#import "Device.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<BindGroupLayout> Device::createBindGroupLayout(const WGPUBindGroupLayoutDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return BindGroupLayout::create();
+}
+
BindGroupLayout::BindGroupLayout() = default;
BindGroupLayout::~BindGroupLayout() = default;
Modified: trunk/Source/WebGPU/WebGPU/Buffer.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/Buffer.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/Buffer.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,10 +26,17 @@
#import "config.h"
#import "Buffer.h"
+#import "Device.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<Buffer> Device::createBuffer(const WGPUBufferDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return Buffer::create();
+}
+
Buffer::Buffer() = default;
Buffer::~Buffer() = default;
Modified: trunk/Source/WebGPU/WebGPU/CommandEncoder.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/CommandEncoder.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/CommandEncoder.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
#import "Buffer.h"
#import "CommandBuffer.h"
#import "ComputePassEncoder.h"
+#import "Device.h"
#import "QuerySet.h"
#import "RenderPassEncoder.h"
#import "WebGPUExt.h"
@@ -35,6 +36,12 @@
namespace WebGPU {
+RefPtr<CommandEncoder> Device::createCommandEncoder(const WGPUCommandEncoderDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return CommandEncoder::create();
+}
+
CommandEncoder::CommandEncoder() = default;
CommandEncoder::~CommandEncoder() = default;
Modified: trunk/Source/WebGPU/WebGPU/ComputePipeline.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/ComputePipeline.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/ComputePipeline.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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,10 +28,23 @@
#import "BindGroupLayout.h"
+#import "Device.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<ComputePipeline> Device::createComputePipeline(const WGPUComputePipelineDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return ComputePipeline::create();
+}
+
+void Device::createComputePipelineAsync(const WGPUComputePipelineDescriptor* descriptor, WTF::Function<void(WGPUCreatePipelineAsyncStatus, RefPtr<ComputePipeline>&&, const char* message)>&& callback)
+{
+ UNUSED_PARAM(descriptor);
+ UNUSED_PARAM(callback);
+}
+
ComputePipeline::ComputePipeline() = default;
ComputePipeline::~ComputePipeline() = default;
Modified: trunk/Source/WebGPU/WebGPU/Device.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/Device.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/Device.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -50,97 +50,6 @@
Device::~Device() = default;
-RefPtr<BindGroup> Device::createBindGroup(const WGPUBindGroupDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return BindGroup::create();
-}
-
-RefPtr<BindGroupLayout> Device::createBindGroupLayout(const WGPUBindGroupLayoutDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return BindGroupLayout::create();
-}
-
-RefPtr<Buffer> Device::createBuffer(const WGPUBufferDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return Buffer::create();
-}
-
-RefPtr<CommandEncoder> Device::createCommandEncoder(const WGPUCommandEncoderDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return CommandEncoder::create();
-}
-
-RefPtr<ComputePipeline> Device::createComputePipeline(const WGPUComputePipelineDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return ComputePipeline::create();
-}
-
-void Device::createComputePipelineAsync(const WGPUComputePipelineDescriptor* descriptor, WTF::Function<void(WGPUCreatePipelineAsyncStatus, RefPtr<ComputePipeline>&&, const char* message)>&& callback)
-{
- UNUSED_PARAM(descriptor);
- UNUSED_PARAM(callback);
-}
-
-RefPtr<PipelineLayout> Device::createPipelineLayout(const WGPUPipelineLayoutDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return PipelineLayout::create();
-}
-
-RefPtr<QuerySet> Device::createQuerySet(const WGPUQuerySetDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return QuerySet::create();
-}
-
-RefPtr<RenderBundleEncoder> Device::createRenderBundleEncoder(const WGPURenderBundleEncoderDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return RenderBundleEncoder::create();
-}
-
-RefPtr<RenderPipeline> Device::createRenderPipeline(const WGPURenderPipelineDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return RenderPipeline::create();
-}
-
-void Device::createRenderPipelineAsync(const WGPURenderPipelineDescriptor* descriptor, WTF::Function<void(WGPUCreatePipelineAsyncStatus, RefPtr<RenderPipeline>&&, const char* message)>&& callback)
-{
- UNUSED_PARAM(descriptor);
- UNUSED_PARAM(callback);
-}
-
-RefPtr<Sampler> Device::createSampler(const WGPUSamplerDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return Sampler::create();
-}
-
-RefPtr<ShaderModule> Device::createShaderModule(const WGPUShaderModuleDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return ShaderModule::create();
-}
-
-RefPtr<SwapChain> Device::createSwapChain(const Surface& surface, const WGPUSwapChainDescriptor* descriptor)
-{
- UNUSED_PARAM(surface);
- UNUSED_PARAM(descriptor);
- return SwapChain::create();
-}
-
-RefPtr<Texture> Device::createTexture(const WGPUTextureDescriptor* descriptor)
-{
- UNUSED_PARAM(descriptor);
- return Texture::create();
-}
-
void Device::destroy()
{
}
Modified: trunk/Source/WebGPU/WebGPU/PipelineLayout.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/PipelineLayout.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/PipelineLayout.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,10 +26,17 @@
#import "config.h"
#import "PipelineLayout.h"
+#import "Device.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<PipelineLayout> Device::createPipelineLayout(const WGPUPipelineLayoutDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return PipelineLayout::create();
+}
+
PipelineLayout::PipelineLayout() = default;
PipelineLayout::~PipelineLayout() = default;
Modified: trunk/Source/WebGPU/WebGPU/QuerySet.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/QuerySet.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/QuerySet.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,10 +26,17 @@
#import "config.h"
#import "QuerySet.h"
+#import "Device.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<QuerySet> Device::createQuerySet(const WGPUQuerySetDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return QuerySet::create();
+}
+
QuerySet::QuerySet() = default;
QuerySet::~QuerySet() = default;
Modified: trunk/Source/WebGPU/WebGPU/RenderBundleEncoder.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/RenderBundleEncoder.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/RenderBundleEncoder.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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,6 +28,7 @@
#import "BindGroup.h"
#import "Buffer.h"
+#import "Device.h"
#import "RenderBundle.h"
#import "RenderPipeline.h"
#import "WebGPUExt.h"
@@ -34,6 +35,12 @@
namespace WebGPU {
+RefPtr<RenderBundleEncoder> Device::createRenderBundleEncoder(const WGPURenderBundleEncoderDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return RenderBundleEncoder::create();
+}
+
RenderBundleEncoder::RenderBundleEncoder() = default;
RenderBundleEncoder::~RenderBundleEncoder() = default;
Modified: trunk/Source/WebGPU/WebGPU/RenderPipeline.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/RenderPipeline.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/RenderPipeline.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,10 +27,23 @@
#import "RenderPipeline.h"
#import "BindGroupLayout.h"
+#import "Device.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<RenderPipeline> Device::createRenderPipeline(const WGPURenderPipelineDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return RenderPipeline::create();
+}
+
+void Device::createRenderPipelineAsync(const WGPURenderPipelineDescriptor* descriptor, WTF::Function<void(WGPUCreatePipelineAsyncStatus, RefPtr<RenderPipeline>&&, const char* message)>&& callback)
+{
+ UNUSED_PARAM(descriptor);
+ UNUSED_PARAM(callback);
+}
+
RenderPipeline::RenderPipeline() = default;
RenderPipeline::~RenderPipeline() = default;
Modified: trunk/Source/WebGPU/WebGPU/Sampler.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/Sampler.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/Sampler.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,10 +26,17 @@
#import "config.h"
#import "Sampler.h"
+#import "Device.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<Sampler> Device::createSampler(const WGPUSamplerDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return Sampler::create();
+}
+
Sampler::Sampler() = default;
Sampler::~Sampler() = default;
Modified: trunk/Source/WebGPU/WebGPU/ShaderModule.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/ShaderModule.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/ShaderModule.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,10 +26,17 @@
#import "config.h"
#import "ShaderModule.h"
+#import "Device.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<ShaderModule> Device::createShaderModule(const WGPUShaderModuleDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return ShaderModule::create();
+}
+
ShaderModule::ShaderModule() = default;
ShaderModule::~ShaderModule() = default;
Modified: trunk/Source/WebGPU/WebGPU/SwapChain.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/SwapChain.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/SwapChain.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,11 +26,19 @@
#import "config.h"
#import "SwapChain.h"
+#import "Device.h"
#import "TextureView.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<SwapChain> Device::createSwapChain(const Surface& surface, const WGPUSwapChainDescriptor* descriptor)
+{
+ UNUSED_PARAM(surface);
+ UNUSED_PARAM(descriptor);
+ return SwapChain::create();
+}
+
SwapChain::SwapChain() = default;
SwapChain::~SwapChain() = default;
Modified: trunk/Source/WebGPU/WebGPU/Texture.mm (290254 => 290255)
--- trunk/Source/WebGPU/WebGPU/Texture.mm 2022-02-21 19:15:35 UTC (rev 290254)
+++ trunk/Source/WebGPU/WebGPU/Texture.mm 2022-02-21 19:23:34 UTC (rev 290255)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Apple Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,11 +26,18 @@
#import "config.h"
#import "Texture.h"
+#import "Device.h"
#import "TextureView.h"
#import "WebGPUExt.h"
namespace WebGPU {
+RefPtr<Texture> Device::createTexture(const WGPUTextureDescriptor* descriptor)
+{
+ UNUSED_PARAM(descriptor);
+ return Texture::create();
+}
+
Texture::Texture() = default;
Texture::~Texture() = default;