From 422f7d08015d8964d39b878ad2a4b6807bb64f9a Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Sat, 26 Aug 2023 20:23:48 +0200 Subject: [PATCH] RMG: slightly improve VidExt_VK_GetSurface() --- Source/RMG/VidExt.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/RMG/VidExt.cpp b/Source/RMG/VidExt.cpp index 86e9bea0e..fd5affa8f 100644 --- a/Source/RMG/VidExt.cpp +++ b/Source/RMG/VidExt.cpp @@ -389,9 +389,16 @@ EXPORT m64p_error CALL VidExt_VK_GetSurface(void** Surface, void* Instance) return M64ERR_INVALID_STATE; } + // we don't support receiving a null handle + // for the VkInstance + if ((VkInstance)Instance == VK_NULL_HANDLE) + { + return M64ERR_UNSUPPORTED; + } + // use VkInstance from plugin // when we don't have a VkInstance yet - if (!l_VulkanInstance.vkInstance()) + if (l_VulkanInstance.vkInstance() == VK_NULL_HANDLE) { l_VulkanInstance.setVkInstance((VkInstance)Instance); if (!l_VulkanInstance.create())