[vulkan] Ensure memory size is aligned

While the base of a memory object was aligned when calculating the
memory block size, the top end was not, which could result in the memory
block not getting enough bytes allocated to satisfy alignment
requirements (eg, for flushing).

While fixing that, I noticed the offsets of objects were not being
aligned when binding, so that is fixed as well.

Fixes Mr Fixit on my VersaPro.
This commit is contained in:
Bill Currie 2022-10-14 19:36:21 +09:00
parent 8464d71264
commit 2c59a400e4

View file

@ -110,7 +110,7 @@ QFV_CreateResource (qfv_device_t *device, qfv_resource_t *resource)
resource->name, obj->name, obj->type);
}
size = QFV_NextOffset (size, &req);
size += req.size;
size += QFV_NextOffset (req.size, &req);
}
VkMemoryPropertyFlags properties = resource->memory_properties;
for (uint32_t type = 0; type < memprops->memoryTypeCount; type++) {
@ -178,7 +178,8 @@ QFV_CreateResource (qfv_device_t *device, qfv_resource_t *resource)
case qfv_res_image_view:
break;
}
offset += req.size;
offset = QFV_NextOffset (offset, &req);
offset += QFV_NextOffset (req.size, &req);
}
for (unsigned i = 0; i < resource->num_objects; i++) {