Skip to content

Commit

Permalink
tests/vulkan: fix bug when VK_KHR_surface is missing
Browse files Browse the repository at this point in the history
We call vkDestroySurfaceKHR indiscriminately, even if VK_KHR_surface was
not even enabled. (Since it's listed under `opt_extensions`, this is a
valid case)

Easiest way to work around this special case is to just avoid calling
vkDestroySurfaceKHR if we never created a surface, since in that case
`surf` will still be NULL.
  • Loading branch information
haasn committed Feb 2, 2023
1 parent a76281c commit da0c8b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tests/vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ int main()
pl_log_level_update(log, PL_LOG_INFO);
}

vkDestroySurfaceKHR(inst->instance, surf, NULL);
if (surf)
vkDestroySurfaceKHR(inst->instance, surf, NULL);
pl_vk_inst_destroy(&inst);
pl_log_destroy(&log);
free(devices);
Expand Down

0 comments on commit da0c8b2

Please sign in to comment.