From 6d40eab097342e3e6193aec3fb868e4fa7a14f3b Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sun, 29 Sep 2024 17:00:10 -0300 Subject: [PATCH] vulkan: slightly improve memory placement for fullscreen canvases. --- src/modules/graphics/vulkan/Texture.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/graphics/vulkan/Texture.cpp b/src/modules/graphics/vulkan/Texture.cpp index ffc5be7fe..157cac94d 100644 --- a/src/modules/graphics/vulkan/Texture.cpp +++ b/src/modules/graphics/vulkan/Texture.cpp @@ -146,6 +146,12 @@ bool Texture::loadVolatile() VmaAllocationCreateInfo imageAllocationCreateInfo{}; + // Dedicated allocations are recommended for fullscreen RTs. + if (renderTarget && pixelWidth >= vgfx->getPixelWidth() && pixelHeight >= vgfx->getPixelHeight()) + imageAllocationCreateInfo.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT; + + imageAllocationCreateInfo.usage = VMA_MEMORY_USAGE_AUTO; + if (vmaCreateImage(allocator, &imageInfo, &imageAllocationCreateInfo, &textureImage, &textureImageAllocation, nullptr) != VK_SUCCESS) throw love::Exception("failed to create image");