Avoid using VMA_MEMORY_USAGE_AUTO if possible

This commit is contained in:
Benau 2022-10-09 09:37:18 +08:00
parent 542ece64f9
commit e9be8d91ef
4 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@ void GESPMBuffer::createVertexIndexBuffer()
VkBuffer staging_buffer = VK_NULL_HANDLE;
VmaAllocation staging_memory = VK_NULL_HANDLE;
VmaAllocationCreateInfo staging_buffer_create_info = {};
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO;
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST;
staging_buffer_create_info.flags =
VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
staging_buffer_create_info.preferredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
@ -77,7 +77,7 @@ void GESPMBuffer::createVertexIndexBuffer()
vmaFlushAllocation(vk->getVmaAllocator(), staging_memory, 0, total_size);
VmaAllocationCreateInfo local_create_info = {};
local_create_info.usage = VMA_MEMORY_USAGE_AUTO;
local_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE;
if (!vk->createBuffer(total_size,
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
VK_BUFFER_USAGE_TRANSFER_DST_BIT, local_create_info, m_buffer,

View File

@ -81,7 +81,7 @@ void GEVulkanArrayTexture::reloadInternal(const std::vector<io::path>& list,
VkBuffer staging_buffer = VK_NULL_HANDLE;
VmaAllocation staging_buffer_allocation = NULL;
VmaAllocationCreateInfo staging_buffer_create_info = {};
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO;
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST;
staging_buffer_create_info.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
staging_buffer_create_info.preferredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;

View File

@ -77,7 +77,7 @@ void GEVulkanMeshCache::updateCache()
VkBuffer staging_buffer = VK_NULL_HANDLE;
VmaAllocation staging_memory = VK_NULL_HANDLE;
VmaAllocationCreateInfo staging_buffer_create_info = {};
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO;
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST;
staging_buffer_create_info.flags =
VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT |
VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
@ -150,7 +150,7 @@ void GEVulkanMeshCache::updateCache()
vmaFlushAllocation(m_vk->getVmaAllocator(), staging_memory, 0, offset);
VmaAllocationCreateInfo local_create_info = {};
local_create_info.usage = VMA_MEMORY_USAGE_AUTO;
local_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE;
local_create_info.flags = VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
if (!m_vk->createBuffer(vbo_size + ibo_size,
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT |

View File

@ -193,7 +193,7 @@ bool GEVulkanTexture::createTextureImage(uint8_t* texture_data,
VkBuffer staging_buffer;
VmaAllocation staging_buffer_allocation;
VmaAllocationCreateInfo staging_buffer_create_info = {};
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO;
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST;
staging_buffer_create_info.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
staging_buffer_create_info.preferredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
@ -291,7 +291,7 @@ bool GEVulkanTexture::createImage(VkImageUsageFlags usage)
m_vma_info = {};
VmaAllocationCreateInfo alloc_info = {};
alloc_info.usage = VMA_MEMORY_USAGE_AUTO;
alloc_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE;
VkResult result = vmaCreateImage(m_vk->getVmaAllocator(), &image_info,
&alloc_info, &m_image, &m_vma_allocation, &m_vma_info);
@ -655,7 +655,7 @@ void GEVulkanTexture::updateTexture(void* data, video::ECOLOR_FORMAT format,
VkBuffer staging_buffer;
VmaAllocation staging_buffer_allocation;
VmaAllocationCreateInfo staging_buffer_create_info = {};
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO;
staging_buffer_create_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST;
staging_buffer_create_info.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
staging_buffer_create_info.preferredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
if (isSingleChannel())