Refactoring in FindMemoryPreferences

Without changing the logic. Fixes #354. Thanks @marc0246 !
This commit is contained in:
Adam Sawicki 2023-07-14 14:18:53 +02:00
parent cb08556022
commit 33067f6b4f

View File

@ -3754,19 +3754,18 @@ static bool FindMemoryPreferences(
// No CPU access // No CPU access
else else
{ {
// GPU access, no CPU access (e.g. a color attachment image) - prefer GPU memory // if(deviceAccess)
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. // unless there is a clear preference from the user not to do so.
if(preferHost) //
outNotPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; // else:
else //
outPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
}
// No direct GPU access, no CPU access, just transfers. // 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 // 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). // 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. // Up to the user to decide. If no preferece, assume the former and choose GPU memory.
if(preferHost) if(preferHost)
outNotPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; outNotPreferredFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
else else