Blender V4.5
DRW_engine.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2016 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_string_ref.hh"
12
13struct ARegion;
14struct DRWData;
15struct DRWInstanceDataList;
16struct Depsgraph;
17struct GPUMaterial;
18struct GPUOffScreen;
19struct GPUVertFormat;
20struct GPUViewport;
21struct ID;
22struct Main;
23struct Object;
24struct RegionView3D;
25struct Render;
26struct RenderEngine;
27struct RenderEngineType;
28struct Scene;
29struct View3D;
30struct ViewLayer;
31struct bContext;
32struct rcti;
33
35void DRW_engines_free();
36
37void DRW_module_init();
38void DRW_module_exit();
39
41
46using DRW_SelectPassFn = bool (*)(eDRWSelectStage stage, void *user_data);
47using DRW_ObjectFilterFn = bool (*)(Object *ob, void *user_data);
48
54void DRW_draw_view(const bContext *C);
58void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height);
59
64 RenderEngineType *engine_type,
65 ARegion *region,
66 View3D *v3d,
67 bool is_image_render,
68 bool draw_background,
69 bool do_color_management,
70 GPUOffScreen *ofs,
71 GPUViewport *viewport);
75void DRW_draw_select_loop(Depsgraph *depsgraph,
76 ARegion *region,
77 View3D *v3d,
78 bool use_obedit_skip,
79 bool draw_surface,
80 bool use_nearest,
81 bool do_material_sub_selection,
82 const rcti *rect,
83 DRW_SelectPassFn select_pass_fn,
84 void *select_pass_user_data,
85 DRW_ObjectFilterFn object_filter_fn,
86 void *object_filter_user_data);
90void DRW_draw_depth_loop(Depsgraph *depsgraph,
91 ARegion *region,
92 View3D *v3d,
93 GPUViewport *viewport,
94 const bool use_gpencil,
95 const bool use_only_selected,
96 const bool use_only_active_object);
97
98void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d);
99
104
105/* Grease pencil render. */
106
111
121
126void DRW_render_gpencil(RenderEngine *engine, Depsgraph *depsgraph);
127
130
131void DRW_mutexes_init();
132void DRW_mutexes_exit();
133
134/* Mutex to lock the drw manager and avoid concurrent context usage.
135 * Equivalent to the old DST lock.
136 * Brought back to 4.5 due to unforeseen issues causing data races and race conditions with Images
137 * and GPUTextures. (See #141253) */
138void DRW_lock_start();
139void DRW_lock_end();
140
141/* Critical section for GPUShader usage. Can be removed when we have threadsafe GPUShader class. */
143void DRW_submission_end();
144
158
159#ifdef WITH_XR_OPENXR
160/* XXX: see comment on #DRW_system_gpu_context_get() */
161void *DRW_system_gpu_context_get();
162void *DRW_xr_blender_gpu_context_get();
163void DRW_xr_drawing_begin();
164void DRW_xr_drawing_end();
165#endif
166
169
170namespace blender::draw {
171
174
175} // namespace blender::draw
176
178void DRW_gpu_context_enable_ex(bool restore);
179void DRW_gpu_context_disable_ex(bool restore);
180
181/* Render pipeline GPU context control.
182 * Enable system context first, then enable blender context,
183 * then disable blender context, then disable system context. */
184
185void DRW_system_gpu_render_context_enable(void *re_system_gpu_context);
186void DRW_system_gpu_render_context_disable(void *re_system_gpu_context);
187void DRW_blender_gpu_render_context_enable(void *re_gpu_context);
188void DRW_blender_gpu_render_context_disable(void *re_gpu_context);
189
191void DRW_viewport_data_free(DRWData *drw_data);
192
194void DRW_gpu_context_activate(bool drw_state);
195
196namespace blender::draw {
197
199 const char *base_name,
200 int data_type,
201 blender::StringRef layer_name,
202 bool is_active_render,
203 bool is_active_layer);
204
205}
void DRW_blender_gpu_render_context_disable(void *re_gpu_context)
void DRW_gpu_context_destroy()
void DRW_submission_end()
bool DRW_render_check_grease_pencil(Depsgraph *depsgraph)
DRWData * DRW_viewport_data_create()
void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height)
bool DRW_draw_in_progress()
void DRW_draw_view(const bContext *C)
void DRW_module_exit()
void DRW_gpu_context_disable()
bool DRW_gpencil_engine_needed_viewport(Depsgraph *depsgraph, View3D *v3d)
void DRW_gpu_context_disable_ex(bool restore)
bool(*)(Object *ob, void *user_data) DRW_ObjectFilterFn
Definition DRW_engine.hh:47
void DRW_draw_depth_loop(Depsgraph *depsgraph, ARegion *region, View3D *v3d, GPUViewport *viewport, const bool use_gpencil, const bool use_only_selected, const bool use_only_active_object)
void DRW_cache_free_old_batches(Main *bmain)
void DRW_draw_render_loop_offscreen(Depsgraph *depsgraph, RenderEngineType *engine_type, ARegion *region, View3D *v3d, bool is_image_render, bool draw_background, bool do_color_management, GPUOffScreen *ofs, GPUViewport *viewport)
void DRW_system_gpu_render_context_enable(void *re_system_gpu_context)
void DRW_gpu_context_enable()
void DRW_engines_free()
void DRW_gpu_context_create()
eDRWSelectStage
Definition DRW_engine.hh:42
@ DRW_SELECT_PASS_POST
Definition DRW_engine.hh:44
@ DRW_SELECT_PASS_PRE
Definition DRW_engine.hh:43
void DRW_gpu_context_activate(bool drw_state)
void DRW_draw_select_loop(Depsgraph *depsgraph, ARegion *region, View3D *v3d, bool use_obedit_skip, bool draw_surface, bool use_nearest, bool do_material_sub_selection, const rcti *rect, DRW_SelectPassFn select_pass_fn, void *select_pass_user_data, DRW_ObjectFilterFn object_filter_fn, void *object_filter_user_data)
void DRW_mutexes_init()
void DRW_render_context_disable(Render *render)
void DRW_gpu_context_enable_ex(bool restore)
void DRW_engine_external_free(RegionView3D *rv3d)
void DRW_viewport_data_free(DRWData *drw_data)
void DRW_mutexes_exit()
bool DRW_gpu_context_try_enable()
void DRW_module_init()
void DRW_system_gpu_render_context_disable(void *re_system_gpu_context)
void DRW_submission_start()
void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d)
void DRW_render_gpencil(RenderEngine *engine, Depsgraph *depsgraph)
bool DRW_gpu_context_release()
void DRW_engines_register()
void DRW_lock_start()
void DRW_render_context_enable(Render *render)
bool(*)(eDRWSelectStage stage, void *user_data) DRW_SelectPassFn
Definition DRW_engine.hh:46
void DRW_lock_end()
void DRW_blender_gpu_render_context_enable(void *re_gpu_context)
#define C
Definition RandGen.cpp:29
BPy_StructRNA * depsgraph
format
void DRW_cdlayer_attr_aliases_add(GPUVertFormat *format, const char *base_name, int data_type, blender::StringRef layer_name, bool is_active_render, bool is_active_layer)
Definition DNA_ID.h:404
static void draw_background(const rcti *rect)