Blender  V2.93
eevee_temporal_sampling.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 
25 #include "DRW_render.h"
26 
27 #include "ED_screen.h"
28 
29 #include "BLI_rand.h"
30 
31 #include "DEG_depsgraph_query.h"
32 
33 #include "GPU_texture.h"
34 #include "eevee_private.h"
35 
36 #define FILTER_CDF_TABLE_SIZE 512
37 
38 static struct {
39  /* Pixel filter table: Only blackman-harris for now. */
40  bool inited;
42 } e_data = {false}; /* Engine data */
43 
44 static float UNUSED_FUNCTION(filter_box)(float UNUSED(x))
45 {
46  return 1.0f;
47 }
48 
49 static float filter_blackman_harris(float x)
50 {
51  /* Hardcoded 1px footprint [-0.5..0.5]. We resize later. */
52  const float width = 1.0f;
53  x = 2.0f * M_PI * (x / width + 0.5f);
54  return 0.35875f - 0.48829f * cosf(x) + 0.14128f * cosf(2.0f * x) - 0.01168f * cosf(3.0f * x);
55 }
56 
57 /* Compute cumulative distribution function of a discrete function. */
58 static void compute_cdf(float (*func)(float x), float cdf[FILTER_CDF_TABLE_SIZE])
59 {
60  cdf[0] = 0.0f;
61  /* Actual CDF evaluation. */
62  for (int u = 0; u < FILTER_CDF_TABLE_SIZE - 1; u++) {
63  float x = (float)(u + 1) / (float)(FILTER_CDF_TABLE_SIZE - 1);
64  cdf[u + 1] = cdf[u] + func(x - 0.5f); /* [-0.5..0.5]. We resize later. */
65  }
66  /* Normalize the CDF. */
67  for (int u = 0; u < FILTER_CDF_TABLE_SIZE - 1; u++) {
68  cdf[u] /= cdf[FILTER_CDF_TABLE_SIZE - 1];
69  }
70  /* Just to make sure. */
71  cdf[FILTER_CDF_TABLE_SIZE - 1] = 1.0f;
72 }
73 
74 static void invert_cdf(const float cdf[FILTER_CDF_TABLE_SIZE],
76 {
77  for (int u = 0; u < FILTER_CDF_TABLE_SIZE; u++) {
78  float x = (float)u / (float)(FILTER_CDF_TABLE_SIZE - 1);
79  for (int i = 0; i < FILTER_CDF_TABLE_SIZE; i++) {
80  if (cdf[i] >= x) {
81  if (i == FILTER_CDF_TABLE_SIZE - 1) {
82  invert_cdf[u] = 1.0f;
83  }
84  else {
85  float t = (x - cdf[i]) / (cdf[i + 1] - cdf[i]);
86  invert_cdf[u] = ((float)i + t) / (float)(FILTER_CDF_TABLE_SIZE - 1);
87  }
88  break;
89  }
90  }
91  }
92 }
93 
94 /* Evaluate a discrete function table with linear interpolation. */
95 static float eval_table(const float *table, float x)
96 {
97  CLAMP(x, 0.0f, 1.0f);
98  x = x * (FILTER_CDF_TABLE_SIZE - 1);
99 
100  int index = min_ii((int)(x), FILTER_CDF_TABLE_SIZE - 1);
101  int nindex = min_ii(index + 1, FILTER_CDF_TABLE_SIZE - 1);
102  float t = x - index;
103 
104  return (1.0f - t) * table[index] + t * table[nindex];
105 }
106 
108 {
109  float *cdf_table = MEM_mallocN(sizeof(float) * FILTER_CDF_TABLE_SIZE, "Eevee Filter CDF table");
110 
111  float filter_width = 2.0f; /* Use a 2 pixel footprint by default. */
112 
113  {
114  /* Use blackman-harris filter. */
115  filter_width *= 2.0f;
117  }
118 
119  invert_cdf(cdf_table, e_data.inverted_cdf);
120 
121  /* Scale and offset table. */
122  for (int i = 0; i < FILTER_CDF_TABLE_SIZE; i++) {
123  e_data.inverted_cdf[i] = (e_data.inverted_cdf[i] - 0.5f) * filter_width;
124  }
125 
126  MEM_freeN(cdf_table);
127  e_data.inited = true;
128 }
129 
130 void EEVEE_temporal_sampling_offset_calc(const double ht_point[2],
131  const float filter_size,
132  float r_offset[2])
133 {
134  r_offset[0] = eval_table(e_data.inverted_cdf, (float)(ht_point[0])) * filter_size;
135  r_offset[1] = eval_table(e_data.inverted_cdf, (float)(ht_point[1])) * filter_size;
136 }
137 
138 void EEVEE_temporal_sampling_matrices_calc(EEVEE_EffectsInfo *effects, const double ht_point[2])
139 {
140  const float *viewport_size = DRW_viewport_size_get();
141  const DRWContextState *draw_ctx = DRW_context_state_get();
142  Scene *scene = draw_ctx->scene;
143  RenderData *rd = &scene->r;
144 
145  float persmat[4][4], viewmat[4][4], winmat[4][4], wininv[4][4];
146  DRW_view_persmat_get(NULL, persmat, false);
147  DRW_view_viewmat_get(NULL, viewmat, false);
148  DRW_view_winmat_get(NULL, winmat, false);
149  DRW_view_winmat_get(NULL, wininv, true);
150 
151  float ofs[2];
152  EEVEE_temporal_sampling_offset_calc(ht_point, rd->gauss, ofs);
153 
154  if (effects->taa_current_sample > 1) {
155  window_translate_m4(winmat, persmat, ofs[0] / viewport_size[0], ofs[1] / viewport_size[1]);
156  }
157 
158  /* Jitter is in pixel space. Focus distance in world space units. */
159  float dof_jitter[2], focus_distance;
160  if (EEVEE_depth_of_field_jitter_get(effects, dof_jitter, &focus_distance)) {
161  /* Convert to NDC space [-1..1]. */
162  dof_jitter[0] /= viewport_size[0] * 0.5f;
163  dof_jitter[1] /= viewport_size[1] * 0.5f;
164 
165  /* Skew the projection matrix in the ray direction and offset it to ray origin.
166  * Make it focus at focus_distance. */
167  if (winmat[2][3] != -1.0f) {
168  /* Orthographic */
169  add_v2_v2(winmat[2], dof_jitter);
170 
172  winmat, persmat, dof_jitter[0] * focus_distance, dof_jitter[1] * focus_distance);
173  }
174  else {
175  /* Get focus distance in NDC. */
176  float focus_pt[3] = {0.0f, 0.0f, -focus_distance};
177  mul_project_m4_v3(winmat, focus_pt);
178  /* Get pixel footprint in view-space. */
179  float jitter_scaled[3] = {dof_jitter[0], dof_jitter[1], focus_pt[2]};
180  float center[3] = {0.0f, 0.0f, focus_pt[2]};
181  mul_project_m4_v3(wininv, jitter_scaled);
182  mul_project_m4_v3(wininv, center);
183 
184  /* FIXME(fclem): The offset is noticeably large and the culling might make object pop out
185  * of the blurring radius. To fix this, use custom enlarged culling matrix. */
186  sub_v2_v2v2(jitter_scaled, jitter_scaled, center);
187  add_v2_v2(viewmat[3], jitter_scaled);
188 
189  window_translate_m4(winmat, persmat, -dof_jitter[0], -dof_jitter[1]);
190  }
191  }
192 
193  BLI_assert(effects->taa_view != NULL);
194 
195  /* When rendering just update the view. This avoids recomputing the culling. */
196  DRW_view_update_sub(effects->taa_view, viewmat, winmat);
197 }
198 
199 /* Update the matrices based on the current sample.
200  * Note: `DRW_MAT_PERS` and `DRW_MAT_VIEW` needs to read the original matrices. */
202 {
203  EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
204  EEVEE_EffectsInfo *effects = stl->effects;
205 
206  double ht_point[2];
207  double ht_offset[2] = {0.0, 0.0};
208  const uint ht_primes[2] = {2, 3};
209 
210  BLI_halton_2d(ht_primes, ht_offset, effects->taa_current_sample - 1, ht_point);
211 
212  EEVEE_temporal_sampling_matrices_calc(effects, ht_point);
213 
214  DRW_view_set_active(effects->taa_view);
215 }
216 
218 {
219  vedata->stl->effects->taa_render_sample = 1;
220  vedata->stl->effects->taa_current_sample = 1;
221 }
222 
224 {
225  EEVEE_EffectsInfo *effects = vedata->stl->effects;
226  /* Create a sub view to disable clipping planes (if any). */
227  const DRWView *default_view = DRW_view_default_get();
228  float viewmat[4][4], winmat[4][4];
229  DRW_view_viewmat_get(default_view, viewmat, false);
230  DRW_view_winmat_get(default_view, winmat, false);
231  effects->taa_view = DRW_view_create_sub(default_view, viewmat, winmat);
232  DRW_view_clip_planes_set(effects->taa_view, NULL, 0);
233 }
234 
236 {
237  const bool is_render = DRW_state_is_image_render();
238  int sample_count = is_render ? scene->eevee.taa_render_samples : scene->eevee.taa_samples;
239  int timesteps = is_render ? stl->g_data->render_timesteps : 1;
240 
241  sample_count = max_ii(0, sample_count);
242  sample_count = (sample_count == 0) ? TAA_MAX_SAMPLE : sample_count;
243  sample_count = divide_ceil_u(sample_count, timesteps);
244 
245  int dof_sample_count = EEVEE_depth_of_field_sample_count_get(stl->effects, sample_count, NULL);
246  sample_count = dof_sample_count * divide_ceil_u(sample_count, dof_sample_count);
247  return sample_count;
248 }
249 
251 {
252  EEVEE_StorageList *stl = vedata->stl;
253  EEVEE_EffectsInfo *effects = stl->effects;
254  int repro_flag = 0;
255 
256  if (!e_data.inited) {
258  }
259 
265  effects->taa_render_sample = 1;
266  }
267  effects->bypass_drawing = false;
268 
270 
271  const DRWContextState *draw_ctx = DRW_context_state_get();
272  const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
273 
274  if ((scene_eval->eevee.taa_samples != 1) || DRW_state_is_image_render()) {
275  float persmat[4][4];
276 
280  effects->taa_reproject_sample = ((effects->taa_reproject_sample + 1) % 16);
281  }
282 
283  /* Until we support reprojection, we need to make sure
284  * that the history buffer contains correct information. */
285  bool view_is_valid = stl->g_data->valid_double_buffer;
286 
287  view_is_valid = view_is_valid && (stl->g_data->view_updated == false);
288 
289  if (draw_ctx->evil_C != NULL) {
290  struct wmWindowManager *wm = CTX_wm_manager(draw_ctx->evil_C);
291  view_is_valid = view_is_valid && (ED_screen_animation_no_scrub(wm) == NULL);
292  }
293 
295 
297  view_is_valid = false;
298  effects->taa_total_sample = 1;
299  }
300 
301  /* Motion blur steps could reset the sampling when camera is animated (see T79970). */
302  if (!DRW_state_is_scene_render()) {
303  DRW_view_persmat_get(NULL, persmat, false);
304  view_is_valid = view_is_valid && compare_m4m4(persmat, effects->prev_drw_persmat, FLT_MIN);
305  }
306 
307  /* Prevent ghosting from probe data. */
308  view_is_valid = view_is_valid && (effects->prev_drw_support == DRW_state_draw_support()) &&
312 
313  if (((effects->taa_total_sample == 0) ||
314  (effects->taa_current_sample < effects->taa_total_sample)) ||
315  (!view_is_valid) || DRW_state_is_image_render()) {
316  if (view_is_valid) {
317  /* Viewport rendering updates the matrices in `eevee_draw_scene` */
318  if (!DRW_state_is_image_render()) {
319  effects->taa_current_sample += 1;
320  repro_flag = 0;
321  }
322  }
323  else {
324  effects->taa_current_sample = 1;
325  }
326  }
327  else {
328  const bool all_shaders_compiled = stl->g_data->queued_shaders_count_prev == 0;
329  /* Fix Texture painting (see T79370) and shader compilation (see T78520). */
330  if (DRW_state_is_navigating() || !all_shaders_compiled) {
331  effects->taa_current_sample = 1;
332  }
333  else {
334  effects->bypass_drawing = true;
335  }
336  }
337 
340  }
341 
342  effects->taa_current_sample = 1;
343 
344  return repro_flag;
345 }
346 
348 {
349  EEVEE_PassList *psl = vedata->psl;
350  EEVEE_StorageList *stl = vedata->stl;
351  EEVEE_TextureList *txl = vedata->txl;
352  EEVEE_EffectsInfo *effects = stl->effects;
353 
354  if (effects->enabled_effects & EFFECT_TAA) {
356 
359 
360  DRW_shgroup_uniform_texture_ref(grp, "colorHistoryBuffer", &txl->taa_history);
361  DRW_shgroup_uniform_texture_ref(grp, "colorBuffer", &effects->source_buffer);
362  DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
363  DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
364 
365  if (effects->enabled_effects & EFFECT_TAA_REPROJECT) {
367  DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
368  DRW_shgroup_uniform_mat4(grp, "prevViewProjectionMatrix", effects->prev_drw_persmat);
369  }
370  else {
371  DRW_shgroup_uniform_float(grp, "alpha", &effects->taa_alpha, 1);
372  }
374  }
375 }
376 
378 {
379  EEVEE_PassList *psl = vedata->psl;
380  EEVEE_TextureList *txl = vedata->txl;
381  EEVEE_FramebufferList *fbl = vedata->fbl;
382  EEVEE_StorageList *stl = vedata->stl;
383  EEVEE_EffectsInfo *effects = stl->effects;
384 
385  if ((effects->enabled_effects & (EFFECT_TAA | EFFECT_TAA_REPROJECT)) != 0) {
386  if ((effects->enabled_effects & EFFECT_TAA) != 0 && effects->taa_current_sample != 1) {
388  /* See EEVEE_temporal_sampling_init() for more details. */
389  effects->taa_alpha = 1.0f / (float)(effects->taa_render_sample);
390  }
391  else {
392  effects->taa_alpha = 1.0f / (float)(effects->taa_current_sample);
393  }
394 
397 
398  /* Restore the depth from sample 1. */
400 
402  }
403  else {
404  /* Save the depth buffer for the next frame.
405  * This saves us from doing anything special
406  * in the other mode engines. */
408 
409  /* Do reprojection for noise reduction */
410  /* TODO : do AA jitter if in only render view. */
411  if (!DRW_state_is_image_render() && (effects->enabled_effects & EFFECT_TAA_REPROJECT) != 0 &&
412  stl->g_data->valid_taa_history) {
416  }
417  else {
418  struct GPUFrameBuffer *source_fb = (effects->target_buffer == fbl->main_color_fb) ?
419  fbl->effect_color_fb :
420  fbl->main_color_fb;
422  }
423  }
424 
425  /* Make each loop count when doing a render. */
427  effects->taa_render_sample += 1;
428  effects->taa_current_sample += 1;
429  }
430  else {
431  if (!DRW_state_is_playback() &&
432  ((effects->taa_total_sample == 0) ||
433  (effects->taa_current_sample < effects->taa_total_sample))) {
435  }
436  }
437 
438  DRW_view_persmat_get(NULL, effects->prev_drw_persmat, false);
439  }
440 }
typedef float(TangentPoint)[2]
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:689
#define BLI_assert(a)
Definition: BLI_assert.h:58
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
#define M_PI
Definition: BLI_math_base.h:38
void window_translate_m4(float winmat[4][4], float perspmat[4][4], const float x, const float y)
Definition: math_geom.c:4877
void mul_project_m4_v3(const float M[4][4], float vec[3])
Definition: math_matrix.c:824
bool compare_m4m4(const float mat1[4][4], const float mat2[4][4], float limit)
Definition: math_matrix.c:1406
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
Random number functions.
void BLI_halton_2d(const unsigned int prime[2], double offset[2], int n, double *r)
Definition: rand.cc:310
unsigned int uint
Definition: BLI_sys_types.h:83
#define UNUSED_FUNCTION(x)
#define UNUSED(x)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ SCE_EEVEE_TAA_REPROJECTION
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:315
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:593
#define DRW_shgroup_call(shgroup, geom, ob)
Definition: DRW_render.h:420
bScreen * ED_screen_animation_no_scrub(const struct wmWindowManager *wm)
NSNotificationCenter * center
struct GPUFrameBuffer GPUFrameBuffer
@ GPU_DEPTH_BIT
@ GPU_COLOR_BIT
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
_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 width
_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 t
struct GPUShader GPUShader
Definition: GPU_shader.h:33
Group RGB to Bright Vector Camera CLAMP
Scene scene
GPUBatch * DRW_cache_fullscreen_quad_get(void)
Definition: draw_cache.c:358
bool DRW_state_is_opengl_render(void)
bool DRW_state_is_playback(void)
bool DRW_state_is_navigating(void)
bool DRW_state_draw_support(void)
const DRWContextState * DRW_context_state_get(void)
const float * DRW_viewport_size_get(void)
Definition: draw_manager.c:439
bool DRW_state_is_image_render(void)
bool DRW_state_is_scene_render(void)
void DRW_viewport_request_redraw(void)
Definition: draw_manager.c:707
DefaultTextureList * DRW_viewport_texture_list_get(void)
Definition: draw_manager.c:702
void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup, const char *name, const GPUUniformBuf *ubo)
void DRW_view_persmat_get(const DRWView *view, float mat[4][4], bool inverse)
const DRWView * DRW_view_default_get(void)
void DRW_view_winmat_get(const DRWView *view, float mat[4][4], bool inverse)
DRWView * DRW_view_create_sub(const DRWView *parent_view, const float viewmat[4][4], const float winmat[4][4])
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_view_clip_planes_set(DRWView *view, float(*planes)[4], int plane_len)
void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
void DRW_shgroup_uniform_mat4(DRWShadingGroup *shgroup, const char *name, const float(*value)[4])
void DRW_shgroup_uniform_float(DRWShadingGroup *shgroup, const char *name, const float *value, int arraysize)
void DRW_view_update_sub(DRWView *view, const float viewmat[4][4], const float winmat[4][4])
void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_view_set_active(DRWView *view)
void DRW_draw_pass(DRWPass *pass)
int EEVEE_depth_of_field_sample_count_get(EEVEE_EffectsInfo *effects, int sample_count, int *r_ring_count)
bool EEVEE_depth_of_field_jitter_get(EEVEE_EffectsInfo *fx, float r_jitter[2], float *r_focus_distance)
#define TAA_MAX_SAMPLE
Definition: eevee_private.h:59
struct GPUShader * EEVEE_shaders_taa_resolve_sh_get(EEVEE_EffectsFlag enabled_effects)
@ EFFECT_TAA_REPROJECT
@ EFFECT_DOUBLE_BUFFER
@ EFFECT_VELOCITY_BUFFER
@ EFFECT_DEPTH_DOUBLE_BUFFER
@ EFFECT_POST_BUFFER
@ EFFECT_TAA
#define SWAP_BUFFERS_TAA()
bool EEVEE_renderpasses_only_first_sample_pass_active(EEVEE_Data *vedata)
static void eevee_create_cdf_table_temporal_sampling(void)
void EEVEE_temporal_sampling_offset_calc(const double ht_point[2], const float filter_size, float r_offset[2])
static float filter_blackman_harris(float x)
#define FILTER_CDF_TABLE_SIZE
void EEVEE_temporal_sampling_matrices_calc(EEVEE_EffectsInfo *effects, const double ht_point[2])
static void compute_cdf(float(*func)(float x), float cdf[FILTER_CDF_TABLE_SIZE])
void EEVEE_temporal_sampling_reset(EEVEE_Data *vedata)
static float eval_table(const float *table, float x)
int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
int EEVEE_temporal_sampling_sample_count_get(const Scene *scene, const EEVEE_StorageList *stl)
static void invert_cdf(const float cdf[FILTER_CDF_TABLE_SIZE], float invert_cdf[FILTER_CDF_TABLE_SIZE])
void EEVEE_temporal_sampling_draw(EEVEE_Data *vedata)
bool inited
void EEVEE_temporal_sampling_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_temporal_sampling_create_view(EEVEE_Data *vedata)
void EEVEE_temporal_sampling_update_matrices(EEVEE_Data *vedata)
static struct @206 e_data
static float UNUSED_FUNCTION() filter_box(float UNUSED(x))
float inverted_cdf[FILTER_CDF_TABLE_SIZE]
void GPU_framebuffer_blit(GPUFrameBuffer *gpufb_read, int read_slot, GPUFrameBuffer *gpufb_write, int write_slot, eGPUFrameBufferBits blit_buffers)
#define cosf(x)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
MINLINE uint divide_ceil_u(uint a, uint b)
struct Scene * scene
Definition: DRW_render.h:745
const struct bContext * evil_C
Definition: DRW_render.h:763
struct Depsgraph * depsgraph
Definition: DRW_render.h:753
struct GPUTexture * depth
EEVEE_TextureList * txl
EEVEE_StorageList * stl
EEVEE_PassList * psl
EEVEE_FramebufferList * fbl
struct GPUTexture * source_buffer
float prev_drw_persmat[4][4]
struct GPUFrameBuffer * target_buffer
EEVEE_EffectsFlag enabled_effects
struct DRWView * taa_view
struct GPUFrameBuffer * main_fb
struct GPUFrameBuffer * taa_history_color_fb
struct GPUFrameBuffer * double_buffer_depth_fb
struct GPUFrameBuffer * main_color_fb
struct GPUFrameBuffer * effect_color_fb
struct DRWPass * taa_resolve
struct EEVEE_PrivateData * g_data
struct EEVEE_EffectsInfo * effects
struct GPUTexture * taa_history
struct GPUUniformBuf * combined
struct EEVEE_ViewLayerData::@202 renderpass_ubo
struct GPUUniformBuf * common_ubo
struct RenderData r
struct SceneEEVEE eevee