Blender  V3.3
DRW_engine.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2016 Blender Foundation. */
3 
8 #pragma once
9 
10 #include "BLI_sys_types.h" /* for bool */
11 
12 #include "DNA_object_enums.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 struct ARegion;
19 struct DRWData;
20 struct DRWInstanceDataList;
21 struct Depsgraph;
22 struct DrawEngineType;
23 struct GHash;
24 struct GPUMaterial;
25 struct GPUOffScreen;
26 struct GPUVertFormat;
27 struct CustomDataLayer;
28 struct CustomData;
29 struct GPUViewport;
30 struct ID;
31 struct Main;
32 struct Object;
33 struct Render;
34 struct RenderEngine;
35 struct RenderEngineType;
36 struct Scene;
37 struct View3D;
38 struct ViewLayer;
39 struct bContext;
40 struct rcti;
41 
42 void DRW_engines_register(void);
44 void DRW_engines_free(void);
45 
46 bool DRW_engine_render_support(struct DrawEngineType *draw_engine_type);
47 void DRW_engine_register(struct DrawEngineType *draw_engine_type);
48 
49 typedef struct DRWUpdateContext {
50  struct Main *bmain;
52  struct Scene *scene;
54  struct ARegion *region;
55  struct View3D *v3d;
58 void DRW_notify_view_update(const DRWUpdateContext *update_ctx);
59 
60 typedef enum eDRWSelectStage {
65 typedef bool (*DRW_ObjectFilterFn)(struct Object *ob, void *user_data);
66 
72 void DRW_draw_view(const struct bContext *C);
76 void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height);
77 
83  struct RenderEngineType *engine_type,
84  struct ARegion *region,
85  struct View3D *v3d,
86  struct GPUViewport *viewport,
87  const struct bContext *evil_C);
89  struct ARegion *region,
90  struct View3D *v3d,
91  struct GPUViewport *viewport);
96  struct RenderEngineType *engine_type,
97  struct ARegion *region,
98  struct View3D *v3d,
99  bool is_image_render,
100  bool draw_background,
101  bool do_color_management,
102  struct GPUOffScreen *ofs,
103  struct GPUViewport *viewport);
105  struct ARegion *region,
106  struct GPUViewport *viewport,
107  const struct bContext *evil_C);
112  struct ARegion *region,
113  struct View3D *v3d,
114  bool use_obedit_skip,
115  bool draw_surface,
116  bool use_nearest,
117  bool do_material_sub_selection,
118  const struct rcti *rect,
119  DRW_SelectPassFn select_pass_fn,
120  void *select_pass_user_data,
121  DRW_ObjectFilterFn object_filter_fn,
122  void *object_filter_user_data);
127  struct ARegion *region,
128  struct View3D *v3d,
129  struct GPUViewport *viewport,
130  const bool use_gpencil,
131  const bool use_basic,
132  const bool use_overlay);
136 void DRW_draw_depth_object(struct Scene *scene,
137  struct ARegion *region,
138  struct View3D *v3d,
139  struct GPUViewport *viewport,
140  struct Object *object);
142  struct ARegion *region,
143  struct View3D *v3d,
144  const struct rcti *rect);
145 
146 /* Grease pencil render. */
147 
152 void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph);
153 
158 void DRW_instance_data_list_free(struct DRWInstanceDataList *idatalist);
159 void DRW_uniform_attrs_pool_free(struct GHash *table);
160 
161 void DRW_render_context_enable(struct Render *render);
162 void DRW_render_context_disable(struct Render *render);
163 
164 void DRW_opengl_context_create(void);
165 void DRW_opengl_context_destroy(void);
166 void DRW_opengl_context_enable(void);
167 void DRW_opengl_context_disable(void);
168 
169 #ifdef WITH_XR_OPENXR
170 /* XXX see comment on DRW_xr_opengl_context_get() */
171 void *DRW_xr_opengl_context_get(void);
172 void *DRW_xr_gpu_context_get(void);
173 void DRW_xr_drawing_begin(void);
174 void DRW_xr_drawing_end(void);
175 #endif
176 
177 /* For garbage collection */
178 void DRW_cache_free_old_batches(struct Main *bmain);
179 void DRW_cache_free_old_subdiv(void);
180 
181 /* For the OpenGL evaluators and garbage collected subdivision data. */
182 void DRW_subdiv_free(void);
183 
184 /* Never use this. Only for closing blender. */
185 void DRW_opengl_context_enable_ex(bool restore);
186 void DRW_opengl_context_disable_ex(bool restore);
187 
188 void DRW_opengl_render_context_enable(void *re_gl_context);
189 void DRW_opengl_render_context_disable(void *re_gl_context);
193 void DRW_gpu_render_context_enable(void *re_gpu_context);
197 void DRW_gpu_render_context_disable(void *re_gpu_context);
198 
199 void DRW_deferred_shader_remove(struct GPUMaterial *mat);
200 
205 struct DrawDataList *DRW_drawdatalist_from_id(struct ID *id);
206 void DRW_drawdata_free(struct ID *id);
207 
208 struct DRWData *DRW_viewport_data_create(void);
209 void DRW_viewport_data_free(struct DRWData *drw_data);
210 
211 bool DRW_opengl_context_release(void);
212 void DRW_opengl_context_activate(bool drw_state);
213 
218 void DRW_draw_cursor_2d_ex(const struct ARegion *region, const float cursor[2]);
219 
221  const char *base_name,
222  const struct CustomData *data,
223  const struct CustomDataLayer *cl,
224  bool is_active_render,
225  bool is_active_layer);
226 #ifdef __cplusplus
227 }
228 #endif
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
bool DRW_render_check_grease_pencil(struct Depsgraph *depsgraph)
bool DRW_opengl_context_release(void)
void DRW_cdlayer_attr_aliases_add(struct GPUVertFormat *format, const char *base_name, const struct CustomData *data, const struct CustomDataLayer *cl, bool is_active_render, bool is_active_layer)
void DRW_opengl_context_create(void)
void DRW_gpu_render_context_enable(void *re_gpu_context)
void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height)
void DRW_draw_render_loop(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport)
void DRW_subdiv_free(void)
void DRW_draw_view(const struct bContext *C)
void DRW_engines_free(void)
void DRW_opengl_context_enable(void)
void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
void DRW_viewport_data_free(struct DRWData *drw_data)
Definition: draw_manager.c:440
void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, struct RenderEngineType *engine_type, struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport, const struct bContext *evil_C)
void DRW_opengl_render_context_disable(void *re_gl_context)
void DRW_cache_free_old_subdiv(void)
void DRW_cache_free_old_batches(struct Main *bmain)
Definition: draw_manager.c:948
void DRW_engines_register(void)
void DRW_gpu_render_context_disable(void *re_gpu_context)
void DRW_instance_data_list_free(struct DRWInstanceDataList *idatalist)
void DRW_opengl_context_disable_ex(bool restore)
void DRW_drawdata_free(struct ID *id)
Definition: draw_manager.c:911
struct DrawDataList * DRW_drawdatalist_from_id(struct ID *id)
Definition: draw_manager.c:836
void DRW_deferred_shader_remove(struct GPUMaterial *mat)
void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph)
eDRWSelectStage
Definition: DRW_engine.h:60
@ DRW_SELECT_PASS_POST
Definition: DRW_engine.h:62
@ DRW_SELECT_PASS_PRE
Definition: DRW_engine.h:61
void DRW_engine_register(struct DrawEngineType *draw_engine_type)
void DRW_draw_depth_object(struct Scene *scene, struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport, struct Object *object)
bool(* DRW_ObjectFilterFn)(struct Object *ob, void *user_data)
Definition: DRW_engine.h:65
void DRW_uniform_attrs_pool_free(struct GHash *table)
bool(* DRW_SelectPassFn)(eDRWSelectStage stage, void *user_data)
Definition: DRW_engine.h:64
void DRW_draw_depth_loop(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport, const bool use_gpencil, const bool use_basic, const bool use_overlay)
void DRW_draw_select_id(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const struct rcti *rect)
void DRW_draw_render_loop_2d_ex(struct Depsgraph *depsgraph, struct ARegion *region, struct GPUViewport *viewport, const struct bContext *evil_C)
void DRW_opengl_context_enable_ex(bool restore)
void DRW_opengl_render_context_enable(void *re_gl_context)
bool DRW_engine_render_support(struct DrawEngineType *draw_engine_type)
void DRW_render_context_disable(struct Render *render)
void DRW_draw_select_loop(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, bool use_obedit_skip, bool draw_surface, bool use_nearest, bool do_material_sub_selection, const struct rcti *rect, DRW_SelectPassFn select_pass_fn, void *select_pass_user_data, DRW_ObjectFilterFn object_filter_fn, void *object_filter_user_data)
void DRW_opengl_context_activate(bool drw_state)
void DRW_draw_cursor_2d_ex(const struct ARegion *region, const float cursor[2])
struct DRWUpdateContext DRWUpdateContext
void DRW_render_context_enable(struct Render *render)
void DRW_opengl_context_disable(void)
struct DRWData * DRW_viewport_data_create(void)
Definition: draw_manager.c:367
void DRW_opengl_context_destroy(void)
void DRW_engines_register_experimental(void)
void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, struct RenderEngineType *engine_type, struct ARegion *region, struct View3D *v3d, bool is_image_render, bool draw_background, bool do_color_management, struct GPUOffScreen *ofs, struct GPUViewport *viewport)
struct DRWInstanceDataList * DRW_instance_data_list_create(void)
#define C
Definition: RandGen.cpp:25
EvaluationStage stage
Definition: deg_eval.cc:89
Scene scene
const Depsgraph * depsgraph
void * user_data
format
Definition: logImageCore.h:38
struct Scene * scene
Definition: DRW_engine.h:52
struct View3D * v3d
Definition: DRW_engine.h:55
struct ARegion * region
Definition: DRW_engine.h:54
struct RenderEngineType * engine_type
Definition: DRW_engine.h:56
struct ViewLayer * view_layer
Definition: DRW_engine.h:53
struct Main * bmain
Definition: DRW_engine.h:50
struct Depsgraph * depsgraph
Definition: DRW_engine.h:51
Definition: DNA_ID.h:368
Definition: BKE_main.h:121
static void draw_background(const rcti *rect)
Definition: time_scrub_ui.c:48