|
|
@ -404,13 +404,13 @@ public: |
|
|
|
|
|
|
|
|
/// Construct a handle transferring the ownership from another handle. |
|
|
/// Construct a handle transferring the ownership from another handle. |
|
|
Handle(Handle&& rhs) noexcept |
|
|
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. |
|
|
/// Assign the current handle transferring the ownership from another handle. |
|
|
/// Destroys any previously held object. |
|
|
/// Destroys any previously held object. |
|
|
Handle& operator=(Handle&& rhs) noexcept { |
|
|
Handle& operator=(Handle&& rhs) noexcept { |
|
|
Release(); |
|
|
Release(); |
|
|
handle = std::exchange(rhs.handle, nullptr); |
|
|
|
|
|
|
|
|
handle = std::exchange(rhs.handle, Type{}); |
|
|
owner = rhs.owner; |
|
|
owner = rhs.owner; |
|
|
dld = rhs.dld; |
|
|
dld = rhs.dld; |
|
|
return *this; |
|
|
return *this; |
|
|
@ -424,7 +424,7 @@ public: |
|
|
/// Destroys any held object. |
|
|
/// Destroys any held object. |
|
|
void reset() noexcept { |
|
|
void reset() noexcept { |
|
|
Release(); |
|
|
Release(); |
|
|
handle = nullptr; |
|
|
|
|
|
|
|
|
handle = Type{}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Returns the address of the held object. |
|
|
/// Returns the address of the held object. |
|
|
@ -440,7 +440,7 @@ public: |
|
|
|
|
|
|
|
|
/// Returns true when there's a held object. |
|
|
/// Returns true when there's a held object. |
|
|
explicit operator bool() const noexcept { |
|
|
explicit operator bool() const noexcept { |
|
|
return handle != nullptr; |
|
|
|
|
|
|
|
|
return handle != Type{}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#ifndef ANDROID |
|
|
#ifndef ANDROID |
|
|
@ -455,7 +455,7 @@ public: |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
protected: |
|
|
protected: |
|
|
Type handle = nullptr; |
|
|
|
|
|
|
|
|
Type handle{}; |
|
|
OwnerType owner = nullptr; |
|
|
OwnerType owner = nullptr; |
|
|
const Dispatch* dld = nullptr; |
|
|
const Dispatch* dld = nullptr; |
|
|
|
|
|
|
|
|
@ -463,7 +463,7 @@ private: |
|
|
/// Destroys the held object if it exists. |
|
|
/// Destroys the held object if it exists. |
|
|
void Release() noexcept { |
|
|
void Release() noexcept { |
|
|
if (handle) { |
|
|
if (handle) { |
|
|
Destroy(owner, handle, *dld); |
|
|
|
|
|
|
|
|
Destroy(OwnerType(owner), Type(handle), *dld); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
@ -506,7 +506,7 @@ public: |
|
|
/// Destroys any held object. |
|
|
/// Destroys any held object. |
|
|
void reset() noexcept { |
|
|
void reset() noexcept { |
|
|
Release(); |
|
|
Release(); |
|
|
handle = nullptr; |
|
|
|
|
|
|
|
|
handle = {}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Returns the address of the held object. |
|
|
/// Returns the address of the held object. |
|
|
@ -522,7 +522,7 @@ public: |
|
|
|
|
|
|
|
|
/// Returns true when there's a held object. |
|
|
/// Returns true when there's a held object. |
|
|
explicit operator bool() const noexcept { |
|
|
explicit operator bool() const noexcept { |
|
|
return handle != nullptr; |
|
|
|
|
|
|
|
|
return handle != Type{}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#ifndef ANDROID |
|
|
#ifndef ANDROID |
|
|
@ -537,7 +537,7 @@ public: |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
protected: |
|
|
protected: |
|
|
Type handle = nullptr; |
|
|
|
|
|
|
|
|
Type handle{}; |
|
|
const Dispatch* dld = nullptr; |
|
|
const Dispatch* dld = nullptr; |
|
|
|
|
|
|
|
|
private: |
|
|
private: |
|
|
@ -607,7 +607,7 @@ private: |
|
|
std::unique_ptr<AllocationType[]> allocations; |
|
|
std::unique_ptr<AllocationType[]> allocations; |
|
|
std::size_t num = 0; |
|
|
std::size_t num = 0; |
|
|
VkDevice device = nullptr; |
|
|
VkDevice device = nullptr; |
|
|
PoolType pool = nullptr; |
|
|
|
|
|
|
|
|
PoolType pool{}; |
|
|
const DeviceDispatch* dld = nullptr; |
|
|
const DeviceDispatch* dld = nullptr; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
@ -669,12 +669,12 @@ public: |
|
|
Image& operator=(const Image&) = delete; |
|
|
Image& operator=(const Image&) = delete; |
|
|
|
|
|
|
|
|
Image(Image&& rhs) noexcept |
|
|
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} {} |
|
|
allocator{rhs.allocator}, allocation{rhs.allocation}, dld{rhs.dld} {} |
|
|
|
|
|
|
|
|
Image& operator=(Image&& rhs) noexcept { |
|
|
Image& operator=(Image&& rhs) noexcept { |
|
|
Release(); |
|
|
Release(); |
|
|
handle = std::exchange(rhs.handle, nullptr); |
|
|
|
|
|
|
|
|
handle = std::exchange(rhs.handle, VkImage{}); |
|
|
usage = rhs.usage; |
|
|
usage = rhs.usage; |
|
|
owner = rhs.owner; |
|
|
owner = rhs.owner; |
|
|
allocator = rhs.allocator; |
|
|
allocator = rhs.allocator; |
|
|
@ -693,11 +693,11 @@ public: |
|
|
|
|
|
|
|
|
void reset() noexcept { |
|
|
void reset() noexcept { |
|
|
Release(); |
|
|
Release(); |
|
|
handle = nullptr; |
|
|
|
|
|
|
|
|
handle = VkImage{}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
explicit operator bool() const noexcept { |
|
|
explicit operator bool() const noexcept { |
|
|
return handle != nullptr; |
|
|
|
|
|
|
|
|
return handle != VkImage{}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void SetObjectNameEXT(const char* name) const; |
|
|
void SetObjectNameEXT(const char* name) const; |
|
|
@ -709,7 +709,7 @@ public: |
|
|
private: |
|
|
private: |
|
|
void Release() const noexcept; |
|
|
void Release() const noexcept; |
|
|
|
|
|
|
|
|
VkImage handle = nullptr; |
|
|
|
|
|
|
|
|
VkImage handle{}; |
|
|
VkImageUsageFlags usage{}; |
|
|
VkImageUsageFlags usage{}; |
|
|
VkDevice owner = nullptr; |
|
|
VkDevice owner = nullptr; |
|
|
VmaAllocator allocator = nullptr; |
|
|
VmaAllocator allocator = nullptr; |
|
|
@ -730,13 +730,13 @@ public: |
|
|
Buffer& operator=(const Buffer&) = delete; |
|
|
Buffer& operator=(const Buffer&) = delete; |
|
|
|
|
|
|
|
|
Buffer(Buffer&& rhs) noexcept |
|
|
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}, |
|
|
allocation{rhs.allocation}, mapped{rhs.mapped}, |
|
|
is_coherent{rhs.is_coherent}, dld{rhs.dld} {} |
|
|
is_coherent{rhs.is_coherent}, dld{rhs.dld} {} |
|
|
|
|
|
|
|
|
Buffer& operator=(Buffer&& rhs) noexcept { |
|
|
Buffer& operator=(Buffer&& rhs) noexcept { |
|
|
Release(); |
|
|
Release(); |
|
|
handle = std::exchange(rhs.handle, nullptr); |
|
|
|
|
|
|
|
|
handle = std::exchange(rhs.handle, VkBuffer{}); |
|
|
owner = rhs.owner; |
|
|
owner = rhs.owner; |
|
|
allocator = rhs.allocator; |
|
|
allocator = rhs.allocator; |
|
|
allocation = rhs.allocation; |
|
|
allocation = rhs.allocation; |
|
|
@ -756,11 +756,11 @@ public: |
|
|
|
|
|
|
|
|
void reset() noexcept { |
|
|
void reset() noexcept { |
|
|
Release(); |
|
|
Release(); |
|
|
handle = nullptr; |
|
|
|
|
|
|
|
|
handle = VkBuffer{}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
explicit operator bool() const noexcept { |
|
|
explicit operator bool() const noexcept { |
|
|
return handle != nullptr; |
|
|
|
|
|
|
|
|
return handle != VkBuffer{}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Returns the host mapped memory, an empty span otherwise. |
|
|
/// Returns the host mapped memory, an empty span otherwise. |
|
|
@ -786,7 +786,7 @@ public: |
|
|
private: |
|
|
private: |
|
|
void Release() const noexcept; |
|
|
void Release() const noexcept; |
|
|
|
|
|
|
|
|
VkBuffer handle = nullptr; |
|
|
|
|
|
|
|
|
VkBuffer handle{}; |
|
|
VkDevice owner = nullptr; |
|
|
VkDevice owner = nullptr; |
|
|
VmaAllocator allocator = nullptr; |
|
|
VmaAllocator allocator = nullptr; |
|
|
VmaAllocation allocation = nullptr; |
|
|
VmaAllocation allocation = nullptr; |
|
|
@ -1020,10 +1020,10 @@ public: |
|
|
[[nodiscard]] PipelineLayout CreatePipelineLayout(const VkPipelineLayoutCreateInfo& ci) const; |
|
|
[[nodiscard]] PipelineLayout CreatePipelineLayout(const VkPipelineLayoutCreateInfo& ci) const; |
|
|
|
|
|
|
|
|
[[nodiscard]] Pipeline CreateGraphicsPipeline(const VkGraphicsPipelineCreateInfo& ci, |
|
|
[[nodiscard]] Pipeline CreateGraphicsPipeline(const VkGraphicsPipelineCreateInfo& ci, |
|
|
VkPipelineCache cache = nullptr) const; |
|
|
|
|
|
|
|
|
VkPipelineCache cache = {}) const; |
|
|
|
|
|
|
|
|
[[nodiscard]] Pipeline CreateComputePipeline(const VkComputePipelineCreateInfo& ci, |
|
|
[[nodiscard]] Pipeline CreateComputePipeline(const VkComputePipelineCreateInfo& ci, |
|
|
VkPipelineCache cache = nullptr) const; |
|
|
|
|
|
|
|
|
VkPipelineCache cache = {}) const; |
|
|
|
|
|
|
|
|
[[nodiscard]] Sampler CreateSampler(const VkSamplerCreateInfo& ci) const; |
|
|
[[nodiscard]] Sampler CreateSampler(const VkSamplerCreateInfo& ci) const; |
|
|
|
|
|
|
|
|
|