Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Fielder <jason_apple>2022-03-22 14:38:28 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-03-22 14:54:34 +0300
commit309ea314858a9b7892ea2c8a6fe55ab2a1028697 (patch)
treead153ceb5e7e90c5cac65b59b99bb2d708577dba /CMakeLists.txt
parent913b6b9ec1b1f3cf83b21956b06e2f6d3341c78c (diff)
Metal: Initial Implementation of Metal Backend for GPU Module.
Adding WITH_METAL option to CMAKE to guard compilation for macOS only. Implemented stub METALBackend to mirror GPUBackend interface and added capabilities initialisation, along with API initialisation paths. Global rendering coordination commands added to backend with GPU_render_begin and GPU_render_end() commands globally wrapping GPU work. This is required for Metal to ensure temporary resources are generated within an NSAutoReleasePool and freed accordingly. Authored by Apple: Michael Parkin-White, Vil Harvey, Marco Giordano, Michael Jones, Morteza Mostajabodaveh, Jason Fielder Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D14293
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt23
1 files changed, 23 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04cedcc6722..d31a0c4a63d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -531,6 +531,19 @@ mark_as_advanced(
WITH_GPU_SHADER_BUILDER
)
+# Metal
+
+if (APPLE)
+ option(WITH_METAL_BACKEND "Use Metal for graphics instead of (or as well as) OpenGL on macOS." OFF)
+ mark_as_advanced(WITH_METAL_BACKEND)
+else()
+ set(WITH_METAL_BACKEND OFF)
+endif()
+
+if (WITH_METAL_BACKEND)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
+endif()
+
if(WIN32)
option(WITH_GL_ANGLE "Link with the ANGLE library, an OpenGL ES 2.0 implementation based on Direct3D, instead of the system OpenGL library." OFF)
mark_as_advanced(WITH_GL_ANGLE)
@@ -1275,6 +1288,16 @@ else()
endif()
#-----------------------------------------------------------------------------
+# Configure Metal.
+if (WITH_METAL_BACKEND)
+ add_definitions(-DWITH_METAL_BACKEND)
+
+ # No need to add frameworks here, all the ones we need for Metal and
+ # Metal-OpenGL Interop are already being added by
+ # build_files/cmake/platform/platform_apple.cmake
+endif()
+
+#-----------------------------------------------------------------------------
# Configure OpenMP.
if(WITH_OPENMP)
if(NOT OPENMP_CUSTOM)