The issue is that if dedicated allocation is used, VkBufferCreateInfo.size and the actual allocated size mismatched, which is a validation error.
Unified · Split
| @@ -883,10 +883,6 @@ int ff_vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req, · 882 unmodified lines | |||
| 883 | .pNext = alloc_extension, | 883 | .pNext = alloc_extension, |
| 884 | }; | 884 | }; |
| 885 | 885 | ||
| 886 | /* Align if we need to */ | ||
| 887 | if ((req_flags != UINT32_MAX) && req_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) | ||
| 888 | req->size = FFALIGN(req->size, s->props.properties.limits.minMemoryMapAlignment); | ||
| 889 | |||
| 890 | alloc_info.allocationSize = req->size; | 886 | alloc_info.allocationSize = req->size; |
| 891 | 887 | ||
| 892 | /* The vulkan spec requires memory types to be sorted in the "optimal" | 888 | /* The vulkan spec requires memory types to be sorted in the "optimal" |
| @@ -939,8 +935,9 @@ int ff_vk_create_buf(FFVulkanContext *s, FFVkBuffer *buf, size_t size, · 46 unmodified lines | |||
| 939 | .pNext = pNext, | 935 | .pNext = pNext, |
| 940 | .usage = usage, | 936 | .usage = usage, |
| 941 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, | 937 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, |
| 942 | .size = size, /* Gets FFALIGNED during alloc if host visible | 938 | .size = flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT ? |
| 943 | but should be ok */ | 939 | FFALIGN(size, s->props.properties.limits.minMemoryMapAlignment) : |
| 940 | size, | ||
| 944 | }; | 941 | }; |
| 945 | 942 | ||
| 946 | VkMemoryAllocateFlagsInfo alloc_flags = { | 943 | VkMemoryAllocateFlagsInfo alloc_flags = { |