[chromium-style] Adding/moving constructors and destructors.
This CL adds some missing constructors and destructors. Others are moved from the header file to implementation files. Bug: dawn:1405 Change-Id: I17e98f6da48518112bafb0876679cc3989ba2548 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89160 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
c5931800f2
commit
357bfa89d8
|
@ -66,6 +66,10 @@ android_LogPriority AndroidLogPriority(LogSeverity severity) {
|
||||||
|
|
||||||
LogMessage::LogMessage(LogSeverity severity) : mSeverity(severity) {}
|
LogMessage::LogMessage(LogSeverity severity) : mSeverity(severity) {}
|
||||||
|
|
||||||
|
LogMessage::LogMessage(LogMessage&& other) = default;
|
||||||
|
|
||||||
|
LogMessage& LogMessage::operator=(LogMessage&& other) = default;
|
||||||
|
|
||||||
LogMessage::~LogMessage() {
|
LogMessage::~LogMessage() {
|
||||||
std::string fullMessage = mStream.str();
|
std::string fullMessage = mStream.str();
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,8 @@ class LogMessage {
|
||||||
explicit LogMessage(LogSeverity severity);
|
explicit LogMessage(LogSeverity severity);
|
||||||
~LogMessage();
|
~LogMessage();
|
||||||
|
|
||||||
LogMessage(LogMessage&& other) = default;
|
LogMessage(LogMessage&& other);
|
||||||
LogMessage& operator=(LogMessage&& other) = default;
|
LogMessage& operator=(LogMessage&& other);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
LogMessage& operator<<(T&& value) {
|
LogMessage& operator<<(T&& value) {
|
||||||
|
|
|
@ -205,6 +205,8 @@ std::optional<std::string> GetModuleDirectory() {
|
||||||
|
|
||||||
// ScopedEnvironmentVar
|
// ScopedEnvironmentVar
|
||||||
|
|
||||||
|
ScopedEnvironmentVar::ScopedEnvironmentVar() = default;
|
||||||
|
|
||||||
ScopedEnvironmentVar::ScopedEnvironmentVar(const char* variableName, const char* value)
|
ScopedEnvironmentVar::ScopedEnvironmentVar(const char* variableName, const char* value)
|
||||||
: mName(variableName),
|
: mName(variableName),
|
||||||
mOriginalValue(GetEnvironmentVar(variableName)),
|
mOriginalValue(GetEnvironmentVar(variableName)),
|
||||||
|
|
|
@ -40,7 +40,7 @@ bool IsMacOSVersionAtLeast(uint32_t majorVersion, uint32_t minorVersion = 0);
|
||||||
|
|
||||||
class ScopedEnvironmentVar {
|
class ScopedEnvironmentVar {
|
||||||
public:
|
public:
|
||||||
ScopedEnvironmentVar() = default;
|
ScopedEnvironmentVar();
|
||||||
ScopedEnvironmentVar(const char* variableName, const char* value);
|
ScopedEnvironmentVar(const char* variableName, const char* value);
|
||||||
~ScopedEnvironmentVar();
|
~ScopedEnvironmentVar();
|
||||||
|
|
||||||
|
|
|
@ -253,6 +253,7 @@ source_set("sources") {
|
||||||
"ObjectBase.h",
|
"ObjectBase.h",
|
||||||
"ObjectContentHasher.cpp",
|
"ObjectContentHasher.cpp",
|
||||||
"ObjectContentHasher.h",
|
"ObjectContentHasher.h",
|
||||||
|
"PassResourceUsage.cpp",
|
||||||
"PassResourceUsage.h",
|
"PassResourceUsage.h",
|
||||||
"PassResourceUsageTracker.cpp",
|
"PassResourceUsageTracker.cpp",
|
||||||
"PassResourceUsageTracker.h",
|
"PassResourceUsageTracker.h",
|
||||||
|
|
|
@ -119,6 +119,7 @@ target_sources(dawn_native PRIVATE
|
||||||
"Limits.h"
|
"Limits.h"
|
||||||
"ObjectBase.cpp"
|
"ObjectBase.cpp"
|
||||||
"ObjectBase.h"
|
"ObjectBase.h"
|
||||||
|
"PassResourceUsage.cpp"
|
||||||
"PassResourceUsage.h"
|
"PassResourceUsage.h"
|
||||||
"PassResourceUsageTracker.cpp"
|
"PassResourceUsageTracker.cpp"
|
||||||
"PassResourceUsageTracker.h"
|
"PassResourceUsageTracker.h"
|
||||||
|
|
|
@ -70,6 +70,20 @@ static constexpr CommandBufferStateTracker::ValidationAspects kLazyAspects =
|
||||||
1 << VALIDATION_ASPECT_BIND_GROUPS | 1 << VALIDATION_ASPECT_VERTEX_BUFFERS |
|
1 << VALIDATION_ASPECT_BIND_GROUPS | 1 << VALIDATION_ASPECT_VERTEX_BUFFERS |
|
||||||
1 << VALIDATION_ASPECT_INDEX_BUFFER;
|
1 << VALIDATION_ASPECT_INDEX_BUFFER;
|
||||||
|
|
||||||
|
CommandBufferStateTracker::CommandBufferStateTracker() = default;
|
||||||
|
|
||||||
|
CommandBufferStateTracker::CommandBufferStateTracker(const CommandBufferStateTracker&) = default;
|
||||||
|
|
||||||
|
CommandBufferStateTracker::CommandBufferStateTracker(CommandBufferStateTracker&&) = default;
|
||||||
|
|
||||||
|
CommandBufferStateTracker::~CommandBufferStateTracker() = default;
|
||||||
|
|
||||||
|
CommandBufferStateTracker& CommandBufferStateTracker::operator=(const CommandBufferStateTracker&) =
|
||||||
|
default;
|
||||||
|
|
||||||
|
CommandBufferStateTracker& CommandBufferStateTracker::operator=(CommandBufferStateTracker&&) =
|
||||||
|
default;
|
||||||
|
|
||||||
MaybeError CommandBufferStateTracker::ValidateCanDispatch() {
|
MaybeError CommandBufferStateTracker::ValidateCanDispatch() {
|
||||||
return ValidateOperation(kDispatchAspects);
|
return ValidateOperation(kDispatchAspects);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,14 @@ namespace dawn::native {
|
||||||
|
|
||||||
class CommandBufferStateTracker {
|
class CommandBufferStateTracker {
|
||||||
public:
|
public:
|
||||||
|
CommandBufferStateTracker();
|
||||||
|
CommandBufferStateTracker(const CommandBufferStateTracker&);
|
||||||
|
CommandBufferStateTracker(CommandBufferStateTracker&&);
|
||||||
|
~CommandBufferStateTracker();
|
||||||
|
|
||||||
|
CommandBufferStateTracker& operator=(const CommandBufferStateTracker&);
|
||||||
|
CommandBufferStateTracker& operator=(CommandBufferStateTracker&&);
|
||||||
|
|
||||||
// Non-state-modifying validation functions
|
// Non-state-modifying validation functions
|
||||||
MaybeError ValidateCanDispatch();
|
MaybeError ValidateCanDispatch();
|
||||||
MaybeError ValidateCanDraw();
|
MaybeError ValidateCanDraw();
|
||||||
|
|
|
@ -42,6 +42,8 @@ OwnedCompilationMessages::OwnedCompilationMessages() {
|
||||||
mCompilationInfo.messages = nullptr;
|
mCompilationInfo.messages = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OwnedCompilationMessages::~OwnedCompilationMessages() = default;
|
||||||
|
|
||||||
void OwnedCompilationMessages::AddMessageForTesting(std::string message,
|
void OwnedCompilationMessages::AddMessageForTesting(std::string message,
|
||||||
wgpu::CompilationMessageType type,
|
wgpu::CompilationMessageType type,
|
||||||
uint64_t lineNum,
|
uint64_t lineNum,
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace dawn::native {
|
||||||
class OwnedCompilationMessages : public NonCopyable {
|
class OwnedCompilationMessages : public NonCopyable {
|
||||||
public:
|
public:
|
||||||
OwnedCompilationMessages();
|
OwnedCompilationMessages();
|
||||||
~OwnedCompilationMessages() = default;
|
~OwnedCompilationMessages();
|
||||||
|
|
||||||
void AddMessageForTesting(
|
void AddMessageForTesting(
|
||||||
std::string message,
|
std::string message,
|
||||||
|
|
|
@ -35,6 +35,8 @@ std::unique_ptr<ErrorData> ErrorData::Create(InternalErrorType type,
|
||||||
ErrorData::ErrorData(InternalErrorType type, std::string message)
|
ErrorData::ErrorData(InternalErrorType type, std::string message)
|
||||||
: mType(type), mMessage(std::move(message)) {}
|
: mType(type), mMessage(std::move(message)) {}
|
||||||
|
|
||||||
|
ErrorData::~ErrorData() = default;
|
||||||
|
|
||||||
void ErrorData::AppendBacktrace(const char* file, const char* function, int line) {
|
void ErrorData::AppendBacktrace(const char* file, const char* function, int line) {
|
||||||
BacktraceRecord record;
|
BacktraceRecord record;
|
||||||
record.file = file;
|
record.file = file;
|
||||||
|
|
|
@ -41,6 +41,7 @@ class [[nodiscard]] ErrorData {
|
||||||
const char* function,
|
const char* function,
|
||||||
int line);
|
int line);
|
||||||
ErrorData(InternalErrorType type, std::string message);
|
ErrorData(InternalErrorType type, std::string message);
|
||||||
|
~ErrorData();
|
||||||
|
|
||||||
struct BacktraceRecord {
|
struct BacktraceRecord {
|
||||||
const char* file;
|
const char* file;
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright 2022 The Dawn Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
#include "dawn/native/PassResourceUsage.h"
|
||||||
|
|
||||||
|
namespace dawn::native {
|
||||||
|
|
||||||
|
ComputePassResourceUsage::ComputePassResourceUsage() = default;
|
||||||
|
|
||||||
|
ComputePassResourceUsage::ComputePassResourceUsage(ComputePassResourceUsage&&) = default;
|
||||||
|
|
||||||
|
} // namespace dawn::native
|
|
@ -58,8 +58,8 @@ struct ComputePassResourceUsage {
|
||||||
// Somehow without this defaulted constructor, MSVC or its STDlib have an issue where they
|
// Somehow without this defaulted constructor, MSVC or its STDlib have an issue where they
|
||||||
// use the copy constructor (that's deleted) when doing operations on a
|
// use the copy constructor (that's deleted) when doing operations on a
|
||||||
// vector<ComputePassResourceUsage>
|
// vector<ComputePassResourceUsage>
|
||||||
ComputePassResourceUsage(ComputePassResourceUsage&&) = default;
|
ComputePassResourceUsage(ComputePassResourceUsage&&);
|
||||||
ComputePassResourceUsage() = default;
|
ComputePassResourceUsage();
|
||||||
|
|
||||||
std::vector<SyncScopeResourceUsage> dispatchUsages;
|
std::vector<SyncScopeResourceUsage> dispatchUsages;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,14 @@
|
||||||
|
|
||||||
namespace dawn::native {
|
namespace dawn::native {
|
||||||
|
|
||||||
|
SyncScopeUsageTracker::SyncScopeUsageTracker() = default;
|
||||||
|
|
||||||
|
SyncScopeUsageTracker::SyncScopeUsageTracker(SyncScopeUsageTracker&&) = default;
|
||||||
|
|
||||||
|
SyncScopeUsageTracker::~SyncScopeUsageTracker() = default;
|
||||||
|
|
||||||
|
SyncScopeUsageTracker& SyncScopeUsageTracker::operator=(SyncScopeUsageTracker&&) = default;
|
||||||
|
|
||||||
void SyncScopeUsageTracker::BufferUsedAs(BufferBase* buffer, wgpu::BufferUsage usage) {
|
void SyncScopeUsageTracker::BufferUsedAs(BufferBase* buffer, wgpu::BufferUsage usage) {
|
||||||
// std::map's operator[] will create the key and return 0 if the key didn't exist
|
// std::map's operator[] will create the key and return 0 if the key didn't exist
|
||||||
// before.
|
// before.
|
||||||
|
@ -165,6 +173,10 @@ SyncScopeResourceUsage SyncScopeUsageTracker::AcquireSyncScopeUsage() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComputePassResourceUsageTracker::ComputePassResourceUsageTracker() = default;
|
||||||
|
|
||||||
|
ComputePassResourceUsageTracker::~ComputePassResourceUsageTracker() = default;
|
||||||
|
|
||||||
void ComputePassResourceUsageTracker::AddDispatch(SyncScopeResourceUsage scope) {
|
void ComputePassResourceUsageTracker::AddDispatch(SyncScopeResourceUsage scope) {
|
||||||
mUsage.dispatchUsages.push_back(std::move(scope));
|
mUsage.dispatchUsages.push_back(std::move(scope));
|
||||||
}
|
}
|
||||||
|
@ -206,6 +218,16 @@ ComputePassResourceUsage ComputePassResourceUsageTracker::AcquireResourceUsage()
|
||||||
return std::move(mUsage);
|
return std::move(mUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderPassResourceUsageTracker::RenderPassResourceUsageTracker() = default;
|
||||||
|
|
||||||
|
RenderPassResourceUsageTracker::RenderPassResourceUsageTracker(RenderPassResourceUsageTracker&&) =
|
||||||
|
default;
|
||||||
|
|
||||||
|
RenderPassResourceUsageTracker::~RenderPassResourceUsageTracker() = default;
|
||||||
|
|
||||||
|
RenderPassResourceUsageTracker& RenderPassResourceUsageTracker::operator=(
|
||||||
|
RenderPassResourceUsageTracker&&) = default;
|
||||||
|
|
||||||
RenderPassResourceUsage RenderPassResourceUsageTracker::AcquireResourceUsage() {
|
RenderPassResourceUsage RenderPassResourceUsageTracker::AcquireResourceUsage() {
|
||||||
RenderPassResourceUsage result;
|
RenderPassResourceUsage result;
|
||||||
*static_cast<SyncScopeResourceUsage*>(&result) = AcquireSyncScopeUsage();
|
*static_cast<SyncScopeResourceUsage*>(&result) = AcquireSyncScopeUsage();
|
||||||
|
|
|
@ -36,6 +36,12 @@ using QueryAvailabilityMap = std::map<QuerySetBase*, std::vector<bool>>;
|
||||||
// Helper class to build SyncScopeResourceUsages
|
// Helper class to build SyncScopeResourceUsages
|
||||||
class SyncScopeUsageTracker {
|
class SyncScopeUsageTracker {
|
||||||
public:
|
public:
|
||||||
|
SyncScopeUsageTracker();
|
||||||
|
SyncScopeUsageTracker(SyncScopeUsageTracker&&);
|
||||||
|
~SyncScopeUsageTracker();
|
||||||
|
|
||||||
|
SyncScopeUsageTracker& operator=(SyncScopeUsageTracker&&);
|
||||||
|
|
||||||
void BufferUsedAs(BufferBase* buffer, wgpu::BufferUsage usage);
|
void BufferUsedAs(BufferBase* buffer, wgpu::BufferUsage usage);
|
||||||
void TextureViewUsedAs(TextureViewBase* texture, wgpu::TextureUsage usage);
|
void TextureViewUsedAs(TextureViewBase* texture, wgpu::TextureUsage usage);
|
||||||
void AddRenderBundleTextureUsage(TextureBase* texture,
|
void AddRenderBundleTextureUsage(TextureBase* texture,
|
||||||
|
@ -56,6 +62,9 @@ class SyncScopeUsageTracker {
|
||||||
// Helper class to build ComputePassResourceUsages
|
// Helper class to build ComputePassResourceUsages
|
||||||
class ComputePassResourceUsageTracker {
|
class ComputePassResourceUsageTracker {
|
||||||
public:
|
public:
|
||||||
|
ComputePassResourceUsageTracker();
|
||||||
|
~ComputePassResourceUsageTracker();
|
||||||
|
|
||||||
void AddDispatch(SyncScopeResourceUsage scope);
|
void AddDispatch(SyncScopeResourceUsage scope);
|
||||||
void AddReferencedBuffer(BufferBase* buffer);
|
void AddReferencedBuffer(BufferBase* buffer);
|
||||||
void AddResourcesReferencedByBindGroup(BindGroupBase* group);
|
void AddResourcesReferencedByBindGroup(BindGroupBase* group);
|
||||||
|
@ -69,6 +78,12 @@ class ComputePassResourceUsageTracker {
|
||||||
// Helper class to build RenderPassResourceUsages
|
// Helper class to build RenderPassResourceUsages
|
||||||
class RenderPassResourceUsageTracker : public SyncScopeUsageTracker {
|
class RenderPassResourceUsageTracker : public SyncScopeUsageTracker {
|
||||||
public:
|
public:
|
||||||
|
RenderPassResourceUsageTracker();
|
||||||
|
RenderPassResourceUsageTracker(RenderPassResourceUsageTracker&&);
|
||||||
|
~RenderPassResourceUsageTracker();
|
||||||
|
|
||||||
|
RenderPassResourceUsageTracker& operator=(RenderPassResourceUsageTracker&&);
|
||||||
|
|
||||||
void TrackQueryAvailability(QuerySetBase* querySet, uint32_t queryIndex);
|
void TrackQueryAvailability(QuerySetBase* querySet, uint32_t queryIndex);
|
||||||
const QueryAvailabilityMap& GetQueryAvailabilityMap() const;
|
const QueryAvailabilityMap& GetQueryAvailabilityMap() const;
|
||||||
|
|
||||||
|
|
|
@ -546,6 +546,8 @@ TextureBase::TextureBase(DeviceBase* device,
|
||||||
TrackInDevice();
|
TrackInDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextureBase::~TextureBase() = default;
|
||||||
|
|
||||||
static Format kUnusedFormat;
|
static Format kUnusedFormat;
|
||||||
|
|
||||||
TextureBase::TextureBase(DeviceBase* device, TextureState state)
|
TextureBase::TextureBase(DeviceBase* device, TextureState state)
|
||||||
|
@ -789,6 +791,8 @@ TextureViewBase::TextureViewBase(TextureBase* texture)
|
||||||
TextureViewBase::TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag)
|
TextureViewBase::TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag)
|
||||||
: ApiObjectBase(device, tag), mFormat(kUnusedFormat) {}
|
: ApiObjectBase(device, tag), mFormat(kUnusedFormat) {}
|
||||||
|
|
||||||
|
TextureViewBase::~TextureViewBase() = default;
|
||||||
|
|
||||||
void TextureViewBase::DestroyImpl() {}
|
void TextureViewBase::DestroyImpl() {}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
@ -46,7 +46,9 @@ class TextureBase : public ApiObjectBase {
|
||||||
public:
|
public:
|
||||||
enum class TextureState { OwnedInternal, OwnedExternal, Destroyed };
|
enum class TextureState { OwnedInternal, OwnedExternal, Destroyed };
|
||||||
enum class ClearValue { Zero, NonZero };
|
enum class ClearValue { Zero, NonZero };
|
||||||
|
|
||||||
TextureBase(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state);
|
TextureBase(DeviceBase* device, const TextureDescriptor* descriptor, TextureState state);
|
||||||
|
~TextureBase() override;
|
||||||
|
|
||||||
static TextureBase* MakeError(DeviceBase* device);
|
static TextureBase* MakeError(DeviceBase* device);
|
||||||
|
|
||||||
|
@ -124,6 +126,7 @@ class TextureBase : public ApiObjectBase {
|
||||||
class TextureViewBase : public ApiObjectBase {
|
class TextureViewBase : public ApiObjectBase {
|
||||||
public:
|
public:
|
||||||
TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor);
|
TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor);
|
||||||
|
~TextureViewBase() override;
|
||||||
|
|
||||||
static TextureViewBase* MakeError(DeviceBase* device);
|
static TextureViewBase* MakeError(DeviceBase* device);
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,8 @@ ComboRenderPassDescriptor::ComboRenderPassDescriptor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComboRenderPassDescriptor::~ComboRenderPassDescriptor() = default;
|
||||||
|
|
||||||
ComboRenderPassDescriptor::ComboRenderPassDescriptor(const ComboRenderPassDescriptor& other) {
|
ComboRenderPassDescriptor::ComboRenderPassDescriptor(const ComboRenderPassDescriptor& other) {
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
@ -349,6 +351,11 @@ BindingInitializationHelper::BindingInitializationHelper(uint32_t binding,
|
||||||
uint64_t size)
|
uint64_t size)
|
||||||
: binding(binding), buffer(buffer), offset(offset), size(size) {}
|
: binding(binding), buffer(buffer), offset(offset), size(size) {}
|
||||||
|
|
||||||
|
BindingInitializationHelper::BindingInitializationHelper(const BindingInitializationHelper&) =
|
||||||
|
default;
|
||||||
|
|
||||||
|
BindingInitializationHelper::~BindingInitializationHelper() = default;
|
||||||
|
|
||||||
wgpu::BindGroupEntry BindingInitializationHelper::GetAsBinding() const {
|
wgpu::BindGroupEntry BindingInitializationHelper::GetAsBinding() const {
|
||||||
wgpu::BindGroupEntry result;
|
wgpu::BindGroupEntry result;
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ struct ComboRenderPassDescriptor : public wgpu::RenderPassDescriptor {
|
||||||
public:
|
public:
|
||||||
ComboRenderPassDescriptor(std::initializer_list<wgpu::TextureView> colorAttachmentInfo,
|
ComboRenderPassDescriptor(std::initializer_list<wgpu::TextureView> colorAttachmentInfo,
|
||||||
wgpu::TextureView depthStencil = wgpu::TextureView());
|
wgpu::TextureView depthStencil = wgpu::TextureView());
|
||||||
|
~ComboRenderPassDescriptor();
|
||||||
|
|
||||||
ComboRenderPassDescriptor(const ComboRenderPassDescriptor& otherRenderPass);
|
ComboRenderPassDescriptor(const ComboRenderPassDescriptor& otherRenderPass);
|
||||||
const ComboRenderPassDescriptor& operator=(const ComboRenderPassDescriptor& otherRenderPass);
|
const ComboRenderPassDescriptor& operator=(const ComboRenderPassDescriptor& otherRenderPass);
|
||||||
|
@ -158,6 +159,8 @@ struct BindingInitializationHelper {
|
||||||
const wgpu::Buffer& buffer,
|
const wgpu::Buffer& buffer,
|
||||||
uint64_t offset = 0,
|
uint64_t offset = 0,
|
||||||
uint64_t size = wgpu::kWholeSize);
|
uint64_t size = wgpu::kWholeSize);
|
||||||
|
BindingInitializationHelper(const BindingInitializationHelper&);
|
||||||
|
~BindingInitializationHelper();
|
||||||
|
|
||||||
wgpu::BindGroupEntry GetAsBinding() const;
|
wgpu::BindGroupEntry GetAsBinding() const;
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,8 @@ dawn_component("wire") {
|
||||||
"client/LimitsAndFeatures.cpp",
|
"client/LimitsAndFeatures.cpp",
|
||||||
"client/LimitsAndFeatures.h",
|
"client/LimitsAndFeatures.h",
|
||||||
"client/ObjectAllocator.h",
|
"client/ObjectAllocator.h",
|
||||||
|
"client/ObjectBase.cpp",
|
||||||
|
"client/ObjectBase.h",
|
||||||
"client/Queue.cpp",
|
"client/Queue.cpp",
|
||||||
"client/Queue.h",
|
"client/Queue.h",
|
||||||
"client/RequestTracker.h",
|
"client/RequestTracker.h",
|
||||||
|
|
|
@ -62,6 +62,8 @@ target_sources(dawn_wire PRIVATE
|
||||||
"client/LimitsAndFeatures.cpp"
|
"client/LimitsAndFeatures.cpp"
|
||||||
"client/LimitsAndFeatures.h"
|
"client/LimitsAndFeatures.h"
|
||||||
"client/ObjectAllocator.h"
|
"client/ObjectAllocator.h"
|
||||||
|
"client/ObjectBase.cpp"
|
||||||
|
"client/ObjectBase.h"
|
||||||
"client/Queue.cpp"
|
"client/Queue.cpp"
|
||||||
"client/Queue.h"
|
"client/Queue.h"
|
||||||
"client/RequestTracker.h"
|
"client/RequestTracker.h"
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
||||||
|
Adapter::Adapter(Client* c, uint32_t r, uint32_t i) : ObjectBase(c, r, i) {}
|
||||||
|
|
||||||
Adapter::~Adapter() {
|
Adapter::~Adapter() {
|
||||||
mRequestDeviceRequests.CloseAll([](RequestDeviceData* request) {
|
mRequestDeviceRequests.CloseAll([](RequestDeviceData* request) {
|
||||||
request->callback(WGPURequestDeviceStatus_Unknown, nullptr,
|
request->callback(WGPURequestDeviceStatus_Unknown, nullptr,
|
||||||
|
|
|
@ -29,7 +29,9 @@ class Adapter final : public ObjectBase {
|
||||||
public:
|
public:
|
||||||
using ObjectBase::ObjectBase;
|
using ObjectBase::ObjectBase;
|
||||||
|
|
||||||
|
Adapter(Client* client, uint32_t refcount, uint32_t id);
|
||||||
~Adapter();
|
~Adapter();
|
||||||
|
|
||||||
void CancelCallbacksForDisconnect() override;
|
void CancelCallbacksForDisconnect() override;
|
||||||
|
|
||||||
bool GetLimits(WGPUSupportedLimits* limits) const;
|
bool GetLimits(WGPUSupportedLimits* limits) const;
|
||||||
|
|
|
@ -137,6 +137,8 @@ WGPUBuffer Buffer::CreateError(Device* device) {
|
||||||
return ToAPI(allocation->object.get());
|
return ToAPI(allocation->object.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Buffer::Buffer(Client* c, uint32_t r, uint32_t i) : ObjectBase(c, r, i) {}
|
||||||
|
|
||||||
Buffer::~Buffer() {
|
Buffer::~Buffer() {
|
||||||
ClearAllCallbacks(WGPUBufferMapAsyncStatus_DestroyedBeforeCallback);
|
ClearAllCallbacks(WGPUBufferMapAsyncStatus_DestroyedBeforeCallback);
|
||||||
FreeMappedData();
|
FreeMappedData();
|
||||||
|
|
|
@ -33,6 +33,7 @@ class Buffer final : public ObjectBase {
|
||||||
static WGPUBuffer Create(Device* device, const WGPUBufferDescriptor* descriptor);
|
static WGPUBuffer Create(Device* device, const WGPUBufferDescriptor* descriptor);
|
||||||
static WGPUBuffer CreateError(Device* device);
|
static WGPUBuffer CreateError(Device* device);
|
||||||
|
|
||||||
|
Buffer(Client* client, uint32_t refcount, uint32_t id);
|
||||||
~Buffer();
|
~Buffer();
|
||||||
|
|
||||||
bool OnMapAsyncCallback(uint64_t requestSerial,
|
bool OnMapAsyncCallback(uint64_t requestSerial,
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
||||||
|
Instance::Instance(Client* c, uint32_t r, uint32_t i) : ObjectBase(c, r, i) {}
|
||||||
|
|
||||||
Instance::~Instance() {
|
Instance::~Instance() {
|
||||||
mRequestAdapterRequests.CloseAll([](RequestAdapterData* request) {
|
mRequestAdapterRequests.CloseAll([](RequestAdapterData* request) {
|
||||||
request->callback(WGPURequestAdapterStatus_Unknown, nullptr,
|
request->callback(WGPURequestAdapterStatus_Unknown, nullptr,
|
||||||
|
|
|
@ -28,7 +28,9 @@ class Instance final : public ObjectBase {
|
||||||
public:
|
public:
|
||||||
using ObjectBase::ObjectBase;
|
using ObjectBase::ObjectBase;
|
||||||
|
|
||||||
|
Instance(Client* client, uint32_t refcount, uint32_t id);
|
||||||
~Instance();
|
~Instance();
|
||||||
|
|
||||||
void CancelCallbacksForDisconnect() override;
|
void CancelCallbacksForDisconnect() override;
|
||||||
|
|
||||||
void RequestAdapter(const WGPURequestAdapterOptions* options,
|
void RequestAdapter(const WGPURequestAdapterOptions* options,
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
||||||
|
LimitsAndFeatures::LimitsAndFeatures() = default;
|
||||||
|
|
||||||
|
LimitsAndFeatures::~LimitsAndFeatures() = default;
|
||||||
|
|
||||||
bool LimitsAndFeatures::GetLimits(WGPUSupportedLimits* limits) const {
|
bool LimitsAndFeatures::GetLimits(WGPUSupportedLimits* limits) const {
|
||||||
ASSERT(limits != nullptr);
|
ASSERT(limits != nullptr);
|
||||||
if (limits->nextInChain != nullptr) {
|
if (limits->nextInChain != nullptr) {
|
||||||
|
|
|
@ -23,6 +23,9 @@ namespace dawn::wire::client {
|
||||||
|
|
||||||
class LimitsAndFeatures {
|
class LimitsAndFeatures {
|
||||||
public:
|
public:
|
||||||
|
LimitsAndFeatures();
|
||||||
|
~LimitsAndFeatures();
|
||||||
|
|
||||||
bool GetLimits(WGPUSupportedLimits* limits) const;
|
bool GetLimits(WGPUSupportedLimits* limits) const;
|
||||||
bool HasFeature(WGPUFeatureName feature) const;
|
bool HasFeature(WGPUFeatureName feature) const;
|
||||||
size_t EnumerateFeatures(WGPUFeatureName* features) const;
|
size_t EnumerateFeatures(WGPUFeatureName* features) const;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright 2022 The Dawn Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
#include "dawn/wire/client/ObjectBase.h"
|
||||||
|
|
||||||
|
namespace dawn::wire::client {
|
||||||
|
|
||||||
|
ObjectBase::ObjectBase(Client* client, uint32_t refcount, uint32_t id)
|
||||||
|
: client(client), refcount(refcount), id(id) {}
|
||||||
|
|
||||||
|
ObjectBase::~ObjectBase() {
|
||||||
|
RemoveFromList();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dawn::wire::client
|
|
@ -30,10 +30,8 @@ class Client;
|
||||||
// - An ID that is used to refer to this object when talking with the server side
|
// - An ID that is used to refer to this object when talking with the server side
|
||||||
// - A next/prev pointer. They are part of a linked list of objects of the same type.
|
// - A next/prev pointer. They are part of a linked list of objects of the same type.
|
||||||
struct ObjectBase : public LinkNode<ObjectBase> {
|
struct ObjectBase : public LinkNode<ObjectBase> {
|
||||||
ObjectBase(Client* client, uint32_t refcount, uint32_t id)
|
ObjectBase(Client* client, uint32_t refcount, uint32_t id);
|
||||||
: client(client), refcount(refcount), id(id) {}
|
~ObjectBase();
|
||||||
|
|
||||||
~ObjectBase() { RemoveFromList(); }
|
|
||||||
|
|
||||||
virtual void CancelCallbacksForDisconnect() {}
|
virtual void CancelCallbacksForDisconnect() {}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
||||||
|
Queue::Queue(Client* c, uint32_t r, uint32_t i) : ObjectBase(c, r, i) {}
|
||||||
|
|
||||||
Queue::~Queue() {
|
Queue::~Queue() {
|
||||||
ClearAllCallbacks(WGPUQueueWorkDoneStatus_Unknown);
|
ClearAllCallbacks(WGPUQueueWorkDoneStatus_Unknown);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ namespace dawn::wire::client {
|
||||||
class Queue final : public ObjectBase {
|
class Queue final : public ObjectBase {
|
||||||
public:
|
public:
|
||||||
using ObjectBase::ObjectBase;
|
using ObjectBase::ObjectBase;
|
||||||
|
|
||||||
|
Queue(Client* client, uint32_t refcount, uint32_t id);
|
||||||
~Queue();
|
~Queue();
|
||||||
|
|
||||||
bool OnWorkDoneCallback(uint64_t requestSerial, WGPUQueueWorkDoneStatus status);
|
bool OnWorkDoneCallback(uint64_t requestSerial, WGPUQueueWorkDoneStatus status);
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
namespace dawn::wire::client {
|
namespace dawn::wire::client {
|
||||||
|
|
||||||
|
ShaderModule::ShaderModule(Client* c, uint32_t r, uint32_t i) : ObjectBase(c, r, i) {}
|
||||||
|
|
||||||
ShaderModule::~ShaderModule() {
|
ShaderModule::~ShaderModule() {
|
||||||
ClearAllCallbacks(WGPUCompilationInfoRequestStatus_Unknown);
|
ClearAllCallbacks(WGPUCompilationInfoRequestStatus_Unknown);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace dawn::wire::client {
|
||||||
class ShaderModule final : public ObjectBase {
|
class ShaderModule final : public ObjectBase {
|
||||||
public:
|
public:
|
||||||
using ObjectBase::ObjectBase;
|
using ObjectBase::ObjectBase;
|
||||||
|
|
||||||
|
ShaderModule(Client* client, uint32_t refcount, uint32_t id);
|
||||||
~ShaderModule();
|
~ShaderModule();
|
||||||
|
|
||||||
void GetCompilationInfo(WGPUCompilationInfoCallback callback, void* userdata);
|
void GetCompilationInfo(WGPUCompilationInfoCallback callback, void* userdata);
|
||||||
|
|
Loading…
Reference in New Issue