diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_context.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_context.cc | 11 |
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; |