Blender V5.3
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"
12struct DRWInstanceDataList;
13class GHOST_IContext;
14
15namespace blender {
16
17struct ARegion;
18struct Depsgraph;
19struct DRWData;
20struct GPUMaterial;
21struct GPUOffScreen;
22struct GPUVertFormat;
23struct GPUViewport;
24struct ID;
25struct Main;
26struct Object;
27struct RegionView3D;
28struct Render;
29struct RenderEngine;
30struct RenderEngineType;
31struct Scene;
32struct View3D;
33struct ViewLayer;
34struct bContext;
35struct rcti;
36
37namespace bke {
38enum class AttrType : int16_t;
39}
40
42void DRW_engines_free();
43
44void DRW_module_init();
45void DRW_module_exit();
46
48
53using DRW_SelectPassFn = bool (*)(eDRWSelectStage stage, void *user_data);
54using DRW_ObjectFilterFn = bool (*)(Object *ob, void *user_data);
55
61void DRW_draw_view(const bContext *C);
65void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height);
66
71void DRW_draw_render_loop_offscreen(Depsgraph *depsgraph,
72 RenderEngineType *engine_type,
73 ARegion *region,
74 View3D *v3d,
75 bContext *context,
76 bool is_image_render,
77 bool draw_background,
78 bool do_color_management,
79 GPUOffScreen *ofs,
80 GPUViewport *viewport);
84void DRW_draw_select_loop(Depsgraph *depsgraph,
85 ARegion *region,
86 View3D *v3d,
87 bool draw_surface,
88 bool use_nearest,
89 bool do_material_sub_selection,
90 const rcti *rect,
91 DRW_SelectPassFn select_pass_fn,
92 void *select_pass_user_data,
93 DRW_ObjectFilterFn object_filter_fn,
94 void *object_filter_user_data);
98void DRW_draw_depth_loop(Depsgraph *depsgraph,
99 ARegion *region,
100 View3D *v3d,
101 GPUViewport *viewport,
102 const bool use_gpencil,
103 const bool use_only_selected,
104 const bool use_only_active_object);
105
106void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d);
107
112
113/* Grease pencil render. */
114
121bool DRW_render_check_grease_pencil(Depsgraph *depsgraph, View3D *v3d = nullptr);
122
127void DRW_render_gpencil(RenderEngine *engine, Depsgraph *depsgraph);
128
131
132void DRW_mutexes_init();
133void DRW_mutexes_exit();
134
135/* Mutex to lock the drw manager and avoid concurrent context usage.
136 * Equivalent to the old DST lock.
137 * Brought back to 4.5 due to unforeseen issues causing data races and race conditions with Images
138 * and GPUTextures. (See #141253) */
139void DRW_lock_start();
140void DRW_lock_end();
141
142/* Critical section for gpu::Shader usage. Can be removed when we have threadsafe gpu::Shader
143 * class. */
145void DRW_submission_end();
146
164
165#ifdef WITH_XR_OPENXR
166/* XXX: see comment on #DRW_system_gpu_context_get() */
167GHOST_IContext *DRW_system_gpu_context_get();
168void *DRW_xr_blender_gpu_context_get();
169void DRW_xr_drawing_begin();
170void DRW_xr_drawing_end();
171#endif
172
175
176namespace draw {
177
180
181} // namespace draw
182
184void DRW_gpu_context_enable_ex(bool restore);
185void DRW_gpu_context_disable_ex(bool restore);
186
187/* Render pipeline GPU context control.
188 * Enable system context first, then enable blender context,
189 * then disable blender context, then disable system context. */
190
191void DRW_system_gpu_render_context_enable(GHOST_IContext *re_system_gpu_context);
192void DRW_system_gpu_render_context_disable(GHOST_IContext *re_system_gpu_context);
193void DRW_blender_gpu_render_context_enable(void *re_gpu_context);
194void DRW_blender_gpu_render_context_disable(void *re_gpu_context);
195
196DRWData *DRW_viewport_data_create();
197void DRW_viewport_data_free(DRWData *drw_data);
198
200void DRW_gpu_context_activate(bool drw_state);
201
202namespace draw {
203
204void DRW_cdlayer_attr_aliases_add(GPUVertFormat *format,
205 const char *base_name,
206 bke::AttrType data_type,
207 StringRef layer_name,
208 bool is_active_render,
209 bool is_active_layer);
210
211}
212
213} // namespace blender
#define C
Definition RandGen.cpp:29
void DRW_cdlayer_attr_aliases_add(GPUVertFormat *format, const char *base_name, bke::AttrType data_type, StringRef layer_name, bool is_active_render, bool is_active_layer)
BMesh Iterators.
void DRW_gpu_context_enable()
void DRW_draw_select_loop(Depsgraph *depsgraph, ARegion *region, View3D *v3d, 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_draw_view(const bContext *C)
void DRW_render_context_enable(Render *render)
void DRW_blender_gpu_render_context_enable(void *re_gpu_context)
DRWData * DRW_viewport_data_create()
void DRW_render_context_disable(Render *render)
void DRW_system_gpu_render_context_disable(GHOST_IContext *re_system_gpu_context)
bool(*)(Object *ob, void *user_data) DRW_ObjectFilterFn
Definition DRW_engine.hh:54
void DRW_engines_free()
void DRW_system_gpu_render_context_enable(GHOST_IContext *re_system_gpu_context)
void DRW_gpu_context_disable_ex(bool restore)
bool(*)(eDRWSelectStage stage, void *user_data) DRW_SelectPassFn
Definition DRW_engine.hh:53
void DRW_blender_gpu_render_context_disable(void *re_gpu_context)
void DRW_mutexes_exit()
void DRW_gpu_context_enable_ex(bool restore)
void DRW_module_init()
void DRW_cache_free_old_batches(Main *bmain)
bool DRW_gpu_context_is_enabled()
void DRW_viewport_data_free(DRWData *drw_data)
void DRW_gpu_context_disable()
void DRW_engine_external_free(RegionView3D *rv3d)
bool DRW_draw_in_progress()
void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d)
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_module_exit()
void DRW_draw_render_loop_offscreen(Depsgraph *depsgraph, RenderEngineType *engine_type, ARegion *region, View3D *v3d, bContext *context, bool is_image_render, bool draw_background, bool do_color_management, GPUOffScreen *ofs, GPUViewport *viewport)
void DRW_lock_start()
void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height)
@ DRW_SELECT_PASS_PRE
Definition DRW_engine.hh:50
@ DRW_SELECT_PASS_POST
Definition DRW_engine.hh:51
void DRW_submission_end()
bool DRW_render_check_grease_pencil(Depsgraph *depsgraph, View3D *v3d=nullptr)
void DRW_gpu_context_destroy()
void DRW_render_gpencil(RenderEngine *engine, Depsgraph *depsgraph)
void DRW_lock_end()
bool DRW_gpu_context_release()
void DRW_submission_start()
bool DRW_gpu_context_try_enable()
void DRW_mutexes_init()
void DRW_engines_register()
void DRW_gpu_context_activate(bool drw_state)
void DRW_gpu_context_create()
signed short int16_t
Definition BKE_text.h:77