From 33067f6b4f735db97c97660e46620266eebcf7de Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Fri, 14 Jul 2023 14:18:53 +0200 Subject: [PATCH] Refactoring in FindMemoryPreferences Without changing the logic. Fixes #354. Thanks @marc0246 ! --- include/vk_mem_alloc.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index bf1901b..10450d7 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -3754,19 +3754,18 @@ static bool FindMemoryPreferences( // No CPU access else { - // GPU access, no CPU access (e.g. a color attachment image) - prefer GPU memory - if(deviceAccess) - { - // ...unless there is a clear preference from the user not to do so. - if(preferHost) - outNotPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; - else - outPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; - } + // if(deviceAccess) + // + // GPU access, no CPU access (e.g. a color attachment image) - prefer GPU memory, + // unless there is a clear preference from the user not to do so. + // + // else: + // // No direct GPU access, no CPU access, just transfers. // It may be staging copy intended for e.g. preserving image for next frame (then better GPU memory) or // a "swap file" copy to free some GPU memory (then better CPU memory). // Up to the user to decide. If no preferece, assume the former and choose GPU memory. + if(preferHost) outNotPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; else