Improves small copy handling in TransferData
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user