Blender V5.0
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
34namespace blender::bke {
35enum class AttrType : int16_t;
36}
37
39void DRW_engines_free();
40
41void DRW_module_init();
42void DRW_module_exit();
43
45
50using DRW_SelectPassFn = bool (*)(eDRWSelectStage stage, void *user_data);
51using DRW_ObjectFilterFn = bool (*)(Object *ob, void *user_data);
52
58void DRW_draw_view(const bContext *C);
62void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height);
63
68 RenderEngineType *engine_type,
69 ARegion *region,
70 View3D *v3d,
71 bool is_image_render,
72 bool draw_background,
73 bool do_color_management,
74 GPUOffScreen *ofs,
75 GPUViewport *viewport);
79void DRW_draw_select_loop(Depsgraph *depsgraph,
80 ARegion *region,
81 View3D *v3d,
82 bool use_obedit_skip,
83 bool draw_surface,
84 bool use_nearest,
85 bool do_material_sub_selection,
86 const rcti *rect,
87 DRW_SelectPassFn select_pass_fn,
88 void *select_pass_user_data,
89 DRW_ObjectFilterFn object_filter_fn,
90 void *object_filter_user_data);
94void DRW_draw_depth_loop(Depsgraph *depsgraph,
95 ARegion *region,
96 View3D *v3d,
97 GPUViewport *viewport,
98 const bool use_gpencil,
99 const bool use_only_selected,
100 const bool use_only_active_object);
101
102void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d);
103
108
109/* Grease pencil render. */
110
115
125
130void DRW_render_gpencil(RenderEngine *engine, Depsgraph *depsgraph);
131
134
135void DRW_mutexes_init();
136void DRW_mutexes_exit();
137
138/* Mutex to lock the drw manager and avoid concurrent context usage.
139 * Equivalent to the old DST lock.
140 * Brought back to 4.5 due to unforeseen issues causing data races and race conditions with Images
141 * and GPUTextures. (See #141253) */
142void DRW_lock_start();
143void DRW_lock_end();
144
145/* Critical section for gpu::Shader usage. Can be removed when we have threadsafe gpu::Shader
146 * class. */
148void DRW_submission_end();
149
167
168#ifdef WITH_XR_OPENXR
169/* XXX: see comment on #DRW_system_gpu_context_get() */
170void *DRW_system_gpu_context_get();
171void *DRW_xr_blender_gpu_context_get();
172void DRW_xr_drawing_begin();
173void DRW_xr_drawing_end();
174#endif
175
178
179namespace blender::draw {
180
183
184} // namespace blender::draw
185
187void DRW_gpu_context_enable_ex(bool restore);
188void DRW_gpu_context_disable_ex(bool restore);
189
190/* Render pipeline GPU context control.
191 * Enable system context first, then enable blender context,
192 * then disable blender context, then disable system context. */
193
194void DRW_system_gpu_render_context_enable(void *re_system_gpu_context);
195void DRW_system_gpu_render_context_disable(void *re_system_gpu_context);
196void DRW_blender_gpu_render_context_enable(void *re_gpu_context);
197void DRW_blender_gpu_render_context_disable(void *re_gpu_context);
198
200void DRW_viewport_data_free(DRWData *drw_data);
201
203void DRW_gpu_context_activate(bool drw_state);
204
205namespace blender::draw {
206
208 const char *base_name,
209 bke::AttrType data_type,
210 blender::StringRef layer_name,
211 bool is_active_render,
212 bool is_active_layer);
213
214}
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()
bool DRW_gpu_context_is_enabled()
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:51
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:46
@ DRW_SELECT_PASS_POST
Definition DRW_engine.hh:48
@ DRW_SELECT_PASS_PRE
Definition DRW_engine.hh:47
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:50
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, bke::AttrType data_type, blender::StringRef layer_name, bool is_active_render, bool is_active_layer)
Definition DNA_ID.h:414
static void draw_background(const rcti *rect)