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:
authorMichael Kowalski <makowalski@nvidia.com>2022-09-23 23:56:14 +0300
committerMichael Kowalski <makowalski@nvidia.com>2022-09-23 23:56:14 +0300
commitb2ad97ba97f3e55d1dd463e29ca0b2ec6fe761e1 (patch)
treef94394835c6b731e4e379f4ef48fb78b4af4b9ca /source/blender/gpu/intern/gpu_context.cc
parentb31807c75f0c18c43ac6979e6da57dc9d420167a (diff)
parent7e980f2b8cb96aa6d04dc72899d08473367eeeb9 (diff)
Merge branch 'master' into tmp-usd-alab-v2-T100452tmp-usd-alab-v2-T100452
Diffstat (limited to 'source/blender/gpu/intern/gpu_context.cc')
-rw-r--r--source/blender/gpu/intern/gpu_context.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc
index e29b0d5801d..92cbbc5b4b0 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -56,11 +56,15 @@ static void gpu_backend_discard();
namespace blender::gpu {
+int Context::context_counter = 0;
Context::Context()
{
thread_ = pthread_self();
is_active_ = false;
matrix_state = GPU_matrix_state_create();
+
+ context_id = Context::context_counter;
+ Context::context_counter++;
}
Context::~Context()
@@ -90,7 +94,7 @@ Context *Context::get()
/* -------------------------------------------------------------------- */
-GPUContext *GPU_context_create(void *ghost_window)
+GPUContext *GPU_context_create(void *ghost_window, void *ghost_context)
{
{
std::scoped_lock lock(backend_users_mutex);
@@ -101,7 +105,7 @@ GPUContext *GPU_context_create(void *ghost_window)
num_backend_users++;
}
- Context *ctx = GPUBackend::get()->context_alloc(ghost_window);
+ Context *ctx = GPUBackend::get()->context_alloc(ghost_window, ghost_context);
GPU_context_active_set(wrap(ctx));
return wrap(ctx);
@@ -212,6 +216,9 @@ void GPU_render_step()
/** \name Backend selection
* \{ */
+/* NOTE: To enable Metal API, we need to temporarily change this to `GPU_BACKEND_METAL`.
+ * Until a global switch is added, Metal also needs to be enabled in GHOST_ContextCGL:
+ * `m_useMetalForRendering = true`. */
static const eGPUBackendType g_backend_type = GPU_BACKEND_OPENGL;
static GPUBackend *g_backend = nullptr;