Assert the minMemoryMapAlignment value minMemoryMapAlignment is the alignment which the Vulkan implementation has to guarantee for host memory mappings of device memory. It is currently set to 64, and since our "device" memory is ordinary system memory and we don't actually do any mapping, it has the same alignment as the allocation. Recently this was increased from 16 to 256, so we're now respecting this requirement. Bug: b/238916823 Change-Id: Ibafdab69a2f4580ee33ad08b375c075dcabcb311 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/67111 Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Sean Risser <srisser@google.com> Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Vulkan/VkConfig.hpp b/src/Vulkan/VkConfig.hpp index fd39b8f..0ee2800 100644 --- a/src/Vulkan/VkConfig.hpp +++ b/src/Vulkan/VkConfig.hpp
@@ -37,6 +37,9 @@ // "Allocations returned by vkAllocateMemory are guaranteed to meet any alignment requirement of the implementation." constexpr VkDeviceSize DEVICE_MEMORY_ALLOCATION_ALIGNMENT = 256; +constexpr VkDeviceSize MIN_MEMORY_MAP_ALIGNMENT = 64; +static_assert(DEVICE_MEMORY_ALLOCATION_ALIGNMENT >= MIN_MEMORY_MAP_ALIGNMENT); + constexpr VkDeviceSize MIN_IMPORTED_HOST_POINTER_ALIGNMENT = 4096; static_assert(MIN_IMPORTED_HOST_POINTER_ALIGNMENT >= DEVICE_MEMORY_ALLOCATION_ALIGNMENT);
diff --git a/src/Vulkan/VkPhysicalDevice.cpp b/src/Vulkan/VkPhysicalDevice.cpp index 84100a2..2e9ad5d 100644 --- a/src/Vulkan/VkPhysicalDevice.cpp +++ b/src/Vulkan/VkPhysicalDevice.cpp
@@ -671,7 +671,7 @@ { -2 * sw::MAX_VIEWPORT_DIM, 2 * sw::MAX_VIEWPORT_DIM - 1 }, // viewportBoundsRange[2] 0, // viewportSubPixelBits - 64, // minMemoryMapAlignment + vk::MIN_MEMORY_MAP_ALIGNMENT, // minMemoryMapAlignment vk::MIN_TEXEL_BUFFER_OFFSET_ALIGNMENT, // minTexelBufferOffsetAlignment vk::MIN_UNIFORM_BUFFER_OFFSET_ALIGNMENT, // minUniformBufferOffsetAlignment vk::MIN_STORAGE_BUFFER_OFFSET_ALIGNMENT, // minStorageBufferOffsetAlignment