|
|
@ -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, |
|
|
|