浏览代码

Backends: Vulkan: Fixed building with older headers not supporting VK_HEADER_VERSION_COMPLETE. (#8326, #8365)

ocornut 7 月之前
父节点
当前提交
e1ae7db4cc
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      backends/imgui_impl_vulkan.cpp

+ 7 - 0
backends/imgui_impl_vulkan.cpp

@@ -1159,7 +1159,14 @@ bool    ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info)
 
     bd->VulkanInitInfo = *info;
     if (bd->VulkanInitInfo.ApiVersion == 0)
+    {
+        // We don't care about other versions for now, so don't need to make this exhaustive (with #ifdef VK_VERSION_1_X checks)
+#ifdef VK_HEADER_VERSION_COMPLETE
         bd->VulkanInitInfo.ApiVersion = VK_HEADER_VERSION_COMPLETE;
+#else
+        bd->VulkanInitInfo.ApiVersion = VK_API_VERSION_1_0;
+#endif
+    }
 
     ImGui_ImplVulkan_CreateDeviceObjects();