Blender  V2.93
eevee_engine.c
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 #include "DRW_render.h"
24 
25 #include "draw_color_management.h" /* TODO remove dependency */
26 
27 #include "BLI_rand.h"
28 
29 #include "BKE_object.h"
30 
31 #include "DEG_depsgraph_query.h"
32 
33 #include "DNA_world_types.h"
34 
35 #include "IMB_imbuf.h"
36 
37 #include "eevee_private.h"
38 
39 #include "eevee_engine.h" /* own include */
40 
41 #define EEVEE_ENGINE "BLENDER_EEVEE"
42 
43 /* *********** FUNCTIONS *********** */
44 
45 static void eevee_engine_init(void *ved)
46 {
47  EEVEE_Data *vedata = (EEVEE_Data *)ved;
48  EEVEE_TextureList *txl = vedata->txl;
49  EEVEE_FramebufferList *fbl = vedata->fbl;
50  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
53 
54  const DRWContextState *draw_ctx = DRW_context_state_get();
55  View3D *v3d = draw_ctx->v3d;
56  RegionView3D *rv3d = draw_ctx->rv3d;
57  Object *camera = (rv3d->persp == RV3D_CAMOB) ? v3d->camera : NULL;
58 
59  if (!stl->g_data) {
60  /* Alloc transient pointers */
61  stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__);
62  }
65  stl->g_data->background_alpha = DRW_state_draw_background() ? 1.0f : 0.0f;
67  stl->g_data->valid_taa_history = (txl->taa_history != NULL);
68  stl->g_data->queued_shaders_count = 0;
69  stl->g_data->render_timesteps = 1;
70 
71  /* Main Buffer */
73 
74  GPU_framebuffer_ensure_config(&fbl->main_fb,
75  {GPU_ATTACHMENT_TEXTURE(dtxl->depth),
76  GPU_ATTACHMENT_TEXTURE(txl->color),
77  GPU_ATTACHMENT_LEAVE,
78  GPU_ATTACHMENT_LEAVE,
79  GPU_ATTACHMENT_LEAVE,
80  GPU_ATTACHMENT_LEAVE});
81 
82  GPU_framebuffer_ensure_config(&fbl->main_color_fb,
83  {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->color)});
84 
85  /* `EEVEE_renderpasses_init` will set the active render passes used by `EEVEE_effects_init`.
86  * `EEVEE_effects_init` needs to go second for TAA. */
88  EEVEE_effects_init(sldata, vedata, camera, false);
89  EEVEE_materials_init(sldata, vedata, stl, fbl);
90  EEVEE_shadows_init(sldata);
91  EEVEE_lightprobes_init(sldata, vedata);
92 }
93 
94 static void eevee_cache_init(void *vedata)
95 {
97 
98  EEVEE_bloom_cache_init(sldata, vedata);
99  EEVEE_depth_of_field_cache_init(sldata, vedata);
100  EEVEE_effects_cache_init(sldata, vedata);
101  EEVEE_lightprobes_cache_init(sldata, vedata);
102  EEVEE_lights_cache_init(sldata, vedata);
103  EEVEE_materials_cache_init(sldata, vedata);
104  EEVEE_motion_blur_cache_init(sldata, vedata);
105  EEVEE_occlusion_cache_init(sldata, vedata);
106  EEVEE_screen_raytrace_cache_init(sldata, vedata);
107  EEVEE_subsurface_cache_init(sldata, vedata);
108  EEVEE_temporal_sampling_cache_init(sldata, vedata);
109  EEVEE_volumes_cache_init(sldata, vedata);
110 }
111 
112 void EEVEE_cache_populate(void *vedata, Object *ob)
113 {
115 
116  const DRWContextState *draw_ctx = DRW_context_state_get();
117  const int ob_visibility = DRW_object_visibility_in_active_context(ob);
118  bool cast_shadow = false;
119 
120  if (ob_visibility & OB_VISIBLE_PARTICLES) {
121  EEVEE_particle_hair_cache_populate(vedata, sldata, ob, &cast_shadow);
122  }
123 
124  if (DRW_object_is_renderable(ob) && (ob_visibility & OB_VISIBLE_SELF)) {
125  if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) {
126  EEVEE_materials_cache_populate(vedata, sldata, ob, &cast_shadow);
127  }
128  else if (ob->type == OB_HAIR) {
129  EEVEE_object_hair_cache_populate(vedata, sldata, ob, &cast_shadow);
130  }
131  else if (ob->type == OB_VOLUME) {
132  EEVEE_volumes_cache_object_add(sldata, vedata, draw_ctx->scene, ob);
133  }
134  else if (!USE_SCENE_LIGHT(draw_ctx->v3d)) {
135  /* do not add any scene light sources to the cache */
136  }
137  else if (ob->type == OB_LIGHTPROBE) {
138  if ((ob->base_flag & BASE_FROM_DUPLI) != 0) {
139  /* TODO: Special case for dupli objects because we cannot save the object pointer. */
140  }
141  else {
142  EEVEE_lightprobes_cache_add(sldata, vedata, ob);
143  }
144  }
145  else if (ob->type == OB_LAMP) {
146  EEVEE_lights_cache_add(sldata, ob);
147  }
148  }
149 
150  if (cast_shadow) {
151  EEVEE_shadows_caster_register(sldata, ob);
152  }
153 }
154 
155 static void eevee_cache_finish(void *vedata)
156 {
158  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
159  EEVEE_PrivateData *g_data = stl->g_data;
160  const DRWContextState *draw_ctx = DRW_context_state_get();
161  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
162 
163  EEVEE_volumes_cache_finish(sldata, vedata);
164  EEVEE_materials_cache_finish(sldata, vedata);
165  EEVEE_lights_cache_finish(sldata, vedata);
166  EEVEE_lightprobes_cache_finish(sldata, vedata);
167  EEVEE_renderpasses_cache_finish(sldata, vedata);
168 
169  EEVEE_subsurface_draw_init(sldata, vedata);
170  EEVEE_effects_draw_init(sldata, vedata);
171  EEVEE_volumes_draw_init(sldata, vedata);
172 
173  uint tot_samples = scene_eval->eevee.taa_render_samples;
174  if (tot_samples == 0) {
175  /* Use a high number of samples so the outputs accumulation buffers
176  * will have the highest possible precision. */
177  tot_samples = 1024;
178  }
179  EEVEE_renderpasses_output_init(sldata, vedata, tot_samples);
180 
181  /* Restart taa if a shader has finish compiling. */
182  /* HACK We should use notification of some sort from the compilation job instead. */
183  if (g_data->queued_shaders_count != g_data->queued_shaders_count_prev) {
186  }
187 }
188 
189 /* As renders in an HDR offscreen buffer, we need draw everything once
190  * during the background pass. This way the other drawing callback between
191  * the background and the scene pass are visible.
192  * Note: we could break it up in two passes using some depth test
193  * to reduce the fillrate */
194 static void eevee_draw_scene(void *vedata)
195 {
196  EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
197  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
198  EEVEE_FramebufferList *fbl = ((EEVEE_Data *)vedata)->fbl;
200 
201  /* Default framebuffer and texture */
204 
205  /* Sort transparents before the loop. */
207 
208  /* Number of iteration: Use viewport taa_samples when using viewport rendering */
209  int loop_len = 1;
211  const DRWContextState *draw_ctx = DRW_context_state_get();
212  const Scene *scene = draw_ctx->scene;
213  loop_len = MAX2(1, scene->eevee.taa_samples);
214  }
215 
216  if (stl->effects->bypass_drawing) {
217  loop_len = 0;
218  }
219 
220  while (loop_len--) {
221  const float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
222  float clear_depth = 1.0f;
223  uint clear_stencil = 0x0;
224  const uint primes[3] = {2, 3, 7};
225  double offset[3] = {0.0, 0.0, 0.0};
226  double r[3];
227 
228  bool taa_use_reprojection = (stl->effects->enabled_effects & EFFECT_TAA_REPROJECT) != 0;
229 
230  if (DRW_state_is_image_render() || taa_use_reprojection ||
231  ((stl->effects->enabled_effects & EFFECT_TAA) != 0)) {
232  int samp = taa_use_reprojection ? stl->effects->taa_reproject_sample + 1 :
234  BLI_halton_3d(primes, offset, samp, r);
235  EEVEE_update_noise(psl, fbl, r);
236  EEVEE_volumes_set_jitter(sldata, samp - 1);
237  EEVEE_materials_init(sldata, vedata, stl, fbl);
238  }
239  /* Copy previous persmat to UBO data */
241 
242  /* Refresh Probes
243  * Shadows needs to be updated for correct probes */
244  DRW_stats_group_start("Probes Refresh");
245  EEVEE_shadows_update(sldata, vedata);
246  EEVEE_lightprobes_refresh(sldata, vedata);
247  EEVEE_lightprobes_refresh_planar(sldata, vedata);
249 
250  /* Refresh shadows */
251  DRW_stats_group_start("Shadows");
252  EEVEE_shadows_draw(sldata, vedata, stl->effects->taa_view);
254 
255  if (((stl->effects->enabled_effects & EFFECT_TAA) != 0) &&
257  !taa_use_reprojection) {
259  }
260  /* when doing viewport rendering the overrides needs to be recalculated for
261  * every loop as this normally happens once inside
262  * `EEVEE_temporal_sampling_init` */
263  else if (((stl->effects->enabled_effects & EFFECT_TAA) != 0) &&
266  }
267 
268  /* Set ray type. */
270  sldata->common_data.ray_depth = 0.0f;
271  GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
272 
274  eGPUFrameBufferBits clear_bits = GPU_DEPTH_BIT;
277  GPU_framebuffer_clear(fbl->main_fb, clear_bits, clear_col, clear_depth, clear_stencil);
278 
279  /* Depth prepass */
280  DRW_stats_group_start("Prepass");
281  DRW_draw_pass(psl->depth_ps);
283 
284  /* Create minmax texture */
285  DRW_stats_group_start("Main MinMax buffer");
286  EEVEE_create_minmax_buffer(vedata, dtxl->depth, -1);
288 
289  EEVEE_occlusion_compute(sldata, vedata);
290  EEVEE_volumes_compute(sldata, vedata);
291 
292  /* Shading pass */
293  DRW_stats_group_start("Shading");
296  }
298  EEVEE_subsurface_data_render(sldata, vedata);
300 
301  /* Effects pre-transparency */
302  EEVEE_subsurface_compute(sldata, vedata);
303  EEVEE_reflection_compute(sldata, vedata);
304  EEVEE_occlusion_draw_debug(sldata, vedata);
305  if (psl->probe_display) {
307  }
308  EEVEE_refraction_compute(sldata, vedata);
309 
310  /* Opaque refraction */
311  DRW_stats_group_start("Opaque Refraction");
315 
316  /* Volumetrics Resolve Opaque */
317  EEVEE_volumes_resolve(sldata, vedata);
318 
319  /* Renderpasses */
320  EEVEE_renderpasses_output_accumulate(sldata, vedata, false);
321 
322  /* Transparent */
323  /* TODO(fclem): should be its own Frame-buffer.
324  * This is needed because dualsource blending only works with 1 color buffer. */
330 
331  /* Post Process */
332  DRW_stats_group_start("Post FX");
333  EEVEE_draw_effects(sldata, vedata);
335 
337 
340  /* SSR needs one iteration to start properly. */
341  loop_len++;
342  /* Reset sampling (and accumulation) after the first sample to avoid
343  * washed out first bounce for SSR. */
346  }
347  }
348 
349  if ((stl->g_data->render_passes & EEVEE_RENDER_PASS_COMBINED) != 0) {
350  /* Transfer result to default framebuffer. */
353  }
354  else {
355  EEVEE_renderpasses_draw(sldata, vedata);
356  }
357 
358  if (stl->effects->bypass_drawing) {
359  /* Restore the depth from sample 1. */
361  }
362 
364 
366 
367  stl->g_data->view_updated = false;
368 
370 }
371 
372 static void eevee_view_update(void *vedata)
373 {
374  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
375  if (stl->g_data) {
376  stl->g_data->view_updated = true;
377  }
378 }
379 
380 static void eevee_id_object_update(void *UNUSED(vedata), Object *object)
381 {
383  if (ped != NULL && ped->dd.recalc != 0) {
384  ped->need_update = (ped->dd.recalc & ID_RECALC_TRANSFORM) != 0;
385  ped->dd.recalc = 0;
386  }
388  if (led != NULL && led->dd.recalc != 0) {
389  led->need_update = true;
390  led->dd.recalc = 0;
391  }
393  if (oedata != NULL && oedata->dd.recalc != 0) {
394  oedata->need_update = true;
395  oedata->geom_update = (oedata->dd.recalc & (ID_RECALC_GEOMETRY)) != 0;
396  oedata->dd.recalc = 0;
397  }
398 }
399 
400 static void eevee_id_world_update(void *vedata, World *wo)
401 {
402  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
403  LightCache *lcache = stl->g_data->light_cache;
404 
405  if (ELEM(lcache, NULL, stl->lookdev_lightcache)) {
406  /* Avoid Lookdev viewport clearing the update flag (see T67741). */
407  return;
408  }
409 
411 
412  if (wedata != NULL && wedata->dd.recalc != 0) {
413  if ((lcache->flag & LIGHTCACHE_BAKING) == 0) {
414  lcache->flag |= LIGHTCACHE_UPDATE_WORLD;
415  }
416  wedata->dd.recalc = 0;
417  }
418 }
419 
420 void eevee_id_update(void *vedata, ID *id)
421 {
422  /* Handle updates based on ID type. */
423  switch (GS(id->name)) {
424  case ID_WO:
425  eevee_id_world_update(vedata, (World *)id);
426  break;
427  case ID_OB:
428  eevee_id_object_update(vedata, (Object *)id);
429  break;
430  default:
431  /* pass */
432  break;
433  }
434 }
435 
437 {
438  /* Reset passlist. This is safe as they are stored into managed memory chunks. */
439  memset(vedata->psl, 0, sizeof(*vedata->psl));
440 }
441 
442 static void eevee_render_to_image(void *vedata,
443  RenderEngine *engine,
444  struct RenderLayer *render_layer,
445  const rcti *rect)
446 {
447  EEVEE_Data *ved = (EEVEE_Data *)vedata;
448  const DRWContextState *draw_ctx = DRW_context_state_get();
449  Depsgraph *depsgraph = draw_ctx->depsgraph;
452  const bool do_motion_blur = (scene->eevee.flag & SCE_EEVEE_MOTION_BLUR_ENABLED) != 0;
453  const bool do_motion_blur_fx = do_motion_blur && (scene->eevee.motion_blur_max > 0);
454 
455  if (!EEVEE_render_init(vedata, engine, depsgraph)) {
456  return;
457  }
458  EEVEE_PrivateData *g_data = ved->stl->g_data;
459 
460  int initial_frame = CFRA;
461  float initial_subframe = SUBFRA;
462  float shuttertime = (do_motion_blur) ? scene->eevee.motion_blur_shutter : 0.0f;
463  int time_steps_tot = (do_motion_blur) ? max_ii(1, scene->eevee.motion_blur_steps) : 1;
464  g_data->render_timesteps = time_steps_tot;
465 
466  EEVEE_render_modules_init(vedata, engine, depsgraph);
467 
469  ved->stl);
470 
471  /* Compute start time. The motion blur will cover `[time ...time + shuttertime]`. */
472  float time = initial_frame + initial_subframe;
473  switch (scene->eevee.motion_blur_position) {
474  case SCE_EEVEE_MB_START:
475  /* No offset. */
476  break;
477  case SCE_EEVEE_MB_CENTER:
478  time -= shuttertime * 0.5f;
479  break;
480  case SCE_EEVEE_MB_END:
481  time -= shuttertime;
482  break;
483  default:
484  BLI_assert(!"Invalid motion blur position enum!");
485  break;
486  }
487 
488  float time_step = shuttertime / time_steps_tot;
489  for (int i = 0; i < time_steps_tot && !RE_engine_test_break(engine); i++) {
490  float time_prev = time;
491  float time_curr = time + time_step * 0.5f;
492  float time_next = time + time_step;
493  time += time_step;
494 
495  /* Previous motion step. */
496  if (do_motion_blur_fx) {
497  if (i == 0) {
499  DRW_render_set_time(engine, depsgraph, floorf(time_prev), fractf(time_prev));
500  EEVEE_render_modules_init(vedata, engine, depsgraph);
501  sldata = EEVEE_view_layer_data_ensure();
502 
503  EEVEE_render_cache_init(sldata, vedata);
504 
506 
508  EEVEE_materials_cache_finish(sldata, vedata);
510  }
511  }
512 
513  /* Next motion step. */
514  if (do_motion_blur_fx) {
516  DRW_render_set_time(engine, depsgraph, floorf(time_next), fractf(time_next));
517  EEVEE_render_modules_init(vedata, engine, depsgraph);
518  sldata = EEVEE_view_layer_data_ensure();
519 
520  EEVEE_render_cache_init(sldata, vedata);
521 
523 
525  EEVEE_materials_cache_finish(sldata, vedata);
527  }
528 
529  /* Current motion step. */
530  {
531  if (do_motion_blur) {
533  DRW_render_set_time(engine, depsgraph, floorf(time_curr), fractf(time_curr));
534  EEVEE_render_modules_init(vedata, engine, depsgraph);
535  sldata = EEVEE_view_layer_data_ensure();
536  }
537 
538  EEVEE_render_cache_init(sldata, vedata);
539 
541 
543  EEVEE_volumes_cache_finish(sldata, vedata);
544  EEVEE_materials_cache_finish(sldata, vedata);
545  EEVEE_lights_cache_finish(sldata, vedata);
546  EEVEE_lightprobes_cache_finish(sldata, vedata);
547  EEVEE_renderpasses_cache_finish(sldata, vedata);
548 
549  EEVEE_subsurface_draw_init(sldata, vedata);
550  EEVEE_effects_draw_init(sldata, vedata);
551  EEVEE_volumes_draw_init(sldata, vedata);
552  }
553 
554  /* Actual drawing. */
555  {
557  sldata, vedata, g_data->render_sample_count_per_timestep * time_steps_tot);
558 
559  if (scene->world) {
560  /* Update world in case of animated world material. */
562  }
563 
565  EEVEE_render_draw(vedata, engine, render_layer, rect);
566 
567  if (i < time_steps_tot - 1) {
568  /* Don't reset after the last loop. Since EEVEE_render_read_result
569  * might need some DRWPasses. */
571  }
572  }
573 
574  if (do_motion_blur_fx) {
575  /* The previous step of next iteration N is exactly the next step of this iteration N - 1.
576  * So we just swap the resources to avoid too much re-evaluation.
577  * Note that this also clears the VBO references from the GPUBatches of deformed
578  * geometries. */
580  }
581  }
582 
585 
586  if (RE_engine_test_break(engine)) {
587  return;
588  }
589 
590  EEVEE_render_read_result(vedata, engine, render_layer, rect);
591 
592  /* Restore original viewport size. */
593  DRW_render_viewport_size_set((int[2]){g_data->size_orig[0], g_data->size_orig[1]});
594 
595  if (CFRA != initial_frame || SUBFRA != initial_subframe) {
596  /* Restore original frame number. This is because the render pipeline expects it. */
597  RE_engine_frame_set(engine, initial_frame, initial_subframe);
598  }
599 }
600 
601 static void eevee_store_metadata(void *vedata, struct RenderResult *render_result)
602 {
603  EEVEE_Data *ved = (EEVEE_Data *)vedata;
604  EEVEE_PrivateData *g_data = ved->stl->g_data;
606  EEVEE_cryptomatte_store_metadata(ved, render_result);
608  }
609 }
610 
611 static void eevee_engine_free(void)
612 {
618 }
619 
621 
623  NULL,
624  NULL,
625  N_("Eevee"),
637 };
638 
640  NULL,
641  NULL,
642  EEVEE_ENGINE,
643  N_("Eevee"),
645  NULL,
647  NULL,
648  NULL,
649  NULL,
650  NULL,
653  {NULL, NULL, NULL},
654 };
655 
656 #undef EEVEE_ENGINE
General operations, lookup, etc. for blender objects.
@ OB_VISIBLE_SELF
Definition: BKE_object.h:125
@ OB_VISIBLE_PARTICLES
Definition: BKE_object.h:126
#define BLI_assert(a)
Definition: BLI_assert.h:58
MINLINE int max_ii(int a, int b)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:95
Random number functions.
void BLI_halton_3d(const unsigned int prime[3], double offset[3], int n, double *r)
Definition: rand.cc:323
unsigned int uint
Definition: BLI_sys_types.h:83
#define UNUSED(x)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define MAX2(a, b)
#define ELEM(...)
#define N_(msgid)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:599
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:611
@ ID_WO
Definition: DNA_ID_enums.h:71
@ ID_OB
Definition: DNA_ID_enums.h:59
@ EEVEE_RENDER_PASS_CRYPTOMATTE
@ EEVEE_RENDER_PASS_COMBINED
@ BASE_FROM_DUPLI
@ LIGHTCACHE_UPDATE_WORLD
@ LIGHTCACHE_BAKING
@ OB_MBALL
@ OB_SURF
@ OB_FONT
@ OB_LAMP
@ OB_MESH
@ OB_HAIR
@ OB_VOLUME
@ OB_CURVE
@ OB_LIGHTPROBE
#define SUBFRA
#define CFRA
@ SCE_EEVEE_MB_END
@ SCE_EEVEE_MB_START
@ SCE_EEVEE_MB_CENTER
@ SCE_EEVEE_MOTION_BLUR_ENABLED
#define RV3D_CAMOB
@ DRW_TEX_FILTER
Definition: DRW_render.h:139
#define DRW_VIEWPORT_DATA_SIZE(ty)
Definition: DRW_render.h:97
eGPUFrameBufferBits
@ GPU_DEPTH_BIT
@ GPU_STENCIL_BIT
@ GPU_COLOR_BIT
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, struct GPUTexture *tex)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
@ GPU_RGBA16F
Definition: GPU_texture.h:94
void GPU_uniformbuf_update(GPUUniformBuf *ubo, const void *data)
#define RE_USE_STEREO_VIEWPORT
Definition: RE_engine.h:65
#define RE_INTERNAL
Definition: RE_engine.h:57
#define RE_USE_GPU_CONTEXT
Definition: RE_engine.h:66
#define RE_USE_PREVIEW
Definition: RE_engine.h:59
double time
Scene scene
const Depsgraph * depsgraph
void DRW_transform_none(GPUTexture *tex)
void DRW_render_viewport_size_set(const int size[2])
Definition: draw_manager.c:431
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
Definition: draw_manager.c:697
bool DRW_object_is_renderable(const Object *ob)
Definition: draw_manager.c:183
int DRW_object_visibility_in_active_context(const Object *ob)
Definition: draw_manager.c:235
const DRWContextState * DRW_context_state_get(void)
void DRW_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph)
bool DRW_state_draw_background(void)
void DRW_cache_restart(void)
void DRW_render_set_time(RenderEngine *engine, Depsgraph *depsgraph, int frame, float subframe)
bool DRW_state_is_image_render(void)
DefaultTextureList * DRW_viewport_texture_list_get(void)
Definition: draw_manager.c:702
void DRW_render_object_iter(void *vedata, RenderEngine *engine, struct Depsgraph *depsgraph, void(*callback)(void *vedata, Object *ob, RenderEngine *engine, struct Depsgraph *depsgraph))
void DRW_pass_sort_shgroup_z(DRWPass *pass)
void DRW_view_set_active(DRWView *view)
void DRW_draw_pass(DRWPass *pass)
void DRW_stats_group_start(const char *name)
void DRW_stats_group_end(void)
void DRW_texture_ensure_fullscreen_2d(GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags)
void EEVEE_bloom_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
Definition: eevee_bloom.c:165
void EEVEE_cryptomatte_store_metadata(EEVEE_Data *vedata, RenderResult *render_result)
void EEVEE_cryptomatte_free(EEVEE_Data *vedata)
EEVEE_LightProbeEngineData * EEVEE_lightprobe_data_get(Object *ob)
Definition: eevee_data.c:325
EEVEE_LightEngineData * EEVEE_light_data_get(Object *ob)
Definition: eevee_data.c:351
EEVEE_ViewLayerData * EEVEE_view_layer_data_ensure(void)
Definition: eevee_data.c:276
EEVEE_WorldEngineData * EEVEE_world_data_ensure(World *wo)
Definition: eevee_data.c:382
EEVEE_ObjectEngineData * EEVEE_object_data_get(Object *ob)
Definition: eevee_data.c:299
void EEVEE_motion_blur_data_free(EEVEE_MotionBlurData *mb)
Definition: eevee_data.c:112
void EEVEE_depth_of_field_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
void EEVEE_create_minmax_buffer(EEVEE_Data *vedata, GPUTexture *depth_src, int layer)
void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_draw_effects(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_effects_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Object *camera, const bool minimal)
Definition: eevee_effects.c:71
void EEVEE_effects_draw_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
static void eevee_render_to_image(void *vedata, RenderEngine *engine, struct RenderLayer *render_layer, const rcti *rect)
Definition: eevee_engine.c:442
static void eevee_engine_free(void)
Definition: eevee_engine.c:611
static void eevee_cache_init(void *vedata)
Definition: eevee_engine.c:94
void EEVEE_cache_populate(void *vedata, Object *ob)
Definition: eevee_engine.c:112
static void eevee_view_update(void *vedata)
Definition: eevee_engine.c:372
void eevee_id_update(void *vedata, ID *id)
Definition: eevee_engine.c:420
#define EEVEE_ENGINE
Definition: eevee_engine.c:41
static const DrawEngineDataSize eevee_data_size
Definition: eevee_engine.c:620
static void eevee_cache_finish(void *vedata)
Definition: eevee_engine.c:155
static void eevee_engine_init(void *ved)
Definition: eevee_engine.c:45
static void eevee_id_object_update(void *UNUSED(vedata), Object *object)
Definition: eevee_engine.c:380
static void eevee_draw_scene(void *vedata)
Definition: eevee_engine.c:194
static void eevee_render_reset_passes(EEVEE_Data *vedata)
Definition: eevee_engine.c:436
static void eevee_store_metadata(void *vedata, struct RenderResult *render_result)
Definition: eevee_engine.c:601
RenderEngineType DRW_engine_viewport_eevee_type
Definition: eevee_engine.c:639
static void eevee_id_world_update(void *vedata, World *wo)
Definition: eevee_engine.c:400
DrawEngineType draw_engine_eevee_type
Definition: eevee_engine.c:622
void EEVEE_lightprobes_free(void)
void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_lightprobes_cache_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Object *ob)
void EEVEE_lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
Definition: eevee_lights.c:246
void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob)
Definition: eevee_lights.c:216
void EEVEE_lights_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
Definition: eevee_lights.c:208
void EEVEE_update_noise(EEVEE_PassList *psl, EEVEE_FramebufferList *fbl, const double offsets[3])
void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_object_hair_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sldata, Object *ob, bool *cast_shadow)
void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sldata, Object *ob, bool *cast_shadow)
void EEVEE_materials_cache_finish(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
void EEVEE_materials_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, EEVEE_StorageList *stl, EEVEE_FramebufferList *fbl)
void EEVEE_materials_free(void)
void EEVEE_particle_hair_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sldata, Object *ob, bool *cast_shadow)
void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata)
void EEVEE_motion_blur_swap_data(EEVEE_Data *vedata)
void EEVEE_motion_blur_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
void EEVEE_motion_blur_step_set(EEVEE_Data *vedata, int step)
void EEVEE_occlusion_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_occlusion_draw_debug(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
void EEVEE_occlusion_free(void)
void EEVEE_occlusion_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_volumes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_refraction_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_shadows_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_renderpasses_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, bool post_effect)
void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample)
Definition: eevee_volumes.c:90
void EEVEE_shaders_free(void)
void EEVEE_subsurface_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_screen_raytrace_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
#define LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d)
void EEVEE_volumes_resolve(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_render_modules_init(EEVEE_Data *vedata, struct RenderEngine *engine, struct Depsgraph *depsgraph)
Definition: eevee_render.c:135
void EEVEE_render_read_result(EEVEE_Data *vedata, struct RenderEngine *engine, struct RenderLayer *rl, const rcti *rect)
Definition: eevee_render.c:671
void EEVEE_reflection_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct Scene *scene, Object *ob)
void EEVEE_volumes_free(void)
void EEVEE_temporal_sampling_reset(EEVEE_Data *vedata)
void EEVEE_volumes_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_render_cache(void *vedata, struct Object *ob, struct RenderEngine *engine, struct Depsgraph *depsgraph)
Definition: eevee_render.c:198
void EEVEE_renderpasses_init(EEVEE_Data *vedata)
void EEVEE_render_update_passes(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer)
Definition: eevee_render.c:695
void EEVEE_volumes_free_smoke_textures(void)
void EEVEE_subsurface_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_renderpasses_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_renderpasses_draw_debug(EEVEE_Data *vedata)
void EEVEE_render_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
Definition: eevee_render.c:179
int EEVEE_temporal_sampling_sample_count_get(const Scene *scene, const EEVEE_StorageList *stl)
void EEVEE_renderpasses_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, uint tot_samples)
#define MB_PREV
void EEVEE_render_draw(EEVEE_Data *vedata, struct RenderEngine *engine, struct RenderLayer *rl, const struct rcti *rect)
#define EEVEE_RAY_CAMERA
void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, struct Object *ob)
void EEVEE_renderpasses_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_shadows_init(EEVEE_ViewLayerData *sldata)
Definition: eevee_shadows.c:41
@ EFFECT_TAA_REPROJECT
@ EFFECT_SSS
@ EFFECT_SSR
@ EFFECT_TAA
void EEVEE_temporal_sampling_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
#define MB_NEXT
void EEVEE_shadows_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, struct DRWView *view)
void EEVEE_temporal_sampling_create_view(EEVEE_Data *vedata)
void EEVEE_temporal_sampling_update_matrices(EEVEE_Data *vedata)
#define MB_CURR
#define USE_SCENE_LIGHT(v3d)
void EEVEE_subsurface_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
bool EEVEE_render_init(EEVEE_Data *vedata, struct RenderEngine *engine, struct Depsgraph *depsgraph)
Definition: eevee_render.c:50
void EEVEE_subsurface_data_render(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_volumes_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
Definition: engine.c:711
bool RE_engine_test_break(RenderEngine *engine)
Definition: engine.c:435
void GPU_framebuffer_clear(GPUFrameBuffer *gpu_fb, eGPUFrameBufferBits buffers, const float clear_col[4], float clear_depth, uint clear_stencil)
void GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slot, int mip)
void GPU_framebuffer_blit(GPUFrameBuffer *gpufb_read, int read_slot, GPUFrameBuffer *gpufb_write, int write_slot, eGPUFrameBufferBits blit_buffers)
#define GS(x)
Definition: iris.c:241
#define floorf(x)
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
MINLINE float fractf(float a)
struct Scene * scene
Definition: DRW_render.h:745
struct Depsgraph * depsgraph
Definition: DRW_render.h:753
struct View3D * v3d
Definition: DRW_render.h:742
struct RegionView3D * rv3d
Definition: DRW_render.h:741
struct GPUFrameBuffer * default_fb
struct GPUTexture * depth
int recalc
Definition: DNA_ID.h:55
EEVEE_TextureList * txl
EEVEE_StorageList * stl
EEVEE_PassList * psl
EEVEE_FramebufferList * fbl
struct GPUTexture * final_tx
bool ssr_was_valid_double_buffer
EEVEE_EffectsFlag enabled_effects
float prev_persmat[4][4]
struct DRWView * taa_view
struct EEVEE_MotionBlurData motion_blur
struct GPUFrameBuffer * main_fb
struct GPUFrameBuffer * double_buffer_depth_fb
struct GPUFrameBuffer * main_color_fb
struct DRWPass * transparent_pass
struct DRWPass * depth_refract_ps
struct DRWPass * depth_ps
struct DRWPass * material_refract_ps
struct DRWPass * material_ps
struct DRWPass * probe_display
struct DRWPass * background_ps
eViewLayerEEVEEPassType render_passes
struct LightCache * light_cache
int render_sample_count_per_timestep
struct EEVEE_PrivateData * g_data
struct EEVEE_EffectsInfo * effects
struct LightCache * lookdev_lightcache
struct GPUTexture * color_double_buffer
struct GPUTexture * taa_history
struct GPUTexture * color
struct EEVEE_CommonUniformBuffer common_data
struct GPUUniformBuf * common_ubo
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
short base_flag
float motion_blur_shutter
int motion_blur_position
struct World * world
struct SceneEEVEE eevee
struct Object * camera