Blender  V2.93
DRW_engine.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  * Copyright 2016, Blender Foundation.
17  */
18 
23 #pragma once
24 
25 #include "BLI_sys_types.h" /* for bool */
26 
27 #include "DNA_object_enums.h"
28 
29 #include "DRW_engine_types.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 struct ARegion;
36 struct DRWInstanceDataList;
37 struct Depsgraph;
38 struct DrawEngineType;
39 struct GHash;
40 struct GPUMaterial;
41 struct GPUOffScreen;
42 struct GPUViewport;
43 struct ID;
44 struct Main;
45 struct Object;
46 struct Render;
47 struct RenderEngine;
48 struct RenderEngineType;
49 struct Scene;
50 struct View3D;
51 struct ViewLayer;
52 struct bContext;
53 struct rcti;
54 
55 void DRW_engines_register(void);
56 void DRW_engines_free(void);
57 
58 bool DRW_engine_render_support(struct DrawEngineType *draw_engine_type);
59 void DRW_engine_register(struct DrawEngineType *draw_engine_type);
61  const void *engine_type, int *r_fbl_len, int *r_txl_len, int *r_psl_len, int *r_stl_len);
62 
63 typedef struct DRWUpdateContext {
64  struct Main *bmain;
66  struct Scene *scene;
68  struct ARegion *region;
69  struct View3D *v3d;
72 void DRW_notify_view_update(const DRWUpdateContext *update_ctx);
73 
74 typedef enum eDRWSelectStage {
79 typedef bool (*DRW_ObjectFilterFn)(struct Object *ob, void *user_data);
80 
81 void DRW_draw_view(const struct bContext *C);
82 void DRW_draw_region_engine_info(int xoffset, int *yoffset, int line_height);
83 
85  struct RenderEngineType *engine_type,
86  struct ARegion *region,
87  struct View3D *v3d,
88  struct GPUViewport *viewport,
89  const struct bContext *evil_C);
91  struct ARegion *region,
92  struct View3D *v3d,
93  struct GPUViewport *viewport);
95  struct RenderEngineType *engine_type,
96  struct ARegion *region,
97  struct View3D *v3d,
98  const bool is_image_render,
99  const bool draw_background,
100  const bool do_color_management,
101  struct GPUOffScreen *ofs,
102  struct GPUViewport *viewport);
104  struct ARegion *region,
105  struct GPUViewport *viewport,
106  const struct bContext *evil_C);
108  struct ARegion *region,
109  struct View3D *v3d,
110  bool use_obedit_skip,
111  bool draw_surface,
112  bool use_nearest,
113  const struct rcti *rect,
114  DRW_SelectPassFn select_pass_fn,
115  void *select_pass_user_data,
116  DRW_ObjectFilterFn object_filter_fn,
117  void *object_filter_user_data);
119  struct ARegion *region,
120  struct View3D *v3d,
121  struct GPUViewport *viewport);
123  struct ARegion *region,
124  struct View3D *v3d,
125  struct GPUViewport *viewport);
126 void DRW_draw_depth_object(struct Scene *scene,
127  struct ARegion *region,
128  struct View3D *v3d,
129  struct GPUViewport *viewport,
130  struct Object *object);
132  struct ARegion *region,
133  struct View3D *v3d,
134  const struct rcti *rect);
135 
136 /* grease pencil render */
138 void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph);
139 
140 /* This is here because GPUViewport needs it */
142 void DRW_instance_data_list_free(struct DRWInstanceDataList *idatalist);
143 void DRW_uniform_attrs_pool_free(struct GHash *table);
144 
145 void DRW_render_context_enable(struct Render *render);
146 void DRW_render_context_disable(struct Render *render);
147 
148 void DRW_opengl_context_create(void);
149 void DRW_opengl_context_destroy(void);
150 void DRW_opengl_context_enable(void);
151 void DRW_opengl_context_disable(void);
152 
153 #ifdef WITH_XR_OPENXR
154 /* XXX see comment on DRW_xr_opengl_context_get() */
155 void *DRW_xr_opengl_context_get(void);
156 void *DRW_xr_gpu_context_get(void);
157 void DRW_xr_drawing_begin(void);
158 void DRW_xr_drawing_end(void);
159 #endif
160 
161 /* For garbage collection */
162 void DRW_cache_free_old_batches(struct Main *bmain);
163 
164 /* Never use this. Only for closing blender. */
165 void DRW_opengl_context_enable_ex(bool restore);
166 void DRW_opengl_context_disable_ex(bool restore);
167 
168 void DRW_opengl_render_context_enable(void *re_gl_context);
169 void DRW_opengl_render_context_disable(void *re_gl_context);
170 void DRW_gpu_render_context_enable(void *re_gpu_context);
171 void DRW_gpu_render_context_disable(void *re_gpu_context);
172 
173 void DRW_deferred_shader_remove(struct GPUMaterial *mat);
174 
175 struct DrawDataList *DRW_drawdatalist_from_id(struct ID *id);
176 void DRW_drawdata_free(struct ID *id);
177 
178 #ifdef __cplusplus
179 }
180 #endif
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
bool DRW_render_check_grease_pencil(struct Depsgraph *depsgraph)
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_draw_view(const struct bContext *C)
void DRW_engines_free(void)
void DRW_opengl_context_enable(void)
void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport)
void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, struct RenderEngineType *engine_type, struct ARegion *region, struct View3D *v3d, const bool is_image_render, const bool draw_background, const bool do_color_management, struct GPUOffScreen *ofs, struct GPUViewport *viewport)
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_batches(struct Main *bmain)
Definition: draw_manager.c:981
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:944
struct DrawDataList * DRW_drawdatalist_from_id(struct ID *id)
Definition: draw_manager.c:869
void DRW_deferred_shader_remove(struct GPUMaterial *mat)
void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph)
eDRWSelectStage
Definition: DRW_engine.h:74
@ DRW_SELECT_PASS_POST
Definition: DRW_engine.h:76
@ DRW_SELECT_PASS_PRE
Definition: DRW_engine.h:75
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:79
void DRW_uniform_attrs_pool_free(struct GHash *table)
bool(* DRW_SelectPassFn)(eDRWSelectStage stage, void *user_data)
Definition: DRW_engine.h:78
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_draw_depth_loop(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, struct GPUViewport *viewport)
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)
struct DRWUpdateContext DRWUpdateContext
void DRW_render_context_enable(struct Render *render)
void DRW_opengl_context_disable(void)
void DRW_opengl_context_destroy(void)
void DRW_draw_select_loop(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, bool use_obedit_skip, bool draw_surface, bool use_nearest, 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_engine_viewport_data_size_get(const void *engine_type, int *r_fbl_len, int *r_txl_len, int *r_psl_len, int *r_stl_len)
Definition: draw_manager.c:411
struct DRWInstanceDataList * DRW_instance_data_list_create(void)
#define C
Definition: RandGen.cpp:39
EvaluationStage stage
Definition: deg_eval.cc:96
Scene scene
const Depsgraph * depsgraph
void * user_data
struct Scene * scene
Definition: DRW_engine.h:66
struct View3D * v3d
Definition: DRW_engine.h:69
struct ARegion * region
Definition: DRW_engine.h:68
struct RenderEngineType * engine_type
Definition: DRW_engine.h:70
struct ViewLayer * view_layer
Definition: DRW_engine.h:67
struct Main * bmain
Definition: DRW_engine.h:64
struct Depsgraph * depsgraph
Definition: DRW_engine.h:65
Definition: DNA_ID.h:273
Definition: BKE_main.h:116
static void draw_background(const rcti *rect)
Definition: time_scrub_ui.c:63