*/
#define RADV_MAX_PER_SET_DESCRIPTORS ((1ull << 31 ) / 96)
-/* Our buffer size fields allow only this much */
-#define RADV_MAX_MEMORY_ALLOCATION_SIZE 0xFFFFFFFFull
+/* Our buffer size fields allow only 2**32 - 1. We round that down to a multiple
+ * of 4 bytes so we can align buffer sizes up.
+ */
+#define RADV_MAX_MEMORY_ALLOCATION_SIZE 0xFFFFFFFCull
/* Number of invocations in each subgroup. */
#define RADV_SUBGROUP_SIZE 64
if (buffer_info->range == VK_WHOLE_SIZE)
range = buffer->size - buffer_info->offset;
+ /* robustBufferAccess is relaxed enough to allow this (in combination
+ * with the alignment/size we return from vkGetBufferMemoryRequirements)
+ * and this allows the shader compiler to create more efficient 8/16-bit
+ * buffer accesses. */
+ range = align(range, 4);
+
va += buffer_info->offset + buffer->offset;
dst[0] = va;
dst[1] = S_008F04_BASE_ADDRESS_HI(va >> 32);
if (buffer_info->range == VK_WHOLE_SIZE)
size = buffer->size - buffer_info->offset;
+ /* robustBufferAccess is relaxed enough to allow this (in combination
+ * with the alignment/size we return from vkGetBufferMemoryRequirements)
+ * and this allows the shader compiler to create more efficient 8/16-bit
+ * buffer accesses. */
+ size = align(size, 4);
+
va += buffer_info->offset + buffer->offset;
range->va = va;
range->size = size;