vulkan: Avoid stomping array padding in the MemoryProperties wrapper.

The deqp test for it expects that the unused array elements are untouched,
so make sure they don't get replaced with random stack data.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10737>
This commit is contained in:
Emma Anholt 2021-05-10 12:03:48 -07:00 committed by Marge Bot
parent 10a826e340
commit 307139c7f9
2 changed files with 15 additions and 2 deletions

View File

@ -12,7 +12,6 @@ dEQP-VK.api.copy_and_blit.core.resolve_image.whole_array_image_one_region.4_bit,
dEQP-VK.api.copy_and_blit.core.resolve_image.whole_copy_before_resolving.4_bit,Fail
dEQP-VK.api.device_init.create_instance_device_intentional_alloc_fail,Fail
dEQP-VK.api.info.format_properties.g8b8g8r8_422_unorm,Fail
dEQP-VK.api.info.get_physical_device_properties2.memory_properties,Fail
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9409
dEQP-VK.compute.basic.max_local_size_x,Crash

View File

@ -139,7 +139,21 @@ vk_common_GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice,
pdevice->dispatch_table.GetPhysicalDeviceMemoryProperties2(physicalDevice,
&props2);
*pMemoryProperties = props2.memoryProperties;
/* dEQP-VK.api.info.get_physical_device_properties2.memory_properties memsets
* the struct to 0xcd and expects that the unused array elements are
* untouched.
*/
pMemoryProperties->memoryHeapCount = props2.memoryProperties.memoryHeapCount;
for (int i = 0; i < pMemoryProperties->memoryHeapCount; i++) {
pMemoryProperties->memoryHeaps[i].flags = props2.memoryProperties.memoryHeaps[i].flags;
pMemoryProperties->memoryHeaps[i].size = props2.memoryProperties.memoryHeaps[i].size;
}
pMemoryProperties->memoryTypeCount = props2.memoryProperties.memoryTypeCount;
for (int i = 0; i < pMemoryProperties->memoryTypeCount; i++) {
pMemoryProperties->memoryTypes[i].heapIndex = props2.memoryProperties.memoryTypes[i].heapIndex;
pMemoryProperties->memoryTypes[i].propertyFlags = props2.memoryProperties.memoryTypes[i].propertyFlags;
}
}
VKAPI_ATTR void VKAPI_CALL