|
|
|
@ -402,13 +402,13 @@ public: |
|
|
|
|
|
|
|
/// Construct a handle transferring the ownership from another handle. |
|
|
|
Handle(Handle&& rhs) noexcept |
|
|
|
: handle{std::exchange(rhs.handle, nullptr)}, owner{rhs.owner}, dld{rhs.dld} {} |
|
|
|
: handle{std::exchange(rhs.handle, Type{})}, owner{rhs.owner}, dld{rhs.dld} {} |
|
|
|
|
|
|
|
/// Assign the current handle transferring the ownership from another handle. |
|
|
|
/// Destroys any previously held object. |
|
|
|
Handle& operator=(Handle&& rhs) noexcept { |
|
|
|
Release(); |
|
|
|
handle = std::exchange(rhs.handle, nullptr); |
|
|
|
handle = std::exchange(rhs.handle, Type{}); |
|
|
|
owner = rhs.owner; |
|
|
|
dld = rhs.dld; |
|
|
|
return *this; |
|
|
|
@ -422,7 +422,7 @@ public: |
|
|
|
/// Destroys any held object. |
|
|
|
void reset() noexcept { |
|
|
|
Release(); |
|
|
|
handle = nullptr; |
|
|
|
handle = Type{}; |
|
|
|
} |
|
|
|
|
|
|
|
/// Returns the address of the held object. |
|
|
|
@ -438,7 +438,7 @@ public: |
|
|
|
|
|
|
|
/// Returns true when there's a held object. |
|
|
|
explicit operator bool() const noexcept { |
|
|
|
return handle != nullptr; |
|
|
|
return handle != Type{}; |
|
|
|
} |
|
|
|
|
|
|
|
#ifndef ANDROID |
|
|
|
@ -453,7 +453,7 @@ public: |
|
|
|
#endif |
|
|
|
|
|
|
|
protected: |
|
|
|
Type handle = nullptr; |
|
|
|
Type handle{}; |
|
|
|
OwnerType owner = nullptr; |
|
|
|
const Dispatch* dld = nullptr; |
|
|
|
|
|
|
|
@ -461,7 +461,7 @@ private: |
|
|
|
/// Destroys the held object if it exists. |
|
|
|
void Release() noexcept { |
|
|
|
if (handle) { |
|
|
|
Destroy(owner, handle, *dld); |
|
|
|
Destroy(OwnerType(owner), Type(handle), *dld); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -504,7 +504,7 @@ public: |
|
|
|
/// Destroys any held object. |
|
|
|
void reset() noexcept { |
|
|
|
Release(); |
|
|
|
handle = nullptr; |
|
|
|
handle = {}; |
|
|
|
} |
|
|
|
|
|
|
|
/// Returns the address of the held object. |
|
|
|
@ -520,7 +520,7 @@ public: |
|
|
|
|
|
|
|
/// Returns true when there's a held object. |
|
|
|
explicit operator bool() const noexcept { |
|
|
|
return handle != nullptr; |
|
|
|
return handle != Type{}; |
|
|
|
} |
|
|
|
|
|
|
|
#ifndef ANDROID |
|
|
|
@ -535,7 +535,7 @@ public: |
|
|
|
#endif |
|
|
|
|
|
|
|
protected: |
|
|
|
Type handle = nullptr; |
|
|
|
Type handle{}; |
|
|
|
const Dispatch* dld = nullptr; |
|
|
|
|
|
|
|
private: |
|
|
|
@ -605,7 +605,7 @@ private: |
|
|
|
std::unique_ptr<AllocationType[]> allocations; |
|
|
|
std::size_t num = 0; |
|
|
|
VkDevice device = nullptr; |
|
|
|
PoolType pool = nullptr; |
|
|
|
PoolType pool{}; |
|
|
|
const DeviceDispatch* dld = nullptr; |
|
|
|
}; |
|
|
|
|
|
|
|
@ -667,12 +667,12 @@ public: |
|
|
|
Image& operator=(const Image&) = delete; |
|
|
|
|
|
|
|
Image(Image&& rhs) noexcept |
|
|
|
: handle{std::exchange(rhs.handle, nullptr)}, usage{rhs.usage}, owner{rhs.owner}, |
|
|
|
: handle{std::exchange(rhs.handle, VkImage{})}, usage{rhs.usage}, owner{rhs.owner}, |
|
|
|
allocator{rhs.allocator}, allocation{rhs.allocation}, dld{rhs.dld} {} |
|
|
|
|
|
|
|
Image& operator=(Image&& rhs) noexcept { |
|
|
|
Release(); |
|
|
|
handle = std::exchange(rhs.handle, nullptr); |
|
|
|
handle = std::exchange(rhs.handle, VkImage{}); |
|
|
|
usage = rhs.usage; |
|
|
|
owner = rhs.owner; |
|
|
|
allocator = rhs.allocator; |
|
|
|
@ -691,11 +691,11 @@ public: |
|
|
|
|
|
|
|
void reset() noexcept { |
|
|
|
Release(); |
|
|
|
handle = nullptr; |
|
|
|
handle = VkImage{}; |
|
|
|
} |
|
|
|
|
|
|
|
explicit operator bool() const noexcept { |
|
|
|
return handle != nullptr; |
|
|
|
return handle != VkImage{}; |
|
|
|
} |
|
|
|
|
|
|
|
void SetObjectNameEXT(const char* name) const; |
|
|
|
@ -707,7 +707,7 @@ public: |
|
|
|
private: |
|
|
|
void Release() const noexcept; |
|
|
|
|
|
|
|
VkImage handle = nullptr; |
|
|
|
VkImage handle{}; |
|
|
|
VkImageUsageFlags usage{}; |
|
|
|
VkDevice owner = nullptr; |
|
|
|
VmaAllocator allocator = nullptr; |
|
|
|
@ -728,13 +728,13 @@ public: |
|
|
|
Buffer& operator=(const Buffer&) = delete; |
|
|
|
|
|
|
|
Buffer(Buffer&& rhs) noexcept |
|
|
|
: handle{std::exchange(rhs.handle, nullptr)}, owner{rhs.owner}, allocator{rhs.allocator}, |
|
|
|
: handle{std::exchange(rhs.handle, VkBuffer{})}, owner{rhs.owner}, allocator{rhs.allocator}, |
|
|
|
allocation{rhs.allocation}, mapped{rhs.mapped}, |
|
|
|
is_coherent{rhs.is_coherent}, dld{rhs.dld} {} |
|
|
|
|
|
|
|
Buffer& operator=(Buffer&& rhs) noexcept { |
|
|
|
Release(); |
|
|
|
handle = std::exchange(rhs.handle, nullptr); |
|
|
|
handle = std::exchange(rhs.handle, VkBuffer{}); |
|
|
|
owner = rhs.owner; |
|
|
|
allocator = rhs.allocator; |
|
|
|
allocation = rhs.allocation; |
|
|
|
@ -754,11 +754,11 @@ public: |
|
|
|
|
|
|
|
void reset() noexcept { |
|
|
|
Release(); |
|
|
|
handle = nullptr; |
|
|
|
handle = VkBuffer{}; |
|
|
|
} |
|
|
|
|
|
|
|
explicit operator bool() const noexcept { |
|
|
|
return handle != nullptr; |
|
|
|
return handle != VkBuffer{}; |
|
|
|
} |
|
|
|
|
|
|
|
/// Returns the host mapped memory, an empty span otherwise. |
|
|
|
@ -784,7 +784,7 @@ public: |
|
|
|
private: |
|
|
|
void Release() const noexcept; |
|
|
|
|
|
|
|
VkBuffer handle = nullptr; |
|
|
|
VkBuffer handle{}; |
|
|
|
VkDevice owner = nullptr; |
|
|
|
VmaAllocator allocator = nullptr; |
|
|
|
VmaAllocation allocation = nullptr; |
|
|
|
@ -1018,10 +1018,10 @@ public: |
|
|
|
[[nodiscard]] PipelineLayout CreatePipelineLayout(const VkPipelineLayoutCreateInfo& ci) const; |
|
|
|
|
|
|
|
[[nodiscard]] Pipeline CreateGraphicsPipeline(const VkGraphicsPipelineCreateInfo& ci, |
|
|
|
VkPipelineCache cache = nullptr) const; |
|
|
|
VkPipelineCache cache = {}) const; |
|
|
|
|
|
|
|
[[nodiscard]] Pipeline CreateComputePipeline(const VkComputePipelineCreateInfo& ci, |
|
|
|
VkPipelineCache cache = nullptr) const; |
|
|
|
VkPipelineCache cache = {}) const; |
|
|
|
|
|
|
|
[[nodiscard]] Sampler CreateSampler(const VkSamplerCreateInfo& ci) const; |
|
|
|
|
|
|
|
|