[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 <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-05-10 00:14:04 +00:00 committed by Dawn LUCI CQ
parent bfe9f91975
commit efab8c894e
6 changed files with 172 additions and 0 deletions

View File

@ -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<const char*> requiredFeatures;
std::vector<const char*> forceEnabledToggles;
std::vector<const char*> forceDisabledToggles;

View File

@ -361,4 +361,76 @@ void SkipCommand(CommandIterator* commands, Command type) {
}
}
TimestampWrite::TimestampWrite(const Ref<QuerySetBase>& 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

View File

@ -70,20 +70,33 @@ enum class Command {
};
struct TimestampWrite {
TimestampWrite(const Ref<QuerySetBase>& set, uint32_t idx);
TimestampWrite(TimestampWrite&&);
~TimestampWrite();
Ref<QuerySetBase> querySet;
uint32_t queryIndex;
};
struct BeginComputePassCmd {
BeginComputePassCmd();
~BeginComputePassCmd();
std::vector<TimestampWrite> timestampWrites;
};
struct BeginOcclusionQueryCmd {
BeginOcclusionQueryCmd();
~BeginOcclusionQueryCmd();
Ref<QuerySetBase> querySet;
uint32_t queryIndex;
};
struct RenderPassColorAttachmentInfo {
RenderPassColorAttachmentInfo();
~RenderPassColorAttachmentInfo();
Ref<TextureViewBase> view;
Ref<TextureViewBase> resolveTarget;
wgpu::LoadOp loadOp;
@ -92,6 +105,9 @@ struct RenderPassColorAttachmentInfo {
};
struct RenderPassDepthStencilAttachmentInfo {
RenderPassDepthStencilAttachmentInfo();
~RenderPassDepthStencilAttachmentInfo();
Ref<TextureViewBase> view;
wgpu::LoadOp depthLoadOp;
wgpu::StoreOp depthStoreOp;
@ -104,6 +120,9 @@ struct RenderPassDepthStencilAttachmentInfo {
};
struct BeginRenderPassCmd {
BeginRenderPassCmd();
~BeginRenderPassCmd();
Ref<AttachmentState> attachmentState;
ityp::array<ColorAttachmentIndex, RenderPassColorAttachmentInfo, kMaxColorAttachments>
colorAttachments;
@ -118,6 +137,9 @@ struct BeginRenderPassCmd {
};
struct BufferCopy {
BufferCopy();
~BufferCopy();
Ref<BufferBase> buffer;
uint64_t offset;
uint32_t bytesPerRow;
@ -125,6 +147,10 @@ struct BufferCopy {
};
struct TextureCopy {
TextureCopy();
TextureCopy(const TextureCopy&);
~TextureCopy();
Ref<TextureBase> texture;
uint32_t mipLevel;
Origin3D origin; // Texels / array layer
@ -132,6 +158,9 @@ struct TextureCopy {
};
struct CopyBufferToBufferCmd {
CopyBufferToBufferCmd();
~CopyBufferToBufferCmd();
Ref<BufferBase> source;
uint64_t sourceOffset;
Ref<BufferBase> destination;
@ -164,6 +193,9 @@ struct DispatchCmd {
};
struct DispatchIndirectCmd {
DispatchIndirectCmd();
~DispatchIndirectCmd();
Ref<BufferBase> indirectBuffer;
uint64_t indirectOffset;
};
@ -184,6 +216,9 @@ struct DrawIndexedCmd {
};
struct DrawIndirectCmd {
DrawIndirectCmd();
~DrawIndirectCmd();
Ref<BufferBase> indirectBuffer;
uint64_t indirectOffset;
};
@ -191,15 +226,24 @@ struct DrawIndirectCmd {
struct DrawIndexedIndirectCmd : DrawIndirectCmd {};
struct EndComputePassCmd {
EndComputePassCmd();
~EndComputePassCmd();
std::vector<TimestampWrite> timestampWrites;
};
struct EndOcclusionQueryCmd {
EndOcclusionQueryCmd();
~EndOcclusionQueryCmd();
Ref<QuerySetBase> querySet;
uint32_t queryIndex;
};
struct EndRenderPassCmd {
EndRenderPassCmd();
~EndRenderPassCmd();
std::vector<TimestampWrite> timestampWrites;
};
@ -208,6 +252,9 @@ struct ExecuteBundlesCmd {
};
struct ClearBufferCmd {
ClearBufferCmd();
~ClearBufferCmd();
Ref<BufferBase> buffer;
uint64_t offset;
uint64_t size;
@ -224,6 +271,9 @@ struct PushDebugGroupCmd {
};
struct ResolveQuerySetCmd {
ResolveQuerySetCmd();
~ResolveQuerySetCmd();
Ref<QuerySetBase> querySet;
uint32_t firstQuery;
uint32_t queryCount;
@ -232,10 +282,16 @@ struct ResolveQuerySetCmd {
};
struct SetComputePipelineCmd {
SetComputePipelineCmd();
~SetComputePipelineCmd();
Ref<ComputePipelineBase> pipeline;
};
struct SetRenderPipelineCmd {
SetRenderPipelineCmd();
~SetRenderPipelineCmd();
Ref<RenderPipelineBase> pipeline;
};
@ -256,12 +312,18 @@ struct SetBlendConstantCmd {
};
struct SetBindGroupCmd {
SetBindGroupCmd();
~SetBindGroupCmd();
BindGroupIndex index;
Ref<BindGroupBase> group;
uint32_t dynamicOffsetCount;
};
struct SetIndexBufferCmd {
SetIndexBufferCmd();
~SetIndexBufferCmd();
Ref<BufferBase> buffer;
wgpu::IndexFormat format;
uint64_t offset;
@ -269,6 +331,9 @@ struct SetIndexBufferCmd {
};
struct SetVertexBufferCmd {
SetVertexBufferCmd();
~SetVertexBufferCmd();
VertexBufferSlot slot;
Ref<BufferBase> buffer;
uint64_t offset;
@ -276,12 +341,18 @@ struct SetVertexBufferCmd {
};
struct WriteBufferCmd {
WriteBufferCmd();
~WriteBufferCmd();
Ref<BufferBase> buffer;
uint64_t offset;
uint64_t size;
};
struct WriteTimestampCmd {
WriteTimestampCmd();
~WriteTimestampCmd();
Ref<QuerySetBase> querySet;
uint32_t queryIndex;
};

View File

@ -70,6 +70,12 @@ std::vector<const char*> GetTogglesUsed(WGPUDevice device) {
return FromAPI(device)->GetTogglesUsed();
}
// DawnDeviceDescriptor
DawnDeviceDescriptor::DawnDeviceDescriptor() = default;
DawnDeviceDescriptor::~DawnDeviceDescriptor() = default;
// Adapter
Adapter::Adapter() = default;

View File

@ -79,6 +79,18 @@ SampleTypeBit SampleTypeToSampleTypeBit(wgpu::TextureSampleType sampleType) {
return static_cast<SampleTypeBit>(1 << (static_cast<uint32_t>(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;
}

View File

@ -88,6 +88,14 @@ using FormatTable = ityp::array<FormatIndex, Format, kKnownFormatCount>;
// 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.