Browse Source

vulkan: slightly improve memory placement for fullscreen canvases.

Sasha Szpakowski 10 months ago
parent
commit
6d40eab097
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/modules/graphics/vulkan/Texture.cpp

+ 6 - 0
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");