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 /source/blender/gpu/intern/gpu_platform.cc
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 'source/blender/gpu/intern/gpu_platform.cc')
-rw-r--r--source/blender/gpu/intern/gpu_platform.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_platform.cc b/source/blender/gpu/intern/gpu_platform.cc
index 969a3033c6f..8d4e80abd97 100644
--- a/source/blender/gpu/intern/gpu_platform.cc
+++ b/source/blender/gpu/intern/gpu_platform.cc
@@ -65,6 +65,7 @@ void GPUPlatformGlobal::init(eGPUDeviceType gpu_device,
eGPUOSType os_type,
eGPUDriverType driver_type,
eGPUSupportLevel gpu_support_level,
+ eGPUBackendType backend,
const char *vendor_str,
const char *renderer_str,
const char *version_str)
@@ -83,6 +84,7 @@ void GPUPlatformGlobal::init(eGPUDeviceType gpu_device,
this->version = BLI_strdup(version_str);
this->support_key = create_key(gpu_support_level, vendor_str, renderer_str, version_str);
this->gpu_name = create_gpu_name(vendor_str, renderer_str, version_str);
+ this->backend = backend;
}
void GPUPlatformGlobal::clear()
@@ -143,8 +145,13 @@ const char *GPU_platform_gpu_name()
bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver)
{
+ return GPU_type_matches_ex(device, os, driver, GPU_BACKEND_ANY);
+}
+
+bool GPU_type_matches_ex(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver, eGPUBackendType backend)
+{
BLI_assert(GPG.initialized);
- return (GPG.device & device) && (GPG.os & os) && (GPG.driver & driver);
+ return (GPG.device & device) && (GPG.os & os) && (GPG.driver & driver) && (GPG.backend & backend);
}
/** \} */