From efab8c894e30f2ef78dae59b7ce26d43d6854805 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 10 May 2022 00:14:04 +0000 Subject: [PATCH] [chromium-style] Adding constructors and destructors. This CL adds missing constructors and destructors. Bug: dawn:1405 Change-Id: I0a0ea7ca50643d48cfc4a4dcf4ce46ff37ed10ad Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89200 Reviewed-by: Austin Eng Kokoro: Kokoro Commit-Queue: Dan Sinclair --- include/dawn/native/DawnNative.h | 3 ++ src/dawn/native/Commands.cpp | 72 ++++++++++++++++++++++++++++++++ src/dawn/native/Commands.h | 71 +++++++++++++++++++++++++++++++ src/dawn/native/DawnNative.cpp | 6 +++ src/dawn/native/Format.cpp | 12 ++++++ src/dawn/native/Format.h | 8 ++++ 6 files changed, 172 insertions(+) diff --git a/include/dawn/native/DawnNative.h b/include/dawn/native/DawnNative.h index 35410837e4..ad4e6105e5 100644 --- a/include/dawn/native/DawnNative.h +++ b/include/dawn/native/DawnNative.h @@ -39,6 +39,9 @@ class AdapterBase; // An optional parameter of Adapter::CreateDevice() to send additional information when creating // a Device. For example, we can use it to enable a workaround, optimization or feature. struct DAWN_NATIVE_EXPORT DawnDeviceDescriptor { + DawnDeviceDescriptor(); + ~DawnDeviceDescriptor(); + std::vector requiredFeatures; std::vector forceEnabledToggles; std::vector forceDisabledToggles; diff --git a/src/dawn/native/Commands.cpp b/src/dawn/native/Commands.cpp index 019da13be0..6f3d6df467 100644 --- a/src/dawn/native/Commands.cpp +++ b/src/dawn/native/Commands.cpp @@ -361,4 +361,76 @@ void SkipCommand(CommandIterator* commands, Command type) { } } +TimestampWrite::TimestampWrite(const Ref& set, uint32_t idx) + : querySet(set), queryIndex(idx) {} +TimestampWrite::TimestampWrite(TimestampWrite&&) = default; +TimestampWrite::~TimestampWrite() = default; + +BeginComputePassCmd::BeginComputePassCmd() = default; +BeginComputePassCmd::~BeginComputePassCmd() = default; + +BeginOcclusionQueryCmd::BeginOcclusionQueryCmd() = default; +BeginOcclusionQueryCmd::~BeginOcclusionQueryCmd() = default; + +RenderPassColorAttachmentInfo::RenderPassColorAttachmentInfo() = default; +RenderPassColorAttachmentInfo::~RenderPassColorAttachmentInfo() = default; + +RenderPassDepthStencilAttachmentInfo::RenderPassDepthStencilAttachmentInfo() = default; +RenderPassDepthStencilAttachmentInfo::~RenderPassDepthStencilAttachmentInfo() = default; + +BeginRenderPassCmd::BeginRenderPassCmd() = default; +BeginRenderPassCmd::~BeginRenderPassCmd() = default; + +BufferCopy::BufferCopy() = default; +BufferCopy::~BufferCopy() = default; + +TextureCopy::TextureCopy() = default; +TextureCopy::TextureCopy(const TextureCopy&) = default; +TextureCopy::~TextureCopy() = default; + +CopyBufferToBufferCmd::CopyBufferToBufferCmd() = default; +CopyBufferToBufferCmd::~CopyBufferToBufferCmd() = default; + +DispatchIndirectCmd::DispatchIndirectCmd() = default; +DispatchIndirectCmd::~DispatchIndirectCmd() = default; + +DrawIndirectCmd::DrawIndirectCmd() = default; +DrawIndirectCmd::~DrawIndirectCmd() = default; + +EndComputePassCmd::EndComputePassCmd() = default; +EndComputePassCmd::~EndComputePassCmd() = default; + +EndOcclusionQueryCmd::EndOcclusionQueryCmd() = default; +EndOcclusionQueryCmd::~EndOcclusionQueryCmd() = default; + +EndRenderPassCmd::EndRenderPassCmd() = default; +EndRenderPassCmd::~EndRenderPassCmd() = default; + +ClearBufferCmd::ClearBufferCmd() = default; +ClearBufferCmd::~ClearBufferCmd() = default; + +ResolveQuerySetCmd::ResolveQuerySetCmd() = default; +ResolveQuerySetCmd::~ResolveQuerySetCmd() = default; + +SetComputePipelineCmd::SetComputePipelineCmd() = default; +SetComputePipelineCmd::~SetComputePipelineCmd() = default; + +SetRenderPipelineCmd::SetRenderPipelineCmd() = default; +SetRenderPipelineCmd::~SetRenderPipelineCmd() = default; + +SetBindGroupCmd::SetBindGroupCmd() = default; +SetBindGroupCmd::~SetBindGroupCmd() = default; + +SetIndexBufferCmd::SetIndexBufferCmd() = default; +SetIndexBufferCmd::~SetIndexBufferCmd() = default; + +SetVertexBufferCmd::SetVertexBufferCmd() = default; +SetVertexBufferCmd::~SetVertexBufferCmd() = default; + +WriteBufferCmd::WriteBufferCmd() = default; +WriteBufferCmd::~WriteBufferCmd() = default; + +WriteTimestampCmd::WriteTimestampCmd() = default; +WriteTimestampCmd::~WriteTimestampCmd() = default; + } // namespace dawn::native diff --git a/src/dawn/native/Commands.h b/src/dawn/native/Commands.h index 1c7024ac79..c7bfa04211 100644 --- a/src/dawn/native/Commands.h +++ b/src/dawn/native/Commands.h @@ -70,20 +70,33 @@ enum class Command { }; struct TimestampWrite { + TimestampWrite(const Ref& set, uint32_t idx); + TimestampWrite(TimestampWrite&&); + ~TimestampWrite(); + Ref querySet; uint32_t queryIndex; }; struct BeginComputePassCmd { + BeginComputePassCmd(); + ~BeginComputePassCmd(); + std::vector timestampWrites; }; struct BeginOcclusionQueryCmd { + BeginOcclusionQueryCmd(); + ~BeginOcclusionQueryCmd(); + Ref querySet; uint32_t queryIndex; }; struct RenderPassColorAttachmentInfo { + RenderPassColorAttachmentInfo(); + ~RenderPassColorAttachmentInfo(); + Ref view; Ref resolveTarget; wgpu::LoadOp loadOp; @@ -92,6 +105,9 @@ struct RenderPassColorAttachmentInfo { }; struct RenderPassDepthStencilAttachmentInfo { + RenderPassDepthStencilAttachmentInfo(); + ~RenderPassDepthStencilAttachmentInfo(); + Ref view; wgpu::LoadOp depthLoadOp; wgpu::StoreOp depthStoreOp; @@ -104,6 +120,9 @@ struct RenderPassDepthStencilAttachmentInfo { }; struct BeginRenderPassCmd { + BeginRenderPassCmd(); + ~BeginRenderPassCmd(); + Ref attachmentState; ityp::array colorAttachments; @@ -118,6 +137,9 @@ struct BeginRenderPassCmd { }; struct BufferCopy { + BufferCopy(); + ~BufferCopy(); + Ref buffer; uint64_t offset; uint32_t bytesPerRow; @@ -125,6 +147,10 @@ struct BufferCopy { }; struct TextureCopy { + TextureCopy(); + TextureCopy(const TextureCopy&); + ~TextureCopy(); + Ref texture; uint32_t mipLevel; Origin3D origin; // Texels / array layer @@ -132,6 +158,9 @@ struct TextureCopy { }; struct CopyBufferToBufferCmd { + CopyBufferToBufferCmd(); + ~CopyBufferToBufferCmd(); + Ref source; uint64_t sourceOffset; Ref destination; @@ -164,6 +193,9 @@ struct DispatchCmd { }; struct DispatchIndirectCmd { + DispatchIndirectCmd(); + ~DispatchIndirectCmd(); + Ref indirectBuffer; uint64_t indirectOffset; }; @@ -184,6 +216,9 @@ struct DrawIndexedCmd { }; struct DrawIndirectCmd { + DrawIndirectCmd(); + ~DrawIndirectCmd(); + Ref indirectBuffer; uint64_t indirectOffset; }; @@ -191,15 +226,24 @@ struct DrawIndirectCmd { struct DrawIndexedIndirectCmd : DrawIndirectCmd {}; struct EndComputePassCmd { + EndComputePassCmd(); + ~EndComputePassCmd(); + std::vector timestampWrites; }; struct EndOcclusionQueryCmd { + EndOcclusionQueryCmd(); + ~EndOcclusionQueryCmd(); + Ref querySet; uint32_t queryIndex; }; struct EndRenderPassCmd { + EndRenderPassCmd(); + ~EndRenderPassCmd(); + std::vector timestampWrites; }; @@ -208,6 +252,9 @@ struct ExecuteBundlesCmd { }; struct ClearBufferCmd { + ClearBufferCmd(); + ~ClearBufferCmd(); + Ref buffer; uint64_t offset; uint64_t size; @@ -224,6 +271,9 @@ struct PushDebugGroupCmd { }; struct ResolveQuerySetCmd { + ResolveQuerySetCmd(); + ~ResolveQuerySetCmd(); + Ref querySet; uint32_t firstQuery; uint32_t queryCount; @@ -232,10 +282,16 @@ struct ResolveQuerySetCmd { }; struct SetComputePipelineCmd { + SetComputePipelineCmd(); + ~SetComputePipelineCmd(); + Ref pipeline; }; struct SetRenderPipelineCmd { + SetRenderPipelineCmd(); + ~SetRenderPipelineCmd(); + Ref pipeline; }; @@ -256,12 +312,18 @@ struct SetBlendConstantCmd { }; struct SetBindGroupCmd { + SetBindGroupCmd(); + ~SetBindGroupCmd(); + BindGroupIndex index; Ref group; uint32_t dynamicOffsetCount; }; struct SetIndexBufferCmd { + SetIndexBufferCmd(); + ~SetIndexBufferCmd(); + Ref buffer; wgpu::IndexFormat format; uint64_t offset; @@ -269,6 +331,9 @@ struct SetIndexBufferCmd { }; struct SetVertexBufferCmd { + SetVertexBufferCmd(); + ~SetVertexBufferCmd(); + VertexBufferSlot slot; Ref buffer; uint64_t offset; @@ -276,12 +341,18 @@ struct SetVertexBufferCmd { }; struct WriteBufferCmd { + WriteBufferCmd(); + ~WriteBufferCmd(); + Ref buffer; uint64_t offset; uint64_t size; }; struct WriteTimestampCmd { + WriteTimestampCmd(); + ~WriteTimestampCmd(); + Ref querySet; uint32_t queryIndex; }; diff --git a/src/dawn/native/DawnNative.cpp b/src/dawn/native/DawnNative.cpp index e17c0549f7..69296ef27c 100644 --- a/src/dawn/native/DawnNative.cpp +++ b/src/dawn/native/DawnNative.cpp @@ -70,6 +70,12 @@ std::vector GetTogglesUsed(WGPUDevice device) { return FromAPI(device)->GetTogglesUsed(); } +// DawnDeviceDescriptor + +DawnDeviceDescriptor::DawnDeviceDescriptor() = default; + +DawnDeviceDescriptor::~DawnDeviceDescriptor() = default; + // Adapter Adapter::Adapter() = default; diff --git a/src/dawn/native/Format.cpp b/src/dawn/native/Format.cpp index f1b4cb87ce..7027272f32 100644 --- a/src/dawn/native/Format.cpp +++ b/src/dawn/native/Format.cpp @@ -79,6 +79,18 @@ SampleTypeBit SampleTypeToSampleTypeBit(wgpu::TextureSampleType sampleType) { return static_cast(1 << (static_cast(sampleType) - 1)); } +Format::Format() = default; + +Format::Format(const Format&) = default; + +Format::Format(Format&&) = default; + +Format::~Format() = default; + +Format& Format::operator=(const Format&) = default; + +Format& Format::operator=(Format&&) = default; + bool Format::IsColor() const { return aspects == Aspect::Color; } diff --git a/src/dawn/native/Format.h b/src/dawn/native/Format.h index b48e998f1d..64f1801418 100644 --- a/src/dawn/native/Format.h +++ b/src/dawn/native/Format.h @@ -88,6 +88,14 @@ using FormatTable = ityp::array; // A wgpu::TextureFormat along with all the information about it necessary for validation. struct Format { + Format(); + Format(const Format&); + Format(Format&&); + ~Format(); + + Format& operator=(const Format&); + Format& operator=(Format&&); + wgpu::TextureFormat format; // TODO(crbug.com/dawn/1332): These members could be stored in a Format capability matrix.