.viewportSubPixelBits = 13, /* We take a float? */
.minMemoryMapAlignment = 4096, /* A page */
.minTexelBufferOffsetAlignment = 1,
- .minUniformBufferOffsetAlignment = 16,
+ /* We need 16 for UBO block reads to work and 32 for push UBOs */
+ .minUniformBufferOffsetAlignment = 32,
.minStorageBufferOffsetAlignment = 4,
.minTexelOffset = -8,
.maxTexelOffset = 7,
memory_types |= (1u << i);
}
+ /* Base alignment requirement of a cache line */
+ uint32_t alignment = 16;
+
+ /* We need an alignment of 32 for pushing UBOs */
+ if (buffer->usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT)
+ alignment = MAX2(alignment, 32);
+
pMemoryRequirements->size = buffer->size;
- pMemoryRequirements->alignment = 16;
+ pMemoryRequirements->alignment = alignment;
pMemoryRequirements->memoryTypeBits = memory_types;
}