mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
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:
parent
6f4dbf4fcd
commit
5a049d41fd
1 changed files with 4 additions and 4 deletions
8
3rdparty/GPUOpen/include/vk_mem_alloc.h
vendored
8
3rdparty/GPUOpen/include/vk_mem_alloc.h
vendored
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue