Vulkan: Remove MoltenVK

Blender had some support for using MoltenVK. However there are some key
issues why MotlenVK cannot be used. Bugs have been reported up-stream.
As it doesn't work and holds back regular developments it will be removed
from the main branch.

Any efforts on making Vulkan run on Apple (including KosmicKrisp)
is considered a community effort and can be done in a development
branch.

Pull Request: https://projects.blender.org/blender/blender/pulls/144602
This commit is contained in:
Jeroen Bakker
2025-08-15 09:36:38 +02:00
committed by Thamsanqa Dreem
parent 49981df88a
commit 11ccf5e047
14 changed files with 11 additions and 152 deletions

View File

@@ -959,22 +959,12 @@ else()
endif()
# Vulkan
option(WITH_VULKAN_BACKEND "Enable Vulkan as graphics backend (experimental)" ON)
mark_as_advanced(WITH_VULKAN_BACKEND)
if(APPLE)
option(WITH_VULKAN_MOLTENVK "Enable Vulkan over MoltenVK (development option)" OFF)
mark_as_advanced(WITH_VULKAN_MOLTENVK)
endif()
if(APPLE AND NOT WITH_VULKAN_MOLTENVK)
if(NOT APPLE)
option(WITH_VULKAN_BACKEND "Enable Vulkan as graphics backend" ON)
mark_as_advanced(WITH_VULKAN_BACKEND)
else()
set(WITH_VULKAN_BACKEND OFF)
endif()
if(NOT WITH_EXPERIMENTAL_FEATURES)
if(APPLE)
set(WITH_VULKAN_MOLTENVK OFF)
set(WITH_VULKAN_BACKEND OFF)
endif()
endif()
# Metal
if(APPLE)

View File

@@ -1,68 +0,0 @@
# SPDX-FileCopyrightText: 2022 Blender Authors
#
# SPDX-License-Identifier: BSD-3-Clause
# - Find MoltenVK libraries
# Find the MoltenVK includes and libraries
# This module defines
# MOLTENVK_INCLUDE_DIRS, where to find MoltenVK headers, Set when
# MOLTENVK_INCLUDE_DIR is found.
# MOLTENVK_LIBRARIES, libraries to link against to use MoltenVK.
# MOLTENVK_ROOT_DIR, The base directory to search for MoltenVK.
# This can also be an environment variable.
# MOLTENVK_FOUND, If false, do not try to use MoltenVK.
#
# If `MOLTENVK_ROOT_DIR` was defined in the environment, use it.
if(DEFINED MOLTENVK_ROOT_DIR)
# Pass.
elseif(DEFINED ENV{MOLTENVK_ROOT_DIR})
set(MOLTENVK_ROOT_DIR $ENV{MOLTENVK_ROOT_DIR})
else()
set(MOLTENVK_ROOT_DIR "")
endif()
set(_moltenvk_SEARCH_DIRS
${MOLTENVK_ROOT_DIR}
)
# FIXME: These finder modules typically don't use LIBDIR,
# this should be set by `./build_files/cmake/platform/` instead.
if(DEFINED LIBDIR)
set(_moltenvk_SEARCH_DIRS ${_moltenvk_SEARCH_DIRS} ${LIBDIR}/moltenvk)
endif()
find_path(MOLTENVK_INCLUDE_DIR
NAMES
MoltenVK/vk_mvk_moltenvk.h
HINTS
${_moltenvk_SEARCH_DIRS}
PATH_SUFFIXES
include
)
find_library(MOLTENVK_LIBRARY
NAMES
libMoltenVK.dylib
HINTS
${_moltenvk_SEARCH_DIRS}
PATH_SUFFIXES
dynamic/dylib/macOS
)
# handle the QUIETLY and REQUIRED arguments and set MOLTENVK_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MoltenVK DEFAULT_MSG MOLTENVK_LIBRARY MOLTENVK_INCLUDE_DIR)
if(MOLTENVK_FOUND)
set(MOLTENVK_LIBRARIES ${MOLTENVK_LIBRARY})
set(MOLTENVK_INCLUDE_DIRS ${MOLTENVK_INCLUDE_DIR})
endif()
mark_as_advanced(
MOLTENVK_INCLUDE_DIR
MOLTENVK_LIBRARY
)
unset(_moltenvk_SEARCH_DIRS)

View File

@@ -5,7 +5,7 @@
# - Find ShaderC libraries
# Find the ShaderC includes and libraries
# This module defines
# SHADERC_INCLUDE_DIRS, where to find MoltenVK headers, Set when
# SHADERC_INCLUDE_DIRS, where to find ShaderC headers, Set when
# SHADERC_INCLUDE_DIR is found.
# SHADERC_LIBRARIES, libraries to link against to use ShaderC.
# SHADERC_ROOT_DIR, The base directory to search for ShaderC.

View File

@@ -108,12 +108,6 @@ if(WITH_OPENSUBDIV)
endif()
add_bundled_libraries(opensubdiv/lib)
if(WITH_VULKAN_BACKEND)
find_package(MoltenVK REQUIRED)
find_package(ShaderC REQUIRED)
find_package(Vulkan REQUIRED)
endif()
if(WITH_CODEC_SNDFILE)
find_package(SndFile)
find_library(_sndfile_FLAC_LIBRARY NAMES flac HINTS ${LIBDIR}/sndfile/lib)

View File

@@ -10,12 +10,6 @@ set(INC_SYS
${VULKAN_INCLUDE_DIRS}
)
if(APPLE)
list(APPEND INC_SYS
${MOLTENVK_INCLUDE_DIRS}
)
endif()
set(SRC
vk_mem_alloc_impl.cc

View File

@@ -4,11 +4,7 @@
#include <cstdio>
#ifdef __APPLE__
# include <MoltenVK/vk_mvk_moltenvk.h>
#else
# include <vulkan/vulkan.h>
#endif
#include <vulkan/vulkan.h>
#define VMA_IMPLEMENTATION

View File

@@ -90,16 +90,6 @@ if(WITH_OPENGL_BACKEND)
endif()
if(WITH_VULKAN_BACKEND)
if(WITH_VULKAN_MOLTENVK)
list(APPEND INC_SYS
PUBLIC ${MOLTENVK_INCLUDE_DIRS}
)
list(APPEND LIB
${MOLTENVK_LIBRARIES}
)
endif()
list(APPEND SRC
intern/GHOST_ContextVK.cc

View File

@@ -12,11 +12,7 @@
#include <string>
#ifdef WITH_VULKAN_BACKEND
# ifdef __APPLE__
# include <MoltenVK/vk_mvk_moltenvk.h>
# else
# include <vulkan/vulkan_core.h>
# endif
# include <vulkan/vulkan_core.h>
#endif
/* This is used by `GHOST_C-api.h` too, cannot use C++ conventions. */

View File

@@ -10,8 +10,6 @@
#ifdef _WIN32
# include <vulkan/vulkan_win32.h>
#elif defined(__APPLE__)
# include <MoltenVK/vk_mvk_moltenvk.h>
#else /* X11/WAYLAND. */
# ifdef WITH_GHOST_X11
# include <vulkan/vulkan_xlib.h>
@@ -279,11 +277,8 @@ class GHOST_DeviceVK {
queue_create_infos.push_back(graphic_queue_create_info);
VkPhysicalDeviceFeatures device_features = {};
#ifndef __APPLE__
device_features.geometryShader = VK_TRUE;
/* MoltenVK supports logicOp, needs to be build with MVK_USE_METAL_PRIVATE_API. */
device_features.logicOp = VK_TRUE;
#endif
device_features.dualSrcBlend = VK_TRUE;
device_features.imageCubeArray = VK_TRUE;
device_features.multiDrawIndirect = VK_TRUE;

View File

@@ -809,11 +809,6 @@ if(WITH_GTESTS)
list(APPEND INC_SYS
PUBLIC ${VULKAN_INCLUDE_DIRS}
)
if(APPLE)
list(APPEND INC_SYS
${MOLTENVK_INCLUDE_DIRS}
)
endif()
endif()
endif()
endif()

View File

@@ -426,16 +426,6 @@ endif()
if(WITH_VULKAN_BACKEND)
if(APPLE)
list(APPEND INC_SYS
${MOLTENVK_INCLUDE_DIRS}
)
list(APPEND LIB
${MOLTENVK_LIBRARIES}
)
endif()
list(APPEND INC
../../../extern/vulkan_memory_allocator
)

View File

@@ -501,15 +501,6 @@ void VKBackend::detect_workarounds(VKDevice &device)
workarounds.vertex_formats.r8g8b8 = (format_properties.bufferFeatures &
VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) == 0;
#ifdef __APPLE__
/* Due to a limitation in MoltenVK, attachments should be sequential even when using
* dynamic rendering. MoltenVK internally uses render passes to simulate dynamic rendering and
* same limitations apply. */
if (GPU_type_matches(GPU_DEVICE_APPLE, GPU_OS_MAC, GPU_DRIVER_ANY)) {
GCaps.render_pass_workaround = true;
}
#endif
device.workarounds_ = workarounds;
device.extensions_ = extensions;
}

View File

@@ -14,13 +14,9 @@
# include "BLI_winstuff.h"
#endif
#ifdef __APPLE__
# include <MoltenVK/vk_mvk_moltenvk.h>
#else
# include <vulkan/vulkan.h>
# ifdef _WIN32
# include <vulkan/vulkan_win32.h>
# endif
#include <vulkan/vulkan.h>
#ifdef _WIN32
# include <vulkan/vulkan_win32.h>
#endif
#if !defined(_WIN32) or defined(_M_ARM64)

View File

@@ -1672,7 +1672,7 @@ elseif(APPLE)
if(WITH_VULKAN_BACKEND)
install(
FILES ${VULKAN_LIBRARY} ${MOLTENVK_LIBRARY}
FILES ${VULKAN_LIBRARY}
DESTINATION ${TARGETDIR_LIB}
)
endif()