Merge pull request #84852 from Alex2782/fix_vulkan_buffer_android

Vulkan: Fix incorrect access to the buffers on Android
This commit is contained in:
Rémi Verschelde 2023-12-04 23:06:04 +01:00
commit a9ba8695d4
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 5 additions and 2 deletions

View file

@ -1365,6 +1365,9 @@ Error RenderingDeviceVulkan::_buffer_allocate(Buffer *p_buffer, uint32_t p_size,
allocInfo.memoryTypeBits = 0;
allocInfo.pool = nullptr;
allocInfo.pUserData = nullptr;
if (p_mem_usage == VMA_MEMORY_USAGE_AUTO_PREFER_HOST) {
allocInfo.requiredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
}
if (p_size <= SMALL_ALLOCATION_MAX_SIZE) {
uint32_t mem_type_index = 0;
vmaFindMemoryTypeIndexForBufferInfo(allocator, &bufferInfo, &allocInfo, &mem_type_index);
@ -1410,7 +1413,7 @@ Error RenderingDeviceVulkan::_insert_staging_block() {
VmaAllocationCreateInfo allocInfo;
allocInfo.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
allocInfo.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST;
allocInfo.requiredFlags = 0;
allocInfo.requiredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
allocInfo.preferredFlags = 0;
allocInfo.memoryTypeBits = 0;
allocInfo.pool = nullptr;

View file

@ -43,7 +43,7 @@
#define _DEBUG
#endif
#endif
#include "vk_mem_alloc.h"
#include "thirdparty/vulkan/vk_mem_alloc.h"
#ifdef USE_VOLK
#include <volk.h>