Diff
Modified: trunk/Source/WebGPU/ChangeLog (291388 => 291389)
--- trunk/Source/WebGPU/ChangeLog 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/ChangeLog 2022-03-17 07:17:53 UTC (rev 291389)
@@ -1,3 +1,33 @@
+2022-03-17 Myles C. Maxfield <[email protected]>
+
+ [WebGPU] Mark unchanging class members as const
+ https://bugs.webkit.org/show_bug.cgi?id=237998
+
+ Reviewed by Kimmo Kinnunen.
+
+ Let's use the C++ type system to our advantage.
+
+ * WebGPU/Adapter.h:
+ * WebGPU/BindGroup.h:
+ * WebGPU/BindGroupLayout.h:
+ * WebGPU/CommandBuffer.h:
+ * WebGPU/ComputePassEncoder.h:
+ * WebGPU/ComputePipeline.h:
+ * WebGPU/Device.h:
+ (WebGPU::Device::instance const):
+ (WebGPU::Device::instance): Deleted.
+ * WebGPU/Instance.h:
+ * WebGPU/QuerySet.h:
+ * WebGPU/Queue.h:
+ * WebGPU/RenderBundle.h:
+ * WebGPU/RenderBundleEncoder.h:
+ * WebGPU/RenderPassEncoder.h:
+ * WebGPU/RenderPipeline.h:
+ * WebGPU/Sampler.h:
+ * WebGPU/ShaderModule.h:
+ * WebGPU/Texture.h:
+ * WebGPU/TextureView.h:
+
2022-03-16 Myles C. Maxfield <[email protected]>
[WebGPU] Implement sampler creation according to the spec
Modified: trunk/Source/WebGPU/WebGPU/Adapter.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/Adapter.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/Adapter.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -55,8 +55,8 @@
private:
Adapter(id<MTLDevice>, Instance&);
- id<MTLDevice> m_device { nil };
- Ref<Instance> m_instance;
+ const id<MTLDevice> m_device { nil };
+ const Ref<Instance> m_instance;
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/BindGroup.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/BindGroup.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/BindGroup.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -50,9 +50,9 @@
private:
BindGroup(id<MTLBuffer> vertexArgumentBuffer, id<MTLBuffer> fragmentArgumentBuffer, id<MTLBuffer> computeArgumentBuffer);
- id<MTLBuffer> m_vertexArgumentBuffer { nil };
- id<MTLBuffer> m_fragmentArgumentBuffer { nil };
- id<MTLBuffer> m_computeArgumentBuffer { nil };
+ const id<MTLBuffer> m_vertexArgumentBuffer { nil };
+ const id<MTLBuffer> m_fragmentArgumentBuffer { nil };
+ const id<MTLBuffer> m_computeArgumentBuffer { nil };
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/BindGroupLayout.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/BindGroupLayout.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/BindGroupLayout.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -52,9 +52,9 @@
private:
BindGroupLayout(id<MTLArgumentEncoder> vertexArgumentEncoder, id<MTLArgumentEncoder> fragmentArgumentEncoder, id<MTLArgumentEncoder> computeArgumentEncoder);
- id<MTLArgumentEncoder> m_vertexArgumentEncoder { nil };
- id<MTLArgumentEncoder> m_fragmentArgumentEncoder { nil };
- id<MTLArgumentEncoder> m_computeArgumentEncoder { nil };
+ const id<MTLArgumentEncoder> m_vertexArgumentEncoder { nil };
+ const id<MTLArgumentEncoder> m_fragmentArgumentEncoder { nil };
+ const id<MTLArgumentEncoder> m_computeArgumentEncoder { nil };
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/CommandBuffer.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/CommandBuffer.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/CommandBuffer.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -48,7 +48,7 @@
private:
CommandBuffer(id<MTLCommandBuffer>);
- id<MTLCommandBuffer> m_commandBuffer { nil };
+ const id<MTLCommandBuffer> m_commandBuffer { nil };
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/ComputePassEncoder.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/ComputePassEncoder.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/ComputePassEncoder.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -64,7 +64,7 @@
bool validatePopDebugGroup() const;
- id<MTLComputeCommandEncoder> m_computeCommandEncoder { nil };
+ const id<MTLComputeCommandEncoder> m_computeCommandEncoder { nil };
uint64_t m_debugGroupStackSize { 0 };
};
Modified: trunk/Source/WebGPU/WebGPU/ComputePipeline.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/ComputePipeline.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/ComputePipeline.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -51,7 +51,7 @@
private:
ComputePipeline(id<MTLComputePipelineState>);
- id<MTLComputePipelineState> m_computePipelineState { nil };
+ const id<MTLComputePipelineState> m_computePipelineState { nil };
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/Device.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/Device.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/Device.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -84,15 +84,15 @@
void setUncapturedErrorCallback(Function<void(WGPUErrorType, String&&)>&&);
void setLabel(String&&);
- Instance& instance() { return m_instance; }
+ Instance& instance() const { return m_instance; }
bool hasUnifiedMemory() const { return m_device.hasUnifiedMemory; }
private:
Device(id<MTLDevice>, id<MTLCommandQueue> defaultQueue, Instance&);
- id<MTLDevice> m_device { nil };
- Ref<Queue> m_defaultQueue;
- Ref<Instance> m_instance;
+ const id<MTLDevice> m_device { nil };
+ const Ref<Queue> m_defaultQueue;
+ const Ref<Instance> m_instance;
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/Instance.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/Instance.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/Instance.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -61,7 +61,7 @@
// This can be used on a background thread.
Deque<WGPUWorkItem> m_pendingWork WTF_GUARDED_BY_LOCK(m_lock);
- WGPUScheduleWorkBlock m_scheduleWorkBlock;
+ const WGPUScheduleWorkBlock m_scheduleWorkBlock;
Lock m_lock;
};
Modified: trunk/Source/WebGPU/WebGPU/QuerySet.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/QuerySet.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/QuerySet.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -49,7 +49,7 @@
private:
QuerySet(id<MTLCounterSampleBuffer>);
- id<MTLCounterSampleBuffer> m_counterSampleBuffer { nil };
+ const id<MTLCounterSampleBuffer> m_counterSampleBuffer { nil };
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/Queue.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/Queue.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/Queue.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -65,8 +65,8 @@
// This can be called on a background thread.
void scheduleWork(Instance::WorkItem&&);
- id<MTLCommandQueue> m_commandQueue { nil };
- Device& m_device; // The only kind of queues that exist right now are default queues, which are owned by Devices.
+ const id<MTLCommandQueue> m_commandQueue { nil };
+ const Device& m_device; // The only kind of queues that exist right now are default queues, which are owned by Devices.
uint64_t m_submittedCommandBufferCount { 0 };
uint64_t m_completedCommandBufferCount { 0 };
Modified: trunk/Source/WebGPU/WebGPU/RenderBundle.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/RenderBundle.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/RenderBundle.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -48,7 +48,7 @@
private:
RenderBundle(id<MTLIndirectCommandBuffer>);
- id<MTLIndirectCommandBuffer> m_indirectCommandBuffer { nil };
+ const id<MTLIndirectCommandBuffer> m_indirectCommandBuffer { nil };
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/RenderBundleEncoder.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/RenderBundleEncoder.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/RenderBundleEncoder.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -67,7 +67,7 @@
bool validatePopDebugGroup() const;
- id<MTLIndirectCommandBuffer> m_indirectCommandBuffer { nil };
+ const id<MTLIndirectCommandBuffer> m_indirectCommandBuffer { nil };
uint64_t m_debugGroupStackSize { 0 };
};
Modified: trunk/Source/WebGPU/WebGPU/RenderPassEncoder.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/RenderPassEncoder.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/RenderPassEncoder.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -77,7 +77,7 @@
bool validatePopDebugGroup() const;
- id<MTLRenderCommandEncoder> m_renderCommandEncoder { nil };
+ const id<MTLRenderCommandEncoder> m_renderCommandEncoder { nil };
uint64_t m_debugGroupStackSize { 0 };
};
Modified: trunk/Source/WebGPU/WebGPU/RenderPipeline.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/RenderPipeline.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/RenderPipeline.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -51,7 +51,7 @@
private:
RenderPipeline(id<MTLRenderPipelineState>);
- id<MTLRenderPipelineState> m_renderPipelineState { nil };
+ const id<MTLRenderPipelineState> m_renderPipelineState { nil };
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/Sampler.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/Sampler.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/Sampler.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -53,9 +53,9 @@
private:
Sampler(id<MTLSamplerState>, const WGPUSamplerDescriptor& descriptor);
- id<MTLSamplerState> m_samplerState { nil };
+ const id<MTLSamplerState> m_samplerState { nil };
- WGPUSamplerDescriptor m_descriptor { }; // "The GPUSamplerDescriptor with which the GPUSampler was created."
+ const WGPUSamplerDescriptor m_descriptor { }; // "The GPUSamplerDescriptor with which the GPUSampler was created."
// "[[isComparison]] of type boolean." This is unnecessary; it's implemented in isComparison().
// "[[isFiltering]] of type boolean." This is unnecessary; it's implemented in isFiltering().
};
Modified: trunk/Source/WebGPU/WebGPU/ShaderModule.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/ShaderModule.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/ShaderModule.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -64,7 +64,7 @@
const std::variant<WGSL::SuccessfulCheck, WGSL::FailedCheck> m_checkResult;
const HashMap<String, Ref<PipelineLayout>> m_pipelineLayoutHints;
const HashMap<String, WGSL::Reflection::EntryPointInformation> m_entryPointInformation;
- id<MTLLibrary> m_library { nil }; // This is only non-null if we could compile the module early.
+ const id<MTLLibrary> m_library { nil }; // This is only non-null if we could compile the module early.
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/Texture.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/Texture.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/Texture.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -53,7 +53,7 @@
private:
Texture(id<MTLTexture>);
- id<MTLTexture> m_texture { nil };
+ const id<MTLTexture> m_texture { nil };
};
} // namespace WebGPU
Modified: trunk/Source/WebGPU/WebGPU/TextureView.h (291388 => 291389)
--- trunk/Source/WebGPU/WebGPU/TextureView.h 2022-03-17 05:25:12 UTC (rev 291388)
+++ trunk/Source/WebGPU/WebGPU/TextureView.h 2022-03-17 07:17:53 UTC (rev 291389)
@@ -48,7 +48,7 @@
private:
TextureView(id<MTLTexture>);
- id<MTLTexture> m_texture { nil };
+ const id<MTLTexture> m_texture { nil };
};
} // namespace WebGPU