History

vulkan: move alignment of host-visible allocations outside of ff_vk_alloc_mem

The issue is that if dedicated allocation is used, VkBufferCreateInfo.size and the actual allocated size mismatched, which is a validation error.

Lynne committed 2 years ago

Commit 9eb7e8d1 parent 35659031 file · +3 −6Browse files

Unified · Split

libavutil/vulkan.c+3−6
@@ -883,10 +883,6 @@ int ff_vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req, · 882 unmodified lines
883883 .pNext = alloc_extension,
884884 };
885885
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−
890886 alloc_info.allocationSize = req->size;
891887
892888 /* 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
939935 .pNext = pNext,
940936 .usage = usage,
941937 .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
942− .size = size, /* Gets FFALIGNED during alloc if host visible
943− but should be ok */
938+ .size = flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT ?
939+ FFALIGN(size, s->props.properties.limits.minMemoryMapAlignment) :
940+ size,
944941 };
945942
946943 VkMemoryAllocateFlagsInfo alloc_flags = {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t