Blender  V2.93
GPU_context.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2016 by Mike Erwin.
17  * All rights reserved.
18  */
19 
26 #pragma once
27 
28 #include "GPU_batch.h"
29 #include "GPU_common.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 typedef enum eGPUBackendType {
39 
40 void GPU_backend_init(eGPUBackendType backend);
41 void GPU_backend_exit(void);
42 
44 typedef struct GPUContext GPUContext;
45 
46 GPUContext *GPU_context_create(void *ghost_window);
48 
51 
52 /* Legacy GPU (Intel HD4000 series) do not support sharing GPU objects between GPU
53  * contexts. EEVEE/Workbench can create different contexts for image/preview rendering, baking or
54  * compiling. When a legacy GPU is detected (`GPU_use_main_context_workaround()`) any worker
55  * threads should use the draw manager opengl context and make sure that they are the only one
56  * using it by locking the main context using these two functions. */
57 void GPU_context_main_lock(void);
58 void GPU_context_main_unlock(void);
59 
60 #ifdef __cplusplus
61 }
62 #endif
struct GPUContext GPUContext
Definition: GPU_context.h:44
eGPUBackendType
Definition: GPU_context.h:35
@ GPU_BACKEND_NONE
Definition: GPU_context.h:36
@ GPU_BACKEND_OPENGL
Definition: GPU_context.h:37
void GPU_context_main_lock(void)
Definition: gpu_context.cc:149
void GPU_backend_init(eGPUBackendType backend)
Definition: gpu_context.cc:167
GPUContext * GPU_context_active_get(void)
Definition: gpu_context.cc:136
void GPU_context_discard(GPUContext *)
Definition: gpu_context.cc:113
GPUContext * GPU_context_create(void *ghost_window)
Definition: gpu_context.cc:99
void GPU_backend_exit(void)
Definition: gpu_context.cc:183
void GPU_context_active_set(GPUContext *)
Definition: gpu_context.cc:121
void GPU_context_main_unlock(void)
Definition: gpu_context.cc:154