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
44 lines
955 B
C++
44 lines
955 B
C++
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
* Copyright 2020 Blender Foundation. All rights reserved. */
|
|
|
|
/** \file
|
|
* \ingroup gpu
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "GPU_platform.h"
|
|
|
|
namespace blender::gpu {
|
|
|
|
class GPUPlatformGlobal {
|
|
public:
|
|
bool initialized = false;
|
|
eGPUDeviceType device;
|
|
eGPUOSType os;
|
|
eGPUDriverType driver;
|
|
eGPUSupportLevel support_level;
|
|
char *vendor = nullptr;
|
|
char *renderer = nullptr;
|
|
char *version = nullptr;
|
|
char *support_key = nullptr;
|
|
char *gpu_name = nullptr;
|
|
eGPUBackendType backend = GPU_BACKEND_NONE;
|
|
|
|
public:
|
|
void 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);
|
|
|
|
void clear();
|
|
};
|
|
|
|
extern GPUPlatformGlobal GPG;
|
|
|
|
} // namespace blender::gpu
|