Blender  V3.3
eevee_engine.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2016 Blender Foundation. */
3 
8 #include "DRW_render.h"
9 
10 #include "draw_color_management.h" /* TODO: remove dependency. */
11 
12 #include "BLI_rand.h"
13 
14 #include "BKE_object.h"
15 
16 #include "DEG_depsgraph_query.h"
17 
18 #include "DNA_world_types.h"
19 
20 #include "IMB_imbuf.h"
21 
22 #include "eevee_private.h"
23 
24 #include "eevee_engine.h" /* own include */
25 
26 #define EEVEE_ENGINE "BLENDER_EEVEE"
27 
28 /* *********** FUNCTIONS *********** */
29 
30 static void eevee_engine_init(void *ved)
31 {
32  EEVEE_Data *vedata = (EEVEE_Data *)ved;
33  EEVEE_TextureList *txl = vedata->txl;
34  EEVEE_FramebufferList *fbl = vedata->fbl;
35  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
38 
39  const DRWContextState *draw_ctx = DRW_context_state_get();
40  View3D *v3d = draw_ctx->v3d;
41  RegionView3D *rv3d = draw_ctx->rv3d;
42  Object *camera = (rv3d->persp == RV3D_CAMOB) ? v3d->camera : NULL;
43 
44  if (!stl->g_data) {
45  /* Alloc transient pointers */
46  stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__);
47  }
50  stl->g_data->background_alpha = DRW_state_draw_background() ? 1.0f : 0.0f;
52  stl->g_data->valid_taa_history = (txl->taa_history != NULL);
53  stl->g_data->queued_shaders_count = 0;
54  stl->g_data->render_timesteps = 1;
55  stl->g_data->disable_ligthprobes = v3d &&
57 
58  /* Main Buffer */
60 
61  GPU_framebuffer_ensure_config(&fbl->main_fb,
62  {GPU_ATTACHMENT_TEXTURE(dtxl->depth),
63  GPU_ATTACHMENT_TEXTURE(txl->color),
64  GPU_ATTACHMENT_LEAVE,
65  GPU_ATTACHMENT_LEAVE,
66  GPU_ATTACHMENT_LEAVE,
67  GPU_ATTACHMENT_LEAVE});
68 
69  GPU_framebuffer_ensure_config(&fbl->main_color_fb,
70  {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->color)});
71 
72  /* `EEVEE_renderpasses_init` will set the active render passes used by `EEVEE_effects_init`.
73  * `EEVEE_effects_init` needs to go second for TAA. */
75  EEVEE_effects_init(sldata, vedata, camera, false);
76  EEVEE_materials_init(sldata, vedata, stl, fbl);
77  EEVEE_shadows_init(sldata);
78  EEVEE_lightprobes_init(sldata, vedata);
79 }
80 
81 static void eevee_cache_init(void *vedata)
82 {
84 
85  EEVEE_bloom_cache_init(sldata, vedata);
86  EEVEE_depth_of_field_cache_init(sldata, vedata);
87  EEVEE_effects_cache_init(sldata, vedata);
88  EEVEE_lightprobes_cache_init(sldata, vedata);
89  EEVEE_lights_cache_init(sldata, vedata);
90  EEVEE_materials_cache_init(sldata, vedata);
91  EEVEE_motion_blur_cache_init(sldata, vedata);
92  EEVEE_occlusion_cache_init(sldata, vedata);
93  EEVEE_screen_raytrace_cache_init(sldata, vedata);
94  EEVEE_subsurface_cache_init(sldata, vedata);
95  EEVEE_temporal_sampling_cache_init(sldata, vedata);
96  EEVEE_volumes_cache_init(sldata, vedata);
97 }
98 
99 void EEVEE_cache_populate(void *vedata, Object *ob)
100 {
102 
103  const DRWContextState *draw_ctx = DRW_context_state_get();
104  const int ob_visibility = DRW_object_visibility_in_active_context(ob);
105  bool cast_shadow = false;
106 
107  if (ob_visibility & OB_VISIBLE_PARTICLES) {
108  EEVEE_particle_hair_cache_populate(vedata, sldata, ob, &cast_shadow);
109  }
110 
111  if (DRW_object_is_renderable(ob) && (ob_visibility & OB_VISIBLE_SELF)) {
112  if (ELEM(ob->type, OB_MESH, OB_SURF, OB_MBALL)) {
113  EEVEE_materials_cache_populate(vedata, sldata, ob, &cast_shadow);
114  }
115  else if (ob->type == OB_CURVES) {
116  EEVEE_object_curves_cache_populate(vedata, sldata, ob, &cast_shadow);
117  }
118  else if (ob->type == OB_VOLUME) {
119  EEVEE_volumes_cache_object_add(sldata, vedata, draw_ctx->scene, ob);
120  }
121  else if (!USE_SCENE_LIGHT(draw_ctx->v3d)) {
122  /* do not add any scene light sources to the cache */
123  }
124  else if (ob->type == OB_LIGHTPROBE) {
125  if ((ob->base_flag & BASE_FROM_DUPLI) != 0) {
126  /* TODO: Special case for dupli objects because we cannot save the object pointer. */
127  }
128  else {
129  EEVEE_lightprobes_cache_add(sldata, vedata, ob);
130  }
131  }
132  else if (ob->type == OB_LAMP) {
133  EEVEE_lights_cache_add(sldata, ob);
134  }
135  }
136 
137  if (cast_shadow) {
138  EEVEE_shadows_caster_register(sldata, ob);
139  }
140 }
141 
142 static void eevee_cache_finish(void *vedata)
143 {
144  EEVEE_Data *ved = (EEVEE_Data *)vedata;
146  EEVEE_StorageList *stl = ved->stl;
148  const DRWContextState *draw_ctx = DRW_context_state_get();
149  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
150 
151  EEVEE_volumes_cache_finish(sldata, vedata);
152  EEVEE_materials_cache_finish(sldata, vedata);
153  EEVEE_lights_cache_finish(sldata, vedata);
154  EEVEE_lightprobes_cache_finish(sldata, vedata);
155  EEVEE_renderpasses_cache_finish(sldata, vedata);
156 
157  EEVEE_subsurface_draw_init(sldata, vedata);
158  EEVEE_effects_draw_init(sldata, vedata);
159  EEVEE_volumes_draw_init(sldata, vedata);
160 
161  uint tot_samples = scene_eval->eevee.taa_render_samples;
162  if (tot_samples == 0) {
163  /* Use a high number of samples so the outputs accumulation buffers
164  * will have the highest possible precision. */
165  tot_samples = 1024;
166  }
167  EEVEE_renderpasses_output_init(sldata, vedata, tot_samples);
168 
169  /* Restart TAA if a shader has finish compiling. */
170  /* HACK: We should use notification of some sort from the compilation job instead. */
171  if (g_data->queued_shaders_count != g_data->queued_shaders_count_prev) {
172  g_data->queued_shaders_count_prev = g_data->queued_shaders_count;
174  }
175 
176  if (g_data->queued_shaders_count > 0) {
177  SNPRINTF(ved->info, "Compiling Shaders %d", g_data->queued_shaders_count);
178  }
179 }
180 
181 /* As renders in an HDR off-screen buffer, we need draw everything once
182  * during the background pass. This way the other drawing callback between
183  * the background and the scene pass are visible.
184  * NOTE: we could break it up in two passes using some depth test
185  * to reduce the fill-rate. */
186 static void eevee_draw_scene(void *vedata)
187 {
188  EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
189  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
190  EEVEE_FramebufferList *fbl = ((EEVEE_Data *)vedata)->fbl;
192 
193  /* Default framebuffer and texture */
196 
197  /* Sort transparents before the loop. */
199 
200  /* Number of iteration: Use viewport taa_samples when using viewport rendering */
201  int loop_len = 1;
203  const DRWContextState *draw_ctx = DRW_context_state_get();
204  const Scene *scene = draw_ctx->scene;
205  loop_len = MAX2(1, scene->eevee.taa_samples);
206  }
207 
208  if (stl->effects->bypass_drawing) {
209  loop_len = 0;
210  }
211 
212  while (loop_len--) {
213  const float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
214  float clear_depth = 1.0f;
215  uint clear_stencil = 0x0;
216  const uint primes[3] = {2, 3, 7};
217  double offset[3] = {0.0, 0.0, 0.0};
218  double r[3];
219 
220  bool taa_use_reprojection = (stl->effects->enabled_effects & EFFECT_TAA_REPROJECT) != 0;
221 
222  if (DRW_state_is_image_render() || taa_use_reprojection ||
223  ((stl->effects->enabled_effects & EFFECT_TAA) != 0)) {
224  int samp = taa_use_reprojection ? stl->effects->taa_reproject_sample + 1 :
226  BLI_halton_3d(primes, offset, samp, r);
227  EEVEE_update_noise(psl, fbl, r);
228  EEVEE_volumes_set_jitter(sldata, samp - 1);
229  EEVEE_materials_init(sldata, vedata, stl, fbl);
230  }
231  /* Copy previous persmat to UBO data */
233 
234  /* Refresh Probes
235  * Shadows needs to be updated for correct probes */
236  DRW_stats_group_start("Probes Refresh");
237  EEVEE_shadows_update(sldata, vedata);
238  EEVEE_lightprobes_refresh(sldata, vedata);
239  EEVEE_lightprobes_refresh_planar(sldata, vedata);
241 
242  /* Refresh shadows */
243  DRW_stats_group_start("Shadows");
244  EEVEE_shadows_draw(sldata, vedata, stl->effects->taa_view);
246 
247  if (((stl->effects->enabled_effects & EFFECT_TAA) != 0) &&
249  !taa_use_reprojection) {
251  }
252  /* when doing viewport rendering the overrides needs to be recalculated for
253  * every loop as this normally happens once inside
254  * `EEVEE_temporal_sampling_init` */
255  else if (((stl->effects->enabled_effects & EFFECT_TAA) != 0) &&
258  }
259 
260  /* Set ray type. */
262  sldata->common_data.ray_depth = 0.0f;
263  if (stl->g_data->disable_ligthprobes) {
264  sldata->common_data.prb_num_render_cube = 1;
265  sldata->common_data.prb_num_render_grid = 1;
266  }
267  GPU_uniformbuf_update(sldata->common_ubo, &sldata->common_data);
268 
270  eGPUFrameBufferBits clear_bits = GPU_DEPTH_BIT;
273  GPU_framebuffer_clear(fbl->main_fb, clear_bits, clear_col, clear_depth, clear_stencil);
274 
275  /* Depth prepass */
276  DRW_stats_group_start("Prepass");
277  DRW_draw_pass(psl->depth_ps);
279 
280  /* Create minmax texture */
281  DRW_stats_group_start("Main MinMax buffer");
282  EEVEE_create_minmax_buffer(vedata, dtxl->depth, -1);
284 
285  EEVEE_occlusion_compute(sldata, vedata);
286  EEVEE_volumes_compute(sldata, vedata);
287 
288  /* Shading pass */
289  DRW_stats_group_start("Shading");
292  }
294  EEVEE_subsurface_data_render(sldata, vedata);
296 
297  /* Effects pre-transparency */
298  EEVEE_subsurface_compute(sldata, vedata);
299  EEVEE_reflection_compute(sldata, vedata);
300  EEVEE_occlusion_draw_debug(sldata, vedata);
301  if (psl->probe_display) {
303  }
304  EEVEE_refraction_compute(sldata, vedata);
305 
306  /* Opaque refraction */
307  DRW_stats_group_start("Opaque Refraction");
311 
312  /* Volumetrics Resolve Opaque */
313  EEVEE_volumes_resolve(sldata, vedata);
314 
315  /* Render-passes. */
316  EEVEE_renderpasses_output_accumulate(sldata, vedata, false);
317 
318  /* Transparent */
319  /* TODO(@fclem): should be its own Frame-buffer.
320  * This is needed because dual-source blending only works with 1 color buffer. */
326 
327  /* Post Process */
328  DRW_stats_group_start("Post FX");
329  EEVEE_draw_effects(sldata, vedata);
331 
333 
336  /* SSR needs one iteration to start properly. */
337  loop_len++;
338  /* Reset sampling (and accumulation) after the first sample to avoid
339  * washed out first bounce for SSR. */
342  }
343  }
344 
345  if ((stl->g_data->render_passes & EEVEE_RENDER_PASS_COMBINED) != 0) {
346  /* Transfer result to default framebuffer. */
349  }
350  else {
351  EEVEE_renderpasses_draw(sldata, vedata);
352  }
353 
354  if (stl->effects->bypass_drawing) {
355  /* Restore the depth from sample 1. */
357  }
358 
360 
361  stl->g_data->view_updated = false;
362 
364 }
365 
366 static void eevee_view_update(void *vedata)
367 {
368  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
369  if (stl->g_data) {
370  stl->g_data->view_updated = true;
371  }
372 }
373 
374 static void eevee_id_object_update(void *UNUSED(vedata), Object *object)
375 {
377  if (ped != NULL && ped->dd.recalc != 0) {
378  ped->need_update = (ped->dd.recalc & ID_RECALC_TRANSFORM) != 0;
379  ped->dd.recalc = 0;
380  }
382  if (led != NULL && led->dd.recalc != 0) {
383  led->need_update = true;
384  led->dd.recalc = 0;
385  }
387  if (oedata != NULL && oedata->dd.recalc != 0) {
388  oedata->need_update = true;
389  oedata->geom_update = (oedata->dd.recalc & (ID_RECALC_GEOMETRY)) != 0;
390  oedata->dd.recalc = 0;
391  }
392 }
393 
394 static void eevee_id_world_update(void *vedata, World *wo)
395 {
396  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
397  LightCache *lcache = stl->g_data->light_cache;
398 
399  if (ELEM(lcache, NULL, stl->lookdev_lightcache)) {
400  /* Avoid Lookdev viewport clearing the update flag (see T67741). */
401  return;
402  }
403 
405 
406  if (wedata != NULL && wedata->dd.recalc != 0) {
407  if ((lcache->flag & LIGHTCACHE_BAKING) == 0) {
408  lcache->flag |= LIGHTCACHE_UPDATE_WORLD;
409  }
410  wedata->dd.recalc = 0;
411  }
412 }
413 
414 void eevee_id_update(void *vedata, ID *id)
415 {
416  /* Handle updates based on ID type. */
417  switch (GS(id->name)) {
418  case ID_WO:
419  eevee_id_world_update(vedata, (World *)id);
420  break;
421  case ID_OB:
422  eevee_id_object_update(vedata, (Object *)id);
423  break;
424  default:
425  /* pass */
426  break;
427  }
428 }
429 
431 {
432  /* Reset passlist. This is safe as they are stored into managed memory chunks. */
433  memset(vedata->psl, 0, sizeof(*vedata->psl));
434 }
435 
436 static void eevee_render_to_image(void *vedata,
437  RenderEngine *engine,
438  struct RenderLayer *render_layer,
439  const rcti *rect)
440 {
441  EEVEE_Data *ved = (EEVEE_Data *)vedata;
442  const DRWContextState *draw_ctx = DRW_context_state_get();
443  Depsgraph *depsgraph = draw_ctx->depsgraph;
446  const bool do_motion_blur = (scene->eevee.flag & SCE_EEVEE_MOTION_BLUR_ENABLED) != 0;
447  const bool do_motion_blur_fx = do_motion_blur && (scene->eevee.motion_blur_max > 0);
448 
449  if (!EEVEE_render_init(vedata, engine, depsgraph)) {
450  return;
451  }
453 
454  int initial_frame = scene->r.cfra;
455  float initial_subframe = scene->r.subframe;
456  float shuttertime = (do_motion_blur) ? scene->eevee.motion_blur_shutter : 0.0f;
457  int time_steps_tot = (do_motion_blur) ? max_ii(1, scene->eevee.motion_blur_steps) : 1;
458  g_data->render_timesteps = time_steps_tot;
459 
460  EEVEE_render_modules_init(vedata, engine, depsgraph);
461 
462  g_data->render_sample_count_per_timestep = EEVEE_temporal_sampling_sample_count_get(scene,
463  ved->stl);
464 
465  /* Reset in case the same engine is used on multiple views. */
467 
468  /* Compute start time. The motion blur will cover `[time ...time + shuttertime]`. */
469  float time = initial_frame + initial_subframe;
470  switch (scene->eevee.motion_blur_position) {
471  case SCE_EEVEE_MB_START:
472  /* No offset. */
473  break;
474  case SCE_EEVEE_MB_CENTER:
475  time -= shuttertime * 0.5f;
476  break;
477  case SCE_EEVEE_MB_END:
478  time -= shuttertime;
479  break;
480  default:
481  BLI_assert_msg(0, "Invalid motion blur position enum!");
482  break;
483  }
484 
485  float time_step = shuttertime / time_steps_tot;
486  for (int i = 0; i < time_steps_tot && !RE_engine_test_break(engine); i++) {
487  float time_prev = time;
488  float time_curr = time + time_step * 0.5f;
489  float time_next = time + time_step;
490  time += time_step;
491 
492  /* Previous motion step. */
493  if (do_motion_blur_fx) {
494  if (i == 0) {
496  DRW_render_set_time(engine, depsgraph, floorf(time_prev), fractf(time_prev));
497  EEVEE_render_modules_init(vedata, engine, depsgraph);
498  sldata = EEVEE_view_layer_data_ensure();
499 
500  EEVEE_render_cache_init(sldata, vedata);
501 
503 
505  EEVEE_materials_cache_finish(sldata, vedata);
507  }
508  }
509 
510  /* Next motion step. */
511  if (do_motion_blur_fx) {
513  DRW_render_set_time(engine, depsgraph, floorf(time_next), fractf(time_next));
514  EEVEE_render_modules_init(vedata, engine, depsgraph);
515  sldata = EEVEE_view_layer_data_ensure();
516 
517  EEVEE_render_cache_init(sldata, vedata);
518 
520 
522  EEVEE_materials_cache_finish(sldata, vedata);
524  }
525 
526  /* Current motion step. */
527  {
528  if (do_motion_blur) {
530  DRW_render_set_time(engine, depsgraph, floorf(time_curr), fractf(time_curr));
531  EEVEE_render_modules_init(vedata, engine, depsgraph);
532  sldata = EEVEE_view_layer_data_ensure();
533  }
534 
535  EEVEE_render_cache_init(sldata, vedata);
536 
538 
540  EEVEE_volumes_cache_finish(sldata, vedata);
541  EEVEE_materials_cache_finish(sldata, vedata);
542  EEVEE_lights_cache_finish(sldata, vedata);
543  EEVEE_lightprobes_cache_finish(sldata, vedata);
544  EEVEE_renderpasses_cache_finish(sldata, vedata);
545 
546  EEVEE_subsurface_draw_init(sldata, vedata);
547  EEVEE_effects_draw_init(sldata, vedata);
548  EEVEE_volumes_draw_init(sldata, vedata);
549  }
550 
551  /* Actual drawing. */
552  {
554  sldata, vedata, g_data->render_sample_count_per_timestep * time_steps_tot);
555 
556  if (scene->world) {
557  /* Update world in case of animated world material. */
559  }
560 
562  EEVEE_render_draw(vedata, engine, render_layer, rect);
563 
564  if (i < time_steps_tot - 1) {
565  /* Don't reset after the last loop. Since EEVEE_render_read_result
566  * might need some DRWPasses. */
568  }
569  }
570 
571  if (do_motion_blur_fx) {
572  /* The previous step of next iteration N is exactly the next step of this iteration N - 1.
573  * So we just swap the resources to avoid too much re-evaluation.
574  * Note that this also clears the VBO references from the GPUBatches of deformed
575  * geometries. */
577  }
578  }
579 
581 
582  if (RE_engine_test_break(engine)) {
583  return;
584  }
585 
586  EEVEE_render_read_result(vedata, engine, render_layer, rect);
587 
588  /* Restore original viewport size. */
589  DRW_render_viewport_size_set((int[2]){g_data->size_orig[0], g_data->size_orig[1]});
590 
591  if (scene->r.cfra != initial_frame || scene->r.subframe != initial_subframe) {
592  /* Restore original frame number. This is because the render pipeline expects it. */
593  RE_engine_frame_set(engine, initial_frame, initial_subframe);
594  }
595 }
596 
597 static void eevee_store_metadata(void *vedata, struct RenderResult *render_result)
598 {
599  EEVEE_Data *ved = (EEVEE_Data *)vedata;
601  if (g_data->render_passes & EEVEE_RENDER_PASS_CRYPTOMATTE) {
602  EEVEE_cryptomatte_store_metadata(ved, render_result);
604  }
605 }
606 
607 static void eevee_engine_free(void)
608 {
614 }
615 
617 
619  NULL,
620  NULL,
621  N_("Eevee"),
625  NULL, /* instance_free */
634 };
635 
637  NULL,
638  NULL,
639  EEVEE_ENGINE,
640  N_("Eevee"),
642  NULL,
644  NULL,
645  NULL,
646  NULL,
647  NULL,
648  NULL,
649  NULL,
652  {NULL, NULL, NULL},
653 };
654 
655 #undef EEVEE_ENGINE
General operations, lookup, etc. for blender objects.
@ OB_VISIBLE_SELF
Definition: BKE_object.h:150
@ OB_VISIBLE_PARTICLES
Definition: BKE_object.h:151
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
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:77
Random number functions.
void BLI_halton_3d(const unsigned int prime[3], double offset[3], int n, double *r)
Definition: rand.cc:311
#define SNPRINTF(dst, format,...)
Definition: BLI_string.h:485
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNUSED(x)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define MAX2(a, b)
#define ELEM(...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:771
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ ID_WO
Definition: DNA_ID_enums.h:59
@ ID_OB
Definition: DNA_ID_enums.h:47
@ EEVEE_RENDER_PASS_CRYPTOMATTE
@ EEVEE_RENDER_PASS_COMBINED
@ BASE_FROM_DUPLI
@ LIGHTCACHE_UPDATE_WORLD
@ LIGHTCACHE_BAKING
@ OB_MBALL
@ OB_SURF
@ OB_LAMP
@ OB_MESH
@ OB_VOLUME
@ OB_CURVES
@ OB_LIGHTPROBE
@ 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:140
#define DRW_VIEWPORT_DATA_SIZE(ty)
Definition: DRW_render.h:96
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
void GPU_uniformbuf_update(GPUUniformBuf *ubo, const void *data)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
#define RE_USE_STEREO_VIEWPORT
Definition: RE_engine.h:51
#define RE_INTERNAL
Definition: RE_engine.h:43
#define RE_USE_GPU_CONTEXT
Definition: RE_engine.h:52
#define RE_USE_PREVIEW
Definition: RE_engine.h:45
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:280
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
Definition: draw_manager.c:633
bool DRW_object_is_renderable(const Object *ob)
Definition: draw_manager.c:180
int DRW_object_visibility_in_active_context(const Object *ob)
Definition: draw_manager.c:209
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:638
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_draw_pass(DRWPass *pass)
void DRW_view_set_active(const DRWView *view)
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)
static struct @318 g_data
void EEVEE_bloom_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
Definition: eevee_bloom.c:151
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:308
EEVEE_LightEngineData * EEVEE_light_data_get(Object *ob)
Definition: eevee_data.c:334
EEVEE_ViewLayerData * EEVEE_view_layer_data_ensure(void)
Definition: eevee_data.c:259
EEVEE_WorldEngineData * EEVEE_world_data_ensure(World *wo)
Definition: eevee_data.c:365
EEVEE_ObjectEngineData * EEVEE_object_data_get(Object *ob)
Definition: eevee_data.c:282
void EEVEE_motion_blur_data_free(EEVEE_MotionBlurData *mb)
Definition: eevee_data.c:98
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:56
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:436
static void eevee_engine_free(void)
Definition: eevee_engine.c:607
static void eevee_cache_init(void *vedata)
Definition: eevee_engine.c:81
void EEVEE_cache_populate(void *vedata, Object *ob)
Definition: eevee_engine.c:99
static void eevee_view_update(void *vedata)
Definition: eevee_engine.c:366
void eevee_id_update(void *vedata, ID *id)
Definition: eevee_engine.c:414
#define EEVEE_ENGINE
Definition: eevee_engine.c:26
static const DrawEngineDataSize eevee_data_size
Definition: eevee_engine.c:616
static void eevee_cache_finish(void *vedata)
Definition: eevee_engine.c:142
static void eevee_engine_init(void *ved)
Definition: eevee_engine.c:30
static void eevee_id_object_update(void *UNUSED(vedata), Object *object)
Definition: eevee_engine.c:374
static void eevee_draw_scene(void *vedata)
Definition: eevee_engine.c:186
static void eevee_render_reset_passes(EEVEE_Data *vedata)
Definition: eevee_engine.c:430
static void eevee_store_metadata(void *vedata, struct RenderResult *render_result)
Definition: eevee_engine.c:597
RenderEngineType DRW_engine_viewport_eevee_type
Definition: eevee_engine.c:636
static void eevee_id_world_update(void *vedata, World *wo)
Definition: eevee_engine.c:394
DrawEngineType draw_engine_eevee_type
Definition: eevee_engine.c:618
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img GPU_RGBA16F
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:230
void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob)
Definition: eevee_lights.c:200
void EEVEE_lights_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
Definition: eevee_lights.c:192
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_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_object_curves_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:48
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:120
void EEVEE_render_read_result(EEVEE_Data *vedata, struct RenderEngine *engine, struct RenderLayer *rl, const rcti *rect)
Definition: eevee_render.c:658
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:182
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:682
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:164
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:26
@ 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:35
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:785
bool RE_engine_test_break(RenderEngine *engine)
Definition: engine.c:488
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:225
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
MINLINE float fractf(float a)
#define floorf(x)
Definition: metal/compat.h:224
struct Scene * scene
Definition: DRW_render.h:979
struct Depsgraph * depsgraph
Definition: DRW_render.h:987
struct View3D * v3d
Definition: DRW_render.h:976
struct RegionView3D * rv3d
Definition: DRW_render.h:975
struct GPUFrameBuffer * default_fb
struct GPUTexture * depth
int recalc
Definition: DNA_ID.h:40
EEVEE_TextureList * txl
EEVEE_StorageList * stl
EEVEE_PassList * psl
EEVEE_FramebufferList * fbl
char info[GPU_INFO_SIZE]
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
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:368
char name[66]
Definition: DNA_ID.h:378
short base_flag
float motion_blur_shutter
int motion_blur_position
struct RenderData r
struct World * world
struct SceneEEVEE eevee
struct Object * camera
int object_type_exclude_viewport
#define N_(msgid)