Guard moltenvk with defined(__APPLE__)
Bug: b/292257025
Test: atest --host GfxstreamEnd2EndTests
Change-Id: Ie79dab7483909c81bf290880497cbb899c133f00
diff --git a/host/vulkan/VkCommonOperations.cpp b/host/vulkan/VkCommonOperations.cpp
index c380a6a..3c4a3b8 100644
--- a/host/vulkan/VkCommonOperations.cpp
+++ b/host/vulkan/VkCommonOperations.cpp
@@ -563,7 +563,7 @@
extensionsSupported(exts, externalMemoryInstanceExtNames);
bool externalSemaphoreCapabilitiesSupported =
extensionsSupported(exts, externalSemaphoreInstanceExtNames);
-#ifdef VK_MVK_moltenvk
+#if defined(__APPLE__) && defined(VK_MVK_moltenvk)
bool moltenVKSupported =
(vk->vkGetMTLTextureMVK != nullptr) && (vk->vkSetMTLTextureMVK != nullptr);
#endif
@@ -587,7 +587,7 @@
}
}
-#ifdef VK_MVK_moltenvk
+#if defined(__APPLE__) && defined(VK_MVK_moltenvk)
if (moltenVKSupported) {
// We don't need both moltenVK and external memory. Disable
// external memory if moltenVK is supported.
@@ -600,7 +600,7 @@
enabledExtensions.emplace(extension);
}
-#ifdef VK_MVK_moltenvk
+#if defined(__APPLE__) && defined(VK_MVK_moltenvk)
if (moltenVKSupported) {
enabledExtensions.emplace(VK_MVK_MOLTENVK_EXTENSION_NAME);
}
@@ -691,7 +691,7 @@
sVkEmulation->instanceSupportsExternalMemoryCapabilities = externalMemoryCapabilitiesSupported;
sVkEmulation->instanceSupportsExternalSemaphoreCapabilities =
externalSemaphoreCapabilitiesSupported;
-#ifdef VK_MVK_moltenvk
+#if defined(__APPLE__) && defined(VK_MVK_moltenvk)
sVkEmulation->instanceSupportsMoltenVK = moltenVKSupported;
#endif
@@ -707,7 +707,7 @@
vk_util::getVkInstanceProcAddrWithFallback<vk_util::vk_fn_info::GetPhysicalDeviceFeatures2>(
{ivk->vkGetInstanceProcAddr, vk->vkGetInstanceProcAddr}, sVkEmulation->instance);
-#ifdef VK_MVK_moltenvk
+#if defined(__APPLE__) && defined(VK_MVK_moltenvk)
if (sVkEmulation->instanceSupportsMoltenVK) {
sVkEmulation->setMTLTextureFunc = reinterpret_cast<PFN_vkSetMTLTextureMVK>(
vk->vkGetInstanceProcAddr(sVkEmulation->instance, "vkSetMTLTextureMVK"));