From 4a533a215a0e44df1ebde022d9cd1e42d3ec3f77 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Sat, 1 Aug 2026 23:21:35 +0800 Subject: [PATCH] [Chore] (MG_Backend): fix compiling error. --- .../DirectVulkan/Renderer/VulkanRenderer.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp index e41cd580..f34b90f0 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp @@ -9933,7 +9933,17 @@ void main() { VkPhysicalDeviceProperties2 properties2{}; properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; properties2.pNext = &xfbProperties; - vkGetPhysicalDeviceProperties2(m_physicalDevice.handle, &properties2); + // Resolved via proc addr: vkGetPhysicalDeviceProperties2 is Vulkan 1.1, and Android's + // libvulkan.so only exports it from API 28 while minSdk is 26. + auto getPhysicalDeviceProperties2 = reinterpret_cast( + vkGetInstanceProcAddr(m_instance, "vkGetPhysicalDeviceProperties2")); + if (getPhysicalDeviceProperties2 == nullptr) { + getPhysicalDeviceProperties2 = reinterpret_cast( + vkGetInstanceProcAddr(m_instance, "vkGetPhysicalDeviceProperties2KHR")); + } + if (getPhysicalDeviceProperties2 != nullptr) { + getPhysicalDeviceProperties2(m_physicalDevice.handle, &properties2); + } m_xfbQueriesSupported = xfbProperties.transformFeedbackQueries == VK_TRUE && s_vkCmdBeginQueryIndexedEXT != nullptr && s_vkCmdEndQueryIndexedEXT != nullptr; }