Improves small copy handling in TransferData

This commit is contained in:
2025-07-09 09:00:39 -04:00
parent e0e4206056
commit 5ddf5d3466
7 changed files with 51 additions and 16 deletions

View File

@@ -27,6 +27,7 @@ namespace fgl::engine::memory
m_alignment( alignment ),
m_ptr( m_parent_buffer->map( *this ) )
{
if ( memory_size == 1024 ) throw std::runtime_error( "AAAAA" );
// assert( memory_size != 0 && "BufferSuballocation::BufferSuballocation() called with memory_size == 0" );
}
@@ -40,11 +41,13 @@ namespace fgl::engine::memory
m_parent_buffer->free( *this );
}
vk::BufferCopy BufferSuballocationHandle::
copyRegion( const BufferSuballocationHandle& target, const std::size_t suballocation_offset ) const
vk::BufferCopy BufferSuballocationHandle::copyRegion(
const BufferSuballocationHandle& target,
const std::size_t suballocation_offset,
const vk::DeviceSize size ) const
{
vk::BufferCopy copy {};
copy.size = std::min( this->m_size, target.m_size );
copy.size = size == 0 ? std::min( this->m_size, target.m_size ) : size;
copy.srcOffset = this->offset();
copy.dstOffset = target.offset() + suballocation_offset;
return copy;