diff --git a/Common/GPU/Vulkan/VulkanLoader.cpp b/Common/GPU/Vulkan/VulkanLoader.cpp index 92e7e78659..ef911dd3bd 100644 --- a/Common/GPU/Vulkan/VulkanLoader.cpp +++ b/Common/GPU/Vulkan/VulkanLoader.cpp @@ -343,10 +343,6 @@ static VulkanLibraryHandle VulkanLoadLibrary(std::string *errorString) { return nullptr; #elif PPSSPP_PLATFORM(UWP) return nullptr; -#elif PPSSPP_PLATFORM(MAC) && PPSSPP_ARCH(AMD64) - // Disable Vulkan on Mac/x86. Too many configurations that don't work with MoltenVK - // for whatever reason. - return nullptr; #elif PPSSPP_PLATFORM(WINDOWS) return LoadLibrary(L"vulkan-1.dll"); #else diff --git a/Common/GPU/Vulkan/VulkanMemory.cpp b/Common/GPU/Vulkan/VulkanMemory.cpp index eba7476190..5482f8026e 100644 --- a/Common/GPU/Vulkan/VulkanMemory.cpp +++ b/Common/GPU/Vulkan/VulkanMemory.cpp @@ -38,6 +38,16 @@ static const double PUSH_GARBAGE_COLLECTION_DELAY = 10.0; VulkanPushPool::VulkanPushPool(VulkanContext *vulkan, const char *name, size_t originalBlockSize, VkBufferUsageFlags usage) : vulkan_(vulkan), name_(name), originalBlockSize_(originalBlockSize), usage_(usage) { RegisterGPUMemoryManager(this); + + #if PPSSPP_PLATFORM(MAC) && PPSSPP_ARCH(AMD64) + allocation_extra_flags_ = 0; + if (vulkan_->GetPhysicalDeviceProperties().properties.vendorID != VULKAN_VENDOR_INTEL) { + // ref https://github.com/KhronosGroup/MoltenVK/issues/960 + INFO_LOG(Log::G3D, "MoltenVK with dedicated gpu, adding VK_MEMORY_PROPERTY_HOST_COHERENT_BIT"); + allocation_extra_flags_ = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; + } + #endif + for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) { blocks_.push_back(CreateBlock(originalBlockSize)); blocks_.back().original = true; @@ -67,7 +77,11 @@ VulkanPushPool::Block VulkanPushPool::CreateBlock(size_t size) { b.usage = usage_; b.sharingMode = VK_SHARING_MODE_EXCLUSIVE; VmaAllocationCreateInfo allocCreateInfo{}; + allocCreateInfo.usage = VMA_MEMORY_USAGE_CPU_TO_GPU; + #if PPSSPP_PLATFORM(MAC) && PPSSPP_ARCH(AMD64) + allocCreateInfo.requiredFlags = allocation_extra_flags_; + #endif VmaAllocationInfo allocInfo{}; VkResult result = vmaCreateBuffer(vulkan_->Allocator(), &b, &allocCreateInfo, &block.buffer, &block.allocation, &allocInfo); diff --git a/Common/GPU/Vulkan/VulkanMemory.h b/Common/GPU/Vulkan/VulkanMemory.h index 14e3b78436..2c01577e36 100644 --- a/Common/GPU/Vulkan/VulkanMemory.h +++ b/Common/GPU/Vulkan/VulkanMemory.h @@ -93,4 +93,7 @@ private: VkBufferUsageFlags usage_; int curBlockIndex_ = -1; const char *name_; + #if PPSSPP_PLATFORM(MAC) && PPSSPP_ARCH(AMD64) + VkMemoryPropertyFlags allocation_extra_flags_; + #endif };