gpu-open/vma: Optimize CheckAllocation method
- Avoids doing useless work. The scanning algorithm is painfully slow on hardware with alignment requirement > 1 - Upto 50ms saved for ~600 allocations when many small allocations exist
This commit is contained in:
+4
-4
@@ -8848,7 +8848,7 @@ bool VmaBlockMetadata_Generic::CheckAllocation(
|
|||||||
|
|
||||||
// Check previous suballocations for BufferImageGranularity conflicts.
|
// Check previous suballocations for BufferImageGranularity conflicts.
|
||||||
// Make bigger alignment if necessary.
|
// Make bigger alignment if necessary.
|
||||||
if(bufferImageGranularity > 1)
|
if(bufferImageGranularity > 1 && bufferImageGranularity != allocAlignment)
|
||||||
{
|
{
|
||||||
bool bufferImageGranularityConflict = false;
|
bool bufferImageGranularityConflict = false;
|
||||||
VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;
|
VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;
|
||||||
@@ -8932,7 +8932,7 @@ bool VmaBlockMetadata_Generic::CheckAllocation(
|
|||||||
|
|
||||||
// Check next suballocations for BufferImageGranularity conflicts.
|
// Check next suballocations for BufferImageGranularity conflicts.
|
||||||
// If conflict exists, we must mark more allocations lost or fail.
|
// If conflict exists, we must mark more allocations lost or fail.
|
||||||
if(bufferImageGranularity > 1)
|
if(bufferImageGranularity > 1 && (allocSize % bufferImageGranularity || *pOffset % bufferImageGranularity))
|
||||||
{
|
{
|
||||||
VmaSuballocationList::const_iterator nextSuballocItem = lastSuballocItem;
|
VmaSuballocationList::const_iterator nextSuballocItem = lastSuballocItem;
|
||||||
++nextSuballocItem;
|
++nextSuballocItem;
|
||||||
@@ -8991,7 +8991,7 @@ bool VmaBlockMetadata_Generic::CheckAllocation(
|
|||||||
|
|
||||||
// Check previous suballocations for BufferImageGranularity conflicts.
|
// Check previous suballocations for BufferImageGranularity conflicts.
|
||||||
// Make bigger alignment if necessary.
|
// Make bigger alignment if necessary.
|
||||||
if(bufferImageGranularity > 1)
|
if(bufferImageGranularity > 1 && bufferImageGranularity != allocAlignment)
|
||||||
{
|
{
|
||||||
bool bufferImageGranularityConflict = false;
|
bool bufferImageGranularityConflict = false;
|
||||||
VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;
|
VmaSuballocationList::const_iterator prevSuballocItem = suballocItem;
|
||||||
@@ -9031,7 +9031,7 @@ bool VmaBlockMetadata_Generic::CheckAllocation(
|
|||||||
|
|
||||||
// Check next suballocations for BufferImageGranularity conflicts.
|
// Check next suballocations for BufferImageGranularity conflicts.
|
||||||
// If conflict exists, allocation cannot be made here.
|
// If conflict exists, allocation cannot be made here.
|
||||||
if(bufferImageGranularity > 1)
|
if(bufferImageGranularity > 1 && (allocSize % bufferImageGranularity || *pOffset % bufferImageGranularity))
|
||||||
{
|
{
|
||||||
VmaSuballocationList::const_iterator nextSuballocItem = suballocItem;
|
VmaSuballocationList::const_iterator nextSuballocItem = suballocItem;
|
||||||
++nextSuballocItem;
|
++nextSuballocItem;
|
||||||
|
|||||||
Reference in New Issue
Block a user