Blender  V2.93
render_types.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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 /* ------------------------------------------------------------------------- */
27 /* exposed internal in render module only! */
28 /* ------------------------------------------------------------------------- */
29 
30 #include "DNA_object_types.h"
31 #include "DNA_scene_types.h"
32 
33 #include "BLI_threads.h"
34 
35 #include "BKE_main.h"
36 
37 #include "RE_pipeline.h"
38 
39 struct GHash;
40 struct Main;
41 struct Object;
42 struct RenderEngine;
43 struct ReportList;
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /* this is handed over to threaded hiding/passes/shading engine */
50 typedef struct RenderPart {
51  struct RenderPart *next, *prev;
52 
53  RenderResult *result; /* result of part rendering */
54  ListBase fullresult; /* optional full sample buffers */
55 
56  rcti disprect; /* part coordinates within total picture */
57  int rectx, recty; /* the size */
58  int nr; /* nr is partnr */
59  short status;
61 
62 enum {
63  /* PART_STATUS_NONE = 0, */ /* UNUSED */
67 };
68 
69 /* controls state of render, everything that's read-only during render stage */
70 struct Render {
71  struct Render *next, *prev;
73  int slot;
74 
75  /* state settings */
76  short flag, ok, result_ok;
77 
78  /* result of rendering */
80  /* if render with single-layer option, other rendered layers are stored here */
84  /* read/write mutex, all internal code that writes to re->result must use a
85  * write lock, all external code must use a read lock. internal code is assumed
86  * to not conflict with writes, so no lock used for that */
88 
92  int winx, winy;
93  rcti disprect; /* part within winx winy */
94  rctf viewplane; /* mapped on winx winy */
95 
96  /* final picture width and height (within disprect) */
97  int rectx, recty;
98 
99  /* real maximum size of parts after correction for minimum
100  * partx*xparts can be larger than rectx, in that case last part is smaller */
101  int partx, party;
102 
103  /* Camera transform, only used by Freestyle. */
104  float winmat[4][4];
105 
106  /* Clipping. */
107  float clip_start;
108  float clip_end;
109 
110  /* main, scene, and its full copy of renderdata and world */
111  struct Main *main;
117 
119  struct GHash *parts;
120 
121  /* render engine */
123 
124  /* NOTE: This is a minimal dependency graph and evaluated scene which is enough to access view
125  * layer visibility and use for post-precessing (compositor and sequencer). */
128 
129  /* callbacks */
130  void (*display_init)(void *handle, RenderResult *rr);
131  void *dih;
132  void (*display_clear)(void *handle, RenderResult *rr);
133  void *dch;
134  void (*display_update)(void *handle, RenderResult *rr, volatile rcti *rect);
135  void *duh;
136  void (*current_scene_update)(void *handle, struct Scene *scene);
137  void *suh;
138 
139  void (*stats_draw)(void *handle, RenderStats *ri);
140  void *sdh;
141  void (*progress)(void *handle, float i);
142  void *prh;
143 
144  void (*draw_lock)(void *handle, bool lock);
145  void *dlh;
146  int (*test_break)(void *handle);
147  void *tbh;
148 
150 
152 
155 
156  /* TODO replace by a whole draw manager. */
157  void *gl_context;
158  void *gpu_context;
159 };
160 
161 /* **************** defines ********************* */
162 
163 /* R.flag */
164 #define R_ANIMATION 1
165 
166 #ifdef __cplusplus
167 }
168 #endif
pthread_rwlock_t ThreadRWMutex
Definition: BLI_threads.h:126
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
#define MAX_NAME
Definition: DNA_defs.h:62
Object is a sort of wrapper for general info.
#define RE_MAXNAME
Definition: RE_pipeline.h:51
struct RenderPart RenderPart
@ PART_STATUS_IN_PROGRESS
Definition: render_types.h:64
@ PART_STATUS_MERGED
Definition: render_types.h:66
@ PART_STATUS_RENDERED
Definition: render_types.h:65
Definition: BKE_main.h:116
struct RenderPart * prev
Definition: render_types.h:51
struct RenderPart * next
Definition: render_types.h:51
short status
Definition: render_types.h:59
RenderResult * result
Definition: render_types.h:53
rcti disprect
Definition: render_types.h:56
ListBase fullresult
Definition: render_types.h:54
void(* current_scene_update)(void *handle, struct Scene *scene)
Definition: render_types.h:136
int recty
Definition: render_types.h:97
void * dch
Definition: render_types.h:133
float winmat[4][4]
Definition: render_types.h:104
struct Render * prev
Definition: render_types.h:71
void * sdh
Definition: render_types.h:140
void(* progress)(void *handle, float i)
Definition: render_types.h:141
Scene * pipeline_scene_eval
Definition: render_types.h:127
void * duh
Definition: render_types.h:135
void * prh
Definition: render_types.h:142
RenderResult * result
Definition: render_types.h:79
Depsgraph * pipeline_depsgraph
Definition: render_types.h:126
RenderResult * pushedresult
Definition: render_types.h:81
float clip_start
Definition: render_types.h:107
RenderData r
Definition: render_types.h:113
int winy
Definition: render_types.h:92
struct RenderEngine * engine
Definition: render_types.h:122
int slot
Definition: render_types.h:73
struct Main * main
Definition: render_types.h:111
void * dih
Definition: render_types.h:131
float clip_end
Definition: render_types.h:108
short ok
Definition: render_types.h:76
int active_view_layer
Definition: render_types.h:115
void * dlh
Definition: render_types.h:145
Scene * scene
Definition: render_types.h:112
ListBase fullresult
Definition: render_types.h:83
int rectx
Definition: render_types.h:97
ThreadRWMutex partsmutex
Definition: render_types.h:118
int partx
Definition: render_types.h:101
short result_ok
Definition: render_types.h:76
int party
Definition: render_types.h:101
short flag
Definition: render_types.h:76
struct GHash * parts
Definition: render_types.h:119
ThreadRWMutex resultmutex
Definition: render_types.h:87
char viewname[MAX_NAME]
Definition: render_types.h:154
struct Render * next
Definition: render_types.h:71
RenderStats i
Definition: render_types.h:149
void * tbh
Definition: render_types.h:147
void ** movie_ctx_arr
Definition: render_types.h:153
int winx
Definition: render_types.h:92
void(* display_init)(void *handle, RenderResult *rr)
Definition: render_types.h:130
void(* draw_lock)(void *handle, bool lock)
Definition: render_types.h:144
void(* stats_draw)(void *handle, RenderStats *ri)
Definition: render_types.h:139
void(* display_clear)(void *handle, RenderResult *rr)
Definition: render_types.h:132
rctf viewplane
Definition: render_types.h:94
int(* test_break)(void *handle)
Definition: render_types.h:146
void * suh
Definition: render_types.h:137
struct ReportList * reports
Definition: render_types.h:151
rcti disprect
Definition: render_types.h:93
struct Object * camera_override
Definition: render_types.h:116
void * gl_context
Definition: render_types.h:157
ListBase view_layers
Definition: render_types.h:114
char name[RE_MAXNAME]
Definition: render_types.h:72
void(* display_update)(void *handle, RenderResult *rr, volatile rcti *rect)
Definition: render_types.h:134
void * gpu_context
Definition: render_types.h:158