diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index 19ac85b2981..cb30f093cc5 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -1123,6 +1123,7 @@ vn_physical_device_get_passthrough_extensions( .EXT_image_view_min_lod = true, .EXT_index_type_uint8 = true, .EXT_line_rasterization = true, + .EXT_memory_budget = true, .EXT_multi_draw = true, .EXT_mutable_descriptor_type = true, .EXT_primitive_topology_list_restart = true, @@ -1900,7 +1901,29 @@ vn_GetPhysicalDeviceMemoryProperties2( { struct vn_physical_device *physical_dev = vn_physical_device_from_handle(physicalDevice); + struct vn_instance *instance = physical_dev->instance; + VkPhysicalDeviceMemoryBudgetPropertiesEXT *memory_budget = NULL; + /* Don't waste time searching for unsupported structs. */ + if (physical_dev->base.base.supported_extensions.EXT_memory_budget) { + memory_budget = + vk_find_struct(pMemoryProperties->pNext, + PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT); + } + + /* When the app queries invariant memory properties, we return a cached + * copy. For dynamic properties, we must query the server. + */ + if (memory_budget) { + vn_call_vkGetPhysicalDeviceMemoryProperties2(instance, physicalDevice, + pMemoryProperties); + } + + /* Even when we query the server for memory properties, we must still + * overwrite the invariant memory properties returned from the server with + * our cached version. Our cached version may differ from the server's + * version due to workarounds. + */ pMemoryProperties->memoryProperties = physical_dev->memory_properties.memoryProperties; }