Round up buffer allocation sizes to nonCoherentAtomSize.

For some Vega APUs. Or don't use VK_WHOLE_SIZE?
This commit is contained in:
jackun 2021-03-02 20:43:14 +02:00
parent f77a73ce8a
commit 6c737dc734
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

View File

@ -1011,6 +1011,12 @@ static void CreateOrResizeBuffer(struct device_data *data,
if (*buffer_memory)
data->vtable.FreeMemory(data->device, *buffer_memory, NULL);
if (data->properties.limits.nonCoherentAtomSize > 0)
{
VkDeviceSize atom_size = data->properties.limits.nonCoherentAtomSize - 1;
new_size = (new_size + atom_size) & ~atom_size;
}
VkBufferCreateInfo buffer_info = {};
buffer_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
buffer_info.size = new_size;