You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fix incorrect parameters passed to VMA
If the allocation is small enough that it enters the
if (p_size <= SMALL_ALLOCATION_MAX_SIZE) {} block, Godot would call
vmaFindMemoryTypeIndexForBufferInfo with the wrong parameters.
This can cause vmaFindMemoryTypeIndexForBufferInfo to potentially
misbehave on some cards or drivers.
Fixes regression introduced in #102830
Might potentially reopen #101850 (I doubt it, but it's possible)
Must be backported to 4.4
This commit is contained in:
@@ -1547,6 +1547,10 @@ RDD::BufferID RenderingDeviceDriverVulkan::buffer_create(uint64_t p_size, BitFie
|
|||||||
} break;
|
} break;
|
||||||
case MEMORY_ALLOCATION_TYPE_GPU: {
|
case MEMORY_ALLOCATION_TYPE_GPU: {
|
||||||
vma_usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE;
|
vma_usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE;
|
||||||
|
if (!Engine::get_singleton()->is_extra_gpu_memory_tracking_enabled()) {
|
||||||
|
// We must set it right now or else vmaFindMemoryTypeIndexForBufferInfo will use wrong parameters.
|
||||||
|
alloc_create_info.usage = vma_usage;
|
||||||
|
}
|
||||||
alloc_create_info.preferredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
alloc_create_info.preferredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
||||||
if (p_size <= SMALL_ALLOCATION_MAX_SIZE) {
|
if (p_size <= SMALL_ALLOCATION_MAX_SIZE) {
|
||||||
uint32_t mem_type_index = 0;
|
uint32_t mem_type_index = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user