summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_device.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-10-21 11:36:39 -0700
committerChad Versace <[email protected]>2015-10-21 11:55:37 -0700
commit0ab926dfbf56ad6482b875d980ae95c533b765f9 (patch)
tree7dc067257e2982ec2644af7d5aa8b1cefc5bfe45 /src/vulkan/anv_device.c
parentc8572d0f9c36c2485893e5f734ba094b8e9cdf74 (diff)
anv: Don't teardown uninitialized anv_physical_device
If the user called vkDestroyDevice but never called vkEnumeratePhysicalDevices, then the driver tried to ralloc_free() an unitialized anv_physical_device. Fixes test 'dEQP-VK.api.device_init.create_instance_name_version'.
Diffstat (limited to 'src/vulkan/anv_device.c')
-rw-r--r--src/vulkan/anv_device.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c
index fd87c85b0ce..d450b2b4e87 100644
--- a/src/vulkan/anv_device.c
+++ b/src/vulkan/anv_device.c
@@ -224,7 +224,12 @@ void anv_DestroyInstance(
{
ANV_FROM_HANDLE(anv_instance, instance, _instance);
- anv_physical_device_finish(&instance->physicalDevice);
+ if (instance->physicalDeviceCount > 0) {
+ /* We support at most one physical device. */
+ assert(instance->physicalDeviceCount == 1);
+ anv_physical_device_finish(&instance->physicalDevice);
+ }
+
anv_finish_wsi(instance);
VG(VALGRIND_DESTROY_MEMPOOL(instance));