From ae26042d4b9185f3556da2e46a1251928860991d Mon Sep 17 00:00:00 2001 From: osy Date: Sun, 5 Oct 2025 17:06:10 -0700 Subject: [PATCH 1/4] Fix macOS compile - Untangle GL dependenices - Add dummy files to prevent linker errors on empty archives - Add missing macOS framework dependencies --- common/base/meson.build | 4 ++++ host/ColorBuffer.cpp | 28 +++++++++++++++++++++++ host/FrameBuffer.cpp | 48 ++++++++++++++++++++++++++------------- host/GlesCompat.h | 2 +- host/iostream/dummy.c | 0 host/iostream/meson.build | 1 + host/meson.build | 8 +++++++ host/snapshot/dummy.c | 0 host/snapshot/meson.build | 2 +- host/vulkan/meson.build | 13 ++++++++--- meson.build | 7 ++++++ 11 files changed, 92 insertions(+), 21 deletions(-) create mode 100644 host/iostream/dummy.c create mode 100644 host/snapshot/dummy.c diff --git a/common/base/meson.build b/common/base/meson.build index 49589fd31..784610efc 100644 --- a/common/base/meson.build +++ b/common/base/meson.build @@ -32,6 +32,10 @@ else files_lib_common_base += 'Thread_pthread.cpp' endif +if host_machine.system() == 'darwin' + files_lib_common_base += 'system-native-mac.mm' +endif + lib_common_base = static_library( 'common_base', files_lib_common_base, diff --git a/host/ColorBuffer.cpp b/host/ColorBuffer.cpp index 04f341efc..28e62f4eb 100644 --- a/host/ColorBuffer.cpp +++ b/host/ColorBuffer.cpp @@ -25,7 +25,9 @@ namespace gfxstream { namespace { +#if GFXSTREAM_ENABLE_HOST_GLES using gl::ColorBufferGl; +#endif using vk::ColorBufferVk; // ColorBufferVk natively supports YUV images. However, ColorBufferGl @@ -116,6 +118,14 @@ class ColorBuffer::Impl : public LazySnapshotObj { std::unique_ptr mColorBufferGl; #endif + bool hasColorBuffer() const { +#if GFXSTREAM_ENABLE_HOST_GLES + return mColorBufferGl || mColorBufferVk; +#else + return mColorBufferVk != nullptr; +#endif + }; + // If Vk emulation is enabled. std::unique_ptr mColorBufferVk; @@ -161,7 +171,11 @@ std::unique_ptr ColorBuffer::Impl::create( #endif if (emulationVk) { +#if GFXSTREAM_ENABLE_HOST_GLES const bool vulkanOnly = colorBuffer->mColorBufferGl == nullptr; +#else + const bool vulkanOnly = true; +#endif const uint32_t memoryProperty = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; const uint32_t mipLevels = 1; colorBuffer->mColorBufferVk = @@ -423,9 +437,11 @@ std::unique_ptr ColorBuffer::Impl::borrowForDisplay(UsedApi a } bool ColorBuffer::Impl::flushFromGl() { +#if GFXSTREAM_ENABLE_HOST_GLES if (!(mColorBufferGl && mColorBufferVk)) { return true; } +#endif if (mGlAndVkAreSharingExternalMemory) { return true; @@ -438,9 +454,15 @@ bool ColorBuffer::Impl::flushFromGl() { } bool ColorBuffer::Impl::flushFromVk() { +#if GFXSTREAM_ENABLE_HOST_GLES if (!(mColorBufferGl && mColorBufferVk)) { return true; } +#else + if (!mColorBufferVk) { + return true; + } +#endif if (mGlAndVkAreSharingExternalMemory) { return true; @@ -466,9 +488,11 @@ bool ColorBuffer::Impl::flushFromVk() { } bool ColorBuffer::Impl::flushFromVkBytes(const void* bytes, size_t bytesSize) { +#if GFXSTREAM_ENABLE_HOST_GLES if (!(mColorBufferGl && mColorBufferVk)) { return true; } +#endif if (mGlAndVkAreSharingExternalMemory) { return true; @@ -487,9 +511,11 @@ bool ColorBuffer::Impl::flushFromVkBytes(const void* bytes, size_t bytesSize) { } bool ColorBuffer::Impl::invalidateForGl() { +#if GFXSTREAM_ENABLE_HOST_GLES if (!(mColorBufferGl && mColorBufferVk)) { return true; } +#endif if (mGlAndVkAreSharingExternalMemory) { return true; @@ -501,9 +527,11 @@ bool ColorBuffer::Impl::invalidateForGl() { } bool ColorBuffer::Impl::invalidateForVk() { +#if GFXSTREAM_ENABLE_HOST_GLES if (!(mColorBufferGl && mColorBufferVk)) { return true; } +#endif if (mGlAndVkAreSharingExternalMemory) { return true; diff --git a/host/FrameBuffer.cpp b/host/FrameBuffer.cpp index 4fc010b14..0c43a7cd8 100644 --- a/host/FrameBuffer.cpp +++ b/host/FrameBuffer.cpp @@ -36,9 +36,9 @@ #include "gl/YUVConverter.h" #include "gl/gles2_dec/gles2_dec.h" #include "gl/glestranslator/EGL/EglGlobalInfo.h" +#include "ContextHelper.h" #endif -#include "ContextHelper.h" #include "Hwc2.h" #include "NativeSubWindow.h" #include "RenderThreadInfo.h" @@ -477,12 +477,6 @@ class FrameBuffer::Impl : public gfxstream::base::EventNotificationSupport m_onPost; +#if GFXSTREAM_ENABLE_HOST_GLES ReadbackWorker* m_readbackWorker = nullptr; +#endif gfxstream::base::WorkerThread m_readbackThread; std::atomic_bool m_readbackThreadStarted = false; @@ -1277,6 +1279,7 @@ FrameBuffer::Impl::~Impl() { WorkerProcessingResult FrameBuffer::Impl::sendReadbackWorkerCmd(const Readback& readback) { ensureReadbackWorker(); +#if GFXSTREAM_ENABLE_HOST_GLES switch (readback.cmd) { case ReadbackCmd::Init: m_readbackWorker->init(); @@ -1293,6 +1296,7 @@ WorkerProcessingResult FrameBuffer::Impl::sendReadbackWorkerCmd(const Readback& case ReadbackCmd::Exit: return WorkerProcessingResult::Stop; } +#endif return WorkerProcessingResult::Stop; } @@ -1721,9 +1725,11 @@ HandleType FrameBuffer::Impl::genHandle_locked() { bool FrameBuffer::Impl::isFormatSupported(GLenum format) { bool supported = true; +#if GFXSTREAM_ENABLE_HOST_GLES if (m_emulationGl) { supported &= m_emulationGl->isFormatSupported(format); } +#endif if (m_emulationVk) { supported &= m_emulationVk->isFormatSupported(format); } @@ -2078,8 +2084,8 @@ void FrameBuffer::Impl::cleanupProcGLObjects(uint64_t puid) { std::vector FrameBuffer::Impl::cleanupProcGLObjects_locked(uint64_t puid, bool forced) { std::vector colorBuffersToCleanup; { - std::unique_ptr bind = nullptr; #if GFXSTREAM_ENABLE_HOST_GLES + std::unique_ptr bind = nullptr; if (m_emulationGl) { bind = std::make_unique(getPbufferSurfaceContextHelper()); } @@ -2438,11 +2444,13 @@ AsyncResult FrameBuffer::Impl::postImpl(HandleType p_colorbuffer, Post::Completi if (asyncReadbackSupported()) { ensureReadbackWorker(); +#if GFXSTREAM_ENABLE_HOST_GLES const auto status = m_readbackWorker->doNextReadback( iter.first, cb.get(), iter.second.img, repaint, iter.second.readBgra); if (status == ReadbackWorker::DoNextReadbackResult::OK_READY_FOR_READ) { doPostCallback(iter.second.img, iter.first); } +#endif } else { #if GFXSTREAM_ENABLE_HOST_GLES cb->glOpReadback(iter.second.img, iter.second.readBgra); @@ -2489,10 +2497,12 @@ void FrameBuffer::Impl::flushReadPipeline(int displayId) { ensureReadbackWorker(); +#if GFXSTREAM_ENABLE_HOST_GLES const auto status = m_readbackWorker->flushPipeline(displayId); if (status == ReadbackWorker::FlushResult::OK_READY_FOR_READ) { doPostCallback(nullptr, displayId); } +#endif } void FrameBuffer::Impl::ensureReadbackWorker() { @@ -2825,8 +2835,8 @@ void FrameBuffer::Impl::onSave(Stream* stream, const ITextureSaverPtr& textureSa // m_prevDrawSurf AutoLock mutex(m_lock); - std::unique_ptr bind; #if GFXSTREAM_ENABLE_HOST_GLES + std::unique_ptr bind; if (m_emulationGl) { // Some snapshot commands try using GL. bind = std::make_unique(getPbufferSurfaceContextHelper()); @@ -2953,8 +2963,8 @@ bool FrameBuffer::Impl::onLoad(Stream* stream, const ITextureLoaderPtr& textureL { sweepColorBuffersLocked(); - std::unique_ptr bind; #if GFXSTREAM_ENABLE_HOST_GLES + std::unique_ptr bind; if (m_emulationGl) { // Some snapshot commands try using GL. bind = std::make_unique(getPbufferSurfaceContextHelper()); @@ -3175,8 +3185,8 @@ bool FrameBuffer::Impl::onLoad(Stream* stream, const ITextureLoaderPtr& textureL #endif { - std::unique_ptr bind; #if GFXSTREAM_ENABLE_HOST_GLES + std::unique_ptr bind; if (m_emulationGl) { // Some snapshot commands try using GL. bind = std::make_unique(getPbufferSurfaceContextHelper()); @@ -4718,7 +4728,9 @@ void FrameBuffer::unlockContextStructureRead() { mImpl->unlockContextStructureRe void FrameBuffer::createTrivialContext(HandleType shared, HandleType* contextOut, HandleType* surfOut) { +#if GFXSTREAM_ENABLE_HOST_GLES mImpl->createTrivialContext(shared, contextOut, surfOut); +#endif } void FrameBuffer::setShuttingDown() { mImpl->setShuttingDown(); } @@ -4759,7 +4771,9 @@ float FrameBuffer::getPy() const { return mImpl->getPy(); } int FrameBuffer::getZrot() const { return mImpl->getZrot(); } void FrameBuffer::setScreenMask(int width, int height, const uint8_t* rgbaData) { +#if GFXSTREAM_ENABLE_HOST_GLES mImpl->setScreenMask(width, height, rgbaData); +#endif } #ifdef CONFIG_AEMU @@ -4913,7 +4927,9 @@ std::optional FrameBuffer::exportBuffer(HandleType bufferHan return mImpl->exportBuffer(bufferHandle); } +#if GFXSTREAM_ENABLE_HOST_GLES bool FrameBuffer::hasEmulationGl() const { return mImpl->hasEmulationGl(); } +#endif bool FrameBuffer::hasEmulationVk() const { return mImpl->hasEmulationVk(); } @@ -4970,11 +4986,6 @@ EGLint FrameBuffer::chooseConfig(EGLint* attribs, EGLint* configs, EGLint config return mImpl->chooseConfig(attribs, configs, configsSize); } -void FrameBuffer::getDeviceInfo(const char** vendor, const char** renderer, - const char** version) const { - mImpl->getDeviceInfo(vendor, renderer, version); -} - HandleType FrameBuffer::createEmulatedEglContext(int p_config, HandleType p_share, GLESApi version) { return mImpl->createEmulatedEglContext(p_config, p_share, version); @@ -5110,6 +5121,11 @@ const void* FrameBuffer::getGles2Dispatch() { return mImpl->getGles2Dispatch(); #endif +void FrameBuffer::getDeviceInfo(const char** vendor, const char** renderer, + const char** version) const { + mImpl->getDeviceInfo(vendor, renderer, version); +} + const FeatureSet& FrameBuffer::getFeatures() const { return mImpl->getFeatures(); } RepresentativeColorBufferMemoryTypeInfo FrameBuffer::getRepresentativeColorBufferMemoryTypeInfo() diff --git a/host/GlesCompat.h b/host/GlesCompat.h index f1f56dc66..aae0e7189 100644 --- a/host/GlesCompat.h +++ b/host/GlesCompat.h @@ -19,7 +19,7 @@ typedef unsigned int GLenum; typedef int32_t EGLint; -typedef unsigned int EGLNativeWindowType; +typedef void *EGLNativeWindowType; namespace gfxstream { namespace gl { diff --git a/host/iostream/dummy.c b/host/iostream/dummy.c new file mode 100644 index 000000000..e69de29bb diff --git a/host/iostream/meson.build b/host/iostream/meson.build index b407ca89a..b2a64232f 100644 --- a/host/iostream/meson.build +++ b/host/iostream/meson.build @@ -4,6 +4,7 @@ inc_host_iostream = include_directories('include') files_lib_host_iostream = files( + 'dummy.c' ) lib_host_iostream = static_library( diff --git a/host/meson.build b/host/meson.build index d6827cd1d..d06fcdedf 100644 --- a/host/meson.build +++ b/host/meson.build @@ -177,6 +177,14 @@ if host_machine.system() == 'qnx' ] endif +if host_machine.system() == 'darwin' + deps_gfxstream_backend += [ + cocoa_dep, + corefoundation_dep, + iokit_dep, + ] +endif + gfxstream_backend = library( 'gfxstream_backend', files_lib_gfxstream_backend, diff --git a/host/snapshot/dummy.c b/host/snapshot/dummy.c new file mode 100644 index 000000000..e69de29bb diff --git a/host/snapshot/meson.build b/host/snapshot/meson.build index 75188fd9e..de4c69806 100644 --- a/host/snapshot/meson.build +++ b/host/snapshot/meson.build @@ -3,7 +3,7 @@ inc_host_snapshot = include_directories('include') -files_lib_host_snapshot = files() +files_lib_host_snapshot = files('dummy.c') lib_host_snapshot = static_library( 'host_snapshot', diff --git a/host/vulkan/meson.build b/host/vulkan/meson.build index e15ab5b24..7076e4d08 100644 --- a/host/vulkan/meson.build +++ b/host/vulkan/meson.build @@ -62,6 +62,15 @@ elif host_machine.system() == 'qnx' vulkan_server_cpp_args += '-DVK_USE_PLATFORM_SCREEN_QNX' endif +if use_gles + additional_includes = [ + inc_gl_openglesdispatch, + inc_gl_server + ] +else + additional_includes = [] +endif + lib_vulkan_server = static_library( 'lib_vulkan_server', files_lib_vulkan_server, @@ -71,8 +80,6 @@ lib_vulkan_server = static_library( inc_cereal, inc_common_base, inc_common_utils, - inc_gl_openglesdispatch, - inc_gl_server, inc_glm, inc_host_backend, inc_host_compressed_textures, @@ -94,7 +101,7 @@ lib_vulkan_server = static_library( inc_stream_servers, inc_vulkan_headers, inc_vulkan_server, - ], + ] + additional_includes, link_with: [ lib_common_base, lib_emulated_textures, diff --git a/meson.build b/meson.build index 3805b94d7..4dfd11d59 100644 --- a/meson.build +++ b/meson.build @@ -82,6 +82,13 @@ else thread_dep = dependency('threads') endif +if host_machine.system() == 'darwin' + add_languages('objc', 'objcpp') + cocoa_dep = dependency('appleframeworks', modules: 'Cocoa', required: true) + corefoundation_dep = dependency('appleframeworks', modules: 'CoreFoundation', required: true) + iokit_dep = dependency('appleframeworks', modules: 'IOKit', required: true) +endif + if log_level == 'error' gfxstream_host_args += '-DSTREAM_RENDERER_LOG_LEVEL=1' elif log_level == 'warn' From 5c119efce6c2f6c53b4e852d1037568814c8b56b Mon Sep 17 00:00:00 2001 From: osy Date: Sun, 5 Oct 2025 17:08:32 -0700 Subject: [PATCH 2/4] Add supportsPortabilityEnumeration flag On macOS MoltenVK can be installed as part of Vulkan SDK or as standalone. If standalone, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME will not be supported. Therefore, we decouple the detection of portability enumeration from detection of MoltenVK. --- host/vulkan/VkCommonOperations.cpp | 9 ++++++++- host/vulkan/VkCommonOperations.h | 3 +++ host/vulkan/VkDecoderGlobalState.cpp | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/host/vulkan/VkCommonOperations.cpp b/host/vulkan/VkCommonOperations.cpp index 1128613f0..eb3b64a2d 100644 --- a/host/vulkan/VkCommonOperations.cpp +++ b/host/vulkan/VkCommonOperations.cpp @@ -835,6 +835,8 @@ std::unique_ptr VkEmulation::create(VulkanDispatch* gvk, #if defined(__APPLE__) std::vector moltenVkInstanceExtNames = { VK_MVK_MACOS_SURFACE_EXTENSION_NAME, + }; + std::vector portabilityEnumerationNames = { VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, }; std::vector moltenVkDeviceExtNames = { @@ -861,11 +863,13 @@ std::unique_ptr VkEmulation::create(VulkanDispatch* gvk, bool externalFenceCapabilitiesSupported = getPhysicalDeviceProperties2Supported && extensionsSupported(instanceExts, externalFenceInstanceExtNames); bool surfaceSupported = extensionsSupported(instanceExts, surfaceInstanceExtNames); + bool usePortabilityEnumeration = false; #if defined(__APPLE__) const std::string vulkanIcd = gfxstream::base::getEnvironmentVariable("ANDROID_EMU_VK_ICD"); const bool moltenVKRequested = (vulkanIcd == "moltenvk"); const bool useExternalMemoryMetal = moltenVKRequested || (vulkanIcd == "kosmickrisp"); const bool moltenVKSupported = extensionsSupported(instanceExts, moltenVkInstanceExtNames); + usePortabilityEnumeration = extensionsSupported(instanceExts, portabilityEnumerationNames); if (moltenVKRequested && !moltenVKSupported) { // This might happen if the user manually changes moltenvk ICD library // Just a warning to enable a later version without or other drivers without portability @@ -945,7 +949,7 @@ std::unique_ptr VkEmulation::create(VulkanDispatch* gvk, } #if defined(__APPLE__) - if (useMoltenVK) { + if (useMoltenVK && usePortabilityEnumeration) { GFXSTREAM_INFO("MoltenVK is supported, enabling Vulkan portability."); instCi.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; for (auto extension : moltenVkInstanceExtNames) { @@ -1052,6 +1056,7 @@ std::unique_ptr VkEmulation::create(VulkanDispatch* gvk, #if defined(__APPLE__) emulation->mInstanceSupportsMoltenVK = useMoltenVK; emulation->mInstanceSupportsExternalMemoryMetal = useExternalMemoryMetal; + emulation->mInstanceSupportsPortabilityEnumeration = usePortabilityEnumeration; #endif if (emulation->mInstanceSupportsGetPhysicalDeviceProperties2) { @@ -1794,6 +1799,8 @@ bool VkEmulation::supportsMoltenVk() const { return mInstanceSupportsMoltenVK; } bool VkEmulation::supportsExternalMemoryMetal() const { return mInstanceSupportsExternalMemoryMetal; } +bool VkEmulation::supportsPortabilityEnumeration() const { return mInstanceSupportsPortabilityEnumeration; } + bool VkEmulation::supportsPhysicalDeviceIDProperties() const { return mInstanceSupportsPhysicalDeviceIDProperties; } diff --git a/host/vulkan/VkCommonOperations.h b/host/vulkan/VkCommonOperations.h index 4e63ed127..92b346e98 100644 --- a/host/vulkan/VkCommonOperations.h +++ b/host/vulkan/VkCommonOperations.h @@ -117,6 +117,7 @@ class VkEmulation { bool supportsSurfaces() const; bool supportsMoltenVk() const; bool supportsExternalMemoryMetal() const; + bool supportsPortabilityEnumeration() const; bool supportsGetPhysicalDeviceProperties2() const; @@ -578,9 +579,11 @@ class VkEmulation { #if defined(__APPLE__) bool mInstanceSupportsMoltenVK = false; bool mInstanceSupportsExternalMemoryMetal = false; + bool mInstanceSupportsPortabilityEnumeration = false; #else static const bool mInstanceSupportsMoltenVK = false; static const bool mInstanceSupportsExternalMemoryMetal = false; + static const bool mInstanceSupportsPortabilityEnumeration = false; #endif PFN_vkGetPhysicalDeviceImageFormatProperties2KHR mGetImageFormatProperties2Func = nullptr; diff --git a/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp index 90b963db4..76ac0c2a0 100644 --- a/host/vulkan/VkDecoderGlobalState.cpp +++ b/host/vulkan/VkDecoderGlobalState.cpp @@ -9366,6 +9366,8 @@ class VkDecoderGlobalState::Impl { #if defined(__APPLE__) if (m_vkEmulation->supportsMoltenVk()) { res.push_back(VK_MVK_MACOS_SURFACE_EXTENSION_NAME); + } + if (m_vkEmulation->supportsPortabilityEnumeration()) { res.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME); } #endif From be4c36b52ae4db8f11ef805f778af5a5cfb6853c Mon Sep 17 00:00:00 2001 From: osy Date: Sun, 5 Oct 2025 17:11:14 -0700 Subject: [PATCH 3/4] Pass detection of emulated extensions on macOS Just like QNX, macOS does not natively support DMA buffers. Also indicate that VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME is emulated in `vkEnumerateDeviceExtensionProperties`. --- host/vulkan/VkCommonOperations.cpp | 2 +- host/vulkan/VkDecoderGlobalState.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/host/vulkan/VkCommonOperations.cpp b/host/vulkan/VkCommonOperations.cpp index eb3b64a2d..5ffcce867 100644 --- a/host/vulkan/VkCommonOperations.cpp +++ b/host/vulkan/VkCommonOperations.cpp @@ -1206,7 +1206,7 @@ std::unique_ptr VkEmulation::create(VulkanDispatch* gvk, } // TODO(aruby@qnx.com): Remove once dmabuf extension support has been flushed out on QNX -#if !defined(__QNX__) +#if !defined(__QNX__) && !defined(__APPLE__) bool dmaBufBlockList = (deviceInfos[i].driverVendor == "NVIDIA (Vendor 0x10de)"); #ifdef CONFIG_AEMU // TODO(b/400999642): dma_buf support should be checked with image format support diff --git a/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp index 76ac0c2a0..aba4d3a53 100644 --- a/host/vulkan/VkDecoderGlobalState.cpp +++ b/host/vulkan/VkDecoderGlobalState.cpp @@ -154,7 +154,7 @@ static constexpr const char* const kEmulatedDeviceExtensions[] = { VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME, VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, -#if defined(__QNX__) +#if defined(__QNX__) || defined(__APPLE__) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME, #endif @@ -1921,6 +1921,15 @@ class VkDecoderGlobalState::Impl { } #endif + // VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME is emulated by gfxstream + if (!hasDeviceExtension(properties, VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME)) { + VkExtensionProperties queue_props; + strncpy(queue_props.extensionName, VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME, + sizeof(queue_props.extensionName)); + queue_props.specVersion = VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION; + properties.push_back(queue_props); + } + if (m_vkEmulation->isYcbcrEmulationEnabled() && !hasDeviceExtension(properties, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME)) { VkExtensionProperties ycbcr_props; From cdea1725134268102de145a27b3688b7761169a7 Mon Sep 17 00:00:00 2001 From: osy Date: Sun, 5 Oct 2025 17:13:42 -0700 Subject: [PATCH 4/4] Remove replacement dedicated allocation for macOS MoltenVK enforces that a single VkImage can be dedicated to a memory binding. When this code runs it breaks that promise and results in an error return when `vkBindImageMemory` is called by the client. --- host/vulkan/VkDecoderGlobalState.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp index aba4d3a53..becaac3d1 100644 --- a/host/vulkan/VkDecoderGlobalState.cpp +++ b/host/vulkan/VkDecoderGlobalState.cpp @@ -5834,20 +5834,6 @@ class VkDecoderGlobalState::Impl { // Use metal object extension on host-vulkan mode for color buffer import, // other paths on MacOS will use FD handles if (m_vkEmulation->supportsExternalMemoryMetal()) { - if (dedicatedAllocInfoPtr == nullptr || localDedicatedAllocInfo.image == VK_NULL_HANDLE) { - // TODO(b/351765838): This should not happen, but somehow the guest - // is not providing us the necessary information for video rendering. - localDedicatedAllocInfo = { - .sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO, - .pNext = nullptr, - .image = - m_vkEmulation->getColorBufferVkImage(importCbInfoPtr->colorBuffer), - .buffer = VK_NULL_HANDLE, - }; - - shouldUseDedicatedAllocInfo = true; - } - MTLResource_id cbExtMemoryHandle = m_vkEmulation->getColorBufferMetalMemoryHandle( importCbInfoPtr->colorBuffer);