Blender V4.3
GPU_context.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2016 by Mike Erwin. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#pragma once
12
13#include "GPU_batch.hh"
14#include "GPU_common.hh"
15#include "GPU_platform.hh"
16
17/* GPU back-ends abstract the differences between different APIs. #GPU_context_create
18 * automatically initializes the back-end, and #GPU_context_discard frees it when there
19 * are no more contexts. */
24
38
43
48
50struct GPUContext;
51
52GPUContext *GPU_context_create(void *ghost_window, void *ghost_context);
57
63
64/* Begin and end frame are used to mark the singular boundary representing the lifetime of a whole
65 * frame. This also acts as a divisor for ensuring workload submission and flushing, especially for
66 * background rendering when there is no call to present.
67 * This is required by explicit-API's where there is no implicit workload flushing. */
70
71/* Legacy GPU (Intel HD4000 series) do not support sharing GPU objects between GPU
72 * contexts. EEVEE/Workbench can create different contexts for image/preview rendering, baking or
73 * compiling. When a legacy GPU is detected (`GPU_use_main_context_workaround()`) any worker
74 * threads should use the draw manager opengl context and make sure that they are the only one
75 * using it by locking the main context using these two functions. */
78
79/* GPU Begin/end work blocks */
80void GPU_render_begin();
81void GPU_render_end();
82
83/* For operations which need to run exactly once per frame -- even if there are no render updates.
84 */
85void GPU_render_step();
86
87/* For when we need access to a system context in order to create a GPU context. */
88void GPU_backend_ghost_system_set(void *ghost_system_handle);
void GPU_render_end()
GPUContext * GPU_context_create(void *ghost_window, void *ghost_context)
void GPU_context_main_lock()
void GPU_backend_type_selection_set(const eGPUBackendType backend)
bool GPU_backend_supported()
void * GPU_backend_ghost_system_get()
void GPU_context_begin_frame(GPUContext *ctx)
void GPU_render_begin()
bool GPU_backend_type_selection_is_overridden()
GPUContext * GPU_context_active_get()
eGPUBackendType GPU_backend_type_selection_get()
void GPU_render_step()
void GPU_context_main_unlock()
void GPU_context_discard(GPUContext *)
bool GPU_backend_type_selection_detect()
void GPU_context_end_frame(GPUContext *ctx)
void GPU_context_active_set(GPUContext *)
eGPUBackendType GPU_backend_get_type()
void GPU_backend_ghost_system_set(void *ghost_system_handle)
void GPU_backend_type_selection_set_override(eGPUBackendType backend_type)
struct GPUContext GPUContext