Skip to content

Commit 41a3630

Browse files
committed
Changed heuristic in FindMemoryPreferences when VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT is used
Hopefully fixes #520
1 parent 9b27966 commit 41a3630

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

include/vk_mem_alloc.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4265,8 +4265,11 @@ bool FindMemoryPreferences(
42654265
}
42664266
else
42674267
{
4268-
// Always CPU memory.
4269-
outRequiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
4268+
if(hostAccessAllowTransferInstead)
4269+
outPreferredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
4270+
else
4271+
// Always CPU memory.
4272+
outRequiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
42704273
}
42714274
}
42724275
// CPU sequential write - may be CPU or host-visible GPU memory, uncached and write-combined.
@@ -4281,7 +4284,12 @@ bool FindMemoryPreferences(
42814284
}
42824285
else
42834286
{
4284-
outRequiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
4287+
if(hostAccessAllowTransferInstead)
4288+
outPreferredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
4289+
else
4290+
// Always CPU memory.
4291+
outRequiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
4292+
42854293
// Direct GPU access, CPU sequential write (e.g. a dynamic uniform buffer updated every frame)
42864294
if(deviceAccess)
42874295
{

0 commit comments

Comments
 (0)