is_valid -> is_null.
This commit is contained in:
@@ -61,7 +61,7 @@ Buffer::Buffer(Buffer&& other) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
Buffer::~Buffer() noexcept {
|
Buffer::~Buffer() noexcept {
|
||||||
if(is_valid()) {
|
if(!is_null()) {
|
||||||
logger.warning() << "Buffer deleted before being destroyed";
|
logger.warning() << "Buffer deleted before being destroyed";
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ Buffer& Buffer::operator=(Buffer&& other) noexcept {
|
|||||||
|
|
||||||
|
|
||||||
VkMemoryRequirements Buffer::memory_requirements() const noexcept {
|
VkMemoryRequirements Buffer::memory_requirements() const noexcept {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
assert(*m_context);
|
assert(*m_context);
|
||||||
|
|
||||||
VkMemoryRequirements memory_requirements;
|
VkMemoryRequirements memory_requirements;
|
||||||
@@ -94,7 +94,7 @@ VkMemoryRequirements Buffer::memory_requirements() const noexcept {
|
|||||||
|
|
||||||
|
|
||||||
void Buffer::bind_memory(const MemoryBlock& memory_block, VkDeviceSize offset) {
|
void Buffer::bind_memory(const MemoryBlock& memory_block, VkDeviceSize offset) {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
assert(*m_context);
|
assert(*m_context);
|
||||||
assert(memory_block);
|
assert(memory_block);
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ void Buffer::bind_memory(MemoryBlock&& memory_block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::allocate_and_bind_memory(VkMemoryPropertyFlags memory_properties) {
|
void Buffer::allocate_and_bind_memory(VkMemoryPropertyFlags memory_properties) {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
assert(*m_context);
|
assert(*m_context);
|
||||||
|
|
||||||
const auto memory_requirements = this->memory_requirements();
|
const auto memory_requirements = this->memory_requirements();
|
||||||
@@ -129,7 +129,7 @@ void Buffer::allocate_and_bind_memory(VkMemoryPropertyFlags memory_properties) {
|
|||||||
|
|
||||||
|
|
||||||
void Buffer::upload(size_t size, void* src_buffer, uint32_t dst_queue_family) {
|
void Buffer::upload(size_t size, void* src_buffer, uint32_t dst_queue_family) {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
assert(*m_context);
|
assert(*m_context);
|
||||||
|
|
||||||
const bool use_staging_buffer =
|
const bool use_staging_buffer =
|
||||||
@@ -166,7 +166,7 @@ void Buffer::upload(size_t size, void* src_buffer, uint32_t dst_queue_family) {
|
|||||||
|
|
||||||
|
|
||||||
void Buffer::destroy() noexcept {
|
void Buffer::destroy() noexcept {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
assert(*m_context);
|
assert(*m_context);
|
||||||
|
|
||||||
if(m_memory) {
|
if(m_memory) {
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ public:
|
|||||||
Buffer& operator=(Buffer&& other) noexcept;
|
Buffer& operator=(Buffer&& other) noexcept;
|
||||||
|
|
||||||
inline explicit operator bool() const {
|
inline explicit operator bool() const {
|
||||||
return is_valid();
|
return !is_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_valid() const {
|
inline bool is_null() const {
|
||||||
return m_buffer != VK_NULL_HANDLE;
|
return m_buffer == VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Context* context() noexcept {
|
inline Context* context() noexcept {
|
||||||
|
|||||||
@@ -67,11 +67,11 @@ public:
|
|||||||
Context& operator=(const Context&) = delete;
|
Context& operator=(const Context&) = delete;
|
||||||
|
|
||||||
explicit inline operator bool() const {
|
explicit inline operator bool() const {
|
||||||
return is_valid();
|
return !is_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_valid() const {
|
inline bool is_null() const {
|
||||||
return m_instance != nullptr;
|
return m_instance == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkInstance instance();
|
VkInstance instance();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Fence::Fence(Fence&& other) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
Fence::~Fence() noexcept {
|
Fence::~Fence() noexcept {
|
||||||
if(is_valid())
|
if(!is_null())
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ Fence& Fence::operator=(Fence&& other) noexcept {
|
|||||||
|
|
||||||
VkResult Fence::get_status() const {
|
VkResult Fence::get_status() const {
|
||||||
assert(m_context);
|
assert(m_context);
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
|
|
||||||
VkResult result = vkGetFenceStatus(
|
VkResult result = vkGetFenceStatus(
|
||||||
m_context->device(),
|
m_context->device(),
|
||||||
@@ -66,7 +66,7 @@ VkResult Fence::get_status() const {
|
|||||||
|
|
||||||
void Fence::reset() {
|
void Fence::reset() {
|
||||||
assert(m_context);
|
assert(m_context);
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
|
|
||||||
if(vkResetFences(
|
if(vkResetFences(
|
||||||
m_context->device(),
|
m_context->device(),
|
||||||
@@ -78,7 +78,7 @@ void Fence::reset() {
|
|||||||
|
|
||||||
void Fence::wait(uint64_t timeout) const {
|
void Fence::wait(uint64_t timeout) const {
|
||||||
assert(m_context);
|
assert(m_context);
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
|
|
||||||
wait_for_fences(
|
wait_for_fences(
|
||||||
m_context->device(),
|
m_context->device(),
|
||||||
@@ -90,7 +90,7 @@ void Fence::wait(uint64_t timeout) const {
|
|||||||
|
|
||||||
|
|
||||||
void Fence::destroy() noexcept {
|
void Fence::destroy() noexcept {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
assert(m_context);
|
assert(m_context);
|
||||||
|
|
||||||
vkDestroyFence(
|
vkDestroyFence(
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ public:
|
|||||||
Fence& operator=(Fence&& other) noexcept;
|
Fence& operator=(Fence&& other) noexcept;
|
||||||
|
|
||||||
explicit inline operator bool() const noexcept {
|
explicit inline operator bool() const noexcept {
|
||||||
return is_valid();
|
return !is_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_valid() const noexcept {
|
inline bool is_null() const noexcept {
|
||||||
return m_fence != VK_NULL_HANDLE;
|
return m_fence == VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Context* context() const noexcept {
|
inline const Context* context() const noexcept {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ MemoryBlock::MemoryBlock(MemoryBlock&& other) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
MemoryBlock::~MemoryBlock() noexcept {
|
MemoryBlock::~MemoryBlock() noexcept {
|
||||||
if(is_valid()) {
|
if(!is_null()) {
|
||||||
logger.warning() << "MemoryBlock deleted before being freed";
|
logger.warning() << "MemoryBlock deleted before being freed";
|
||||||
free();
|
free();
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ MemoryBlock& MemoryBlock::operator=(MemoryBlock&& other) noexcept {
|
|||||||
|
|
||||||
|
|
||||||
VkMemoryType MemoryBlock::memory_type_info(Context& context) const noexcept {
|
VkMemoryType MemoryBlock::memory_type_info(Context& context) const noexcept {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
assert(context);
|
assert(context);
|
||||||
|
|
||||||
return context.memory_properties().memoryTypes[m_memory_type];
|
return context.memory_properties().memoryTypes[m_memory_type];
|
||||||
@@ -70,7 +70,7 @@ VkMemoryType MemoryBlock::memory_type_info(Context& context) const noexcept {
|
|||||||
|
|
||||||
|
|
||||||
void MemoryBlock::free() noexcept {
|
void MemoryBlock::free() noexcept {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
|
|
||||||
m_memory_page->p_free(*this);
|
m_memory_page->p_free(*this);
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ void* MemoryBlock::map(Context& context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* MemoryBlock::map(Context& context, VkDeviceSize offset, VkDeviceSize size) {
|
void* MemoryBlock::map(Context& context, VkDeviceSize offset, VkDeviceSize size) {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
assert(context);
|
assert(context);
|
||||||
assert(offset + size <= m_size);
|
assert(offset + size <= m_size);
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ void* MemoryBlock::map(Context& context, VkDeviceSize offset, VkDeviceSize size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MemoryBlock::unmap(Context& context) noexcept {
|
void MemoryBlock::unmap(Context& context) noexcept {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
|
|
||||||
vkUnmapMemory(
|
vkUnmapMemory(
|
||||||
context.device(),
|
context.device(),
|
||||||
@@ -116,7 +116,7 @@ void MemoryBlock::unmap(Context& context) noexcept {
|
|||||||
|
|
||||||
|
|
||||||
void MemoryBlock::flush(Context& context) {
|
void MemoryBlock::flush(Context& context) {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
|
|
||||||
VkMappedMemoryRange range {
|
VkMappedMemoryRange range {
|
||||||
.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
|
.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
|
||||||
@@ -133,7 +133,7 @@ void MemoryBlock::flush(Context& context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MemoryBlock::invalidate(Context& context) {
|
void MemoryBlock::invalidate(Context& context) {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
|
|
||||||
VkMappedMemoryRange range {
|
VkMappedMemoryRange range {
|
||||||
.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
|
.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public:
|
|||||||
return m_size != 0;
|
return m_size != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_valid() const noexcept {
|
inline bool is_null() const noexcept {
|
||||||
return m_size != 0;
|
return m_size == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline VkDeviceSize size() const noexcept {
|
inline VkDeviceSize size() const noexcept {
|
||||||
@@ -92,11 +92,11 @@ public:
|
|||||||
MemoryPage& operator=(MemoryPage&&);
|
MemoryPage& operator=(MemoryPage&&);
|
||||||
|
|
||||||
explicit inline operator bool() const noexcept {
|
explicit inline operator bool() const noexcept {
|
||||||
return is_valid();
|
return !is_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_valid() const noexcept {
|
inline bool is_null() const noexcept {
|
||||||
return m_size != 0;
|
return m_size == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline VkDeviceSize size() const noexcept {
|
inline VkDeviceSize size() const noexcept {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ RenderPass::RenderPass(RenderPass&& other) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
RenderPass::~RenderPass() noexcept {
|
RenderPass::~RenderPass() noexcept {
|
||||||
if(is_valid())
|
if(!is_null())
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ RenderPass& RenderPass::operator=(RenderPass&& other) noexcept {
|
|||||||
|
|
||||||
|
|
||||||
void RenderPass::destroy() noexcept {
|
void RenderPass::destroy() noexcept {
|
||||||
assert(is_valid());
|
assert(!is_null());
|
||||||
assert(m_context);
|
assert(m_context);
|
||||||
|
|
||||||
vkDestroyRenderPass(
|
vkDestroyRenderPass(
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ public:
|
|||||||
RenderPass& operator=(RenderPass&& other) noexcept;
|
RenderPass& operator=(RenderPass&& other) noexcept;
|
||||||
|
|
||||||
explicit inline operator bool() const noexcept {
|
explicit inline operator bool() const noexcept {
|
||||||
return is_valid();
|
return !is_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_valid() const noexcept {
|
inline bool is_null() const noexcept {
|
||||||
return m_render_pass != VK_NULL_HANDLE;
|
return m_render_pass == VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline operator VkRenderPass() noexcept {
|
inline operator VkRenderPass() noexcept {
|
||||||
|
|||||||
Reference in New Issue
Block a user