radv: Use actual memory type count for setting app-visible bitset.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 25 Apr 2020 21:39:21 +0000 (23:39 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 28 Apr 2020 13:44:27 +0000 (15:44 +0200)
Otherwise we might make a bitset that is too large.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4751>

src/amd/vulkan/radv_device.c

index b590a92d4d59dd5c87a0b8c410301428d22fbc74..c7aa2c14eba037ad9d2acf72af7fe8c35f8f1973 100644 (file)
@@ -7261,7 +7261,7 @@ VkResult radv_GetMemoryFdPropertiesKHR(VkDevice _device,
 
    switch (handleType) {
    case VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT:
-      pMemoryFdProperties->memoryTypeBits = (1 << RADV_MEM_TYPE_COUNT) - 1;
+      pMemoryFdProperties->memoryTypeBits = (1 << device->physical_device->memory_properties.memoryTypeCount) - 1;
       return VK_SUCCESS;
 
    default: