pvr: Only destroy the physcial device if it exists

Without this, it segfaults on instance destruction which brings down the
Vulkan app if you have the driver installed on your system, even if you
have no PowerVR hardware.

Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18330>
This commit is contained in:
Jason Ekstrand 2022-08-30 14:13:51 -05:00 committed by Marge Bot
parent 6fed616187
commit 201e1ba9db

View file

@ -240,7 +240,8 @@ void pvr_DestroyInstance(VkInstance _instance,
if (!instance)
return;
pvr_physical_device_finish(&instance->physical_device);
if (instance->physical_devices_count > 0)
pvr_physical_device_finish(&instance->physical_device);
VG(VALGRIND_DESTROY_MEMPOOL(instance));