36 #define FILTER_CDF_TABLE_SIZE 512
52 const float width = 1.0f;
54 return 0.35875f - 0.48829f *
cosf(
x) + 0.14128f *
cosf(2.0f *
x) - 0.01168f *
cosf(3.0f *
x);
64 cdf[u + 1] = cdf[u] + func(
x - 0.5f);
85 float t = (
x - cdf[i]) / (cdf[i + 1] - cdf[i]);
104 return (1.0f -
t) * table[index] +
t * table[nindex];
111 float filter_width = 2.0f;
115 filter_width *= 2.0f;
123 e_data.inverted_cdf[i] = (
e_data.inverted_cdf[i] - 0.5f) * filter_width;
131 const float filter_size,
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;
145 float persmat[4][4], viewmat[4][4], winmat[4][4], wininv[4][4];
155 window_translate_m4(winmat, persmat, ofs[0] / viewport_size[0], ofs[1] / viewport_size[1]);
159 float dof_jitter[2], focus_distance;
162 dof_jitter[0] /= viewport_size[0] * 0.5f;
163 dof_jitter[1] /= viewport_size[1] * 0.5f;
167 if (winmat[2][3] != -1.0f) {
172 winmat, persmat, dof_jitter[0] * focus_distance, dof_jitter[1] * focus_distance);
176 float focus_pt[3] = {0.0f, 0.0f, -focus_distance};
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]};
207 double ht_offset[2] = {0.0, 0.0};
208 const uint ht_primes[2] = {2, 3};
228 float viewmat[4][4], winmat[4][4];
241 sample_count =
max_ii(0, sample_count);
242 sample_count = (sample_count == 0) ?
TAA_MAX_SAMPLE : sample_count;
246 sample_count = dof_sample_count *
divide_ceil_u(sample_count, dof_sample_count);
297 view_is_valid =
false;
typedef float(TangentPoint)[2]
struct wmWindowManager * CTX_wm_manager(const bContext *C)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
void window_translate_m4(float winmat[4][4], float perspmat[4][4], const float x, const float y)
void mul_project_m4_v3(const float M[4][4], float vec[3])
bool compare_m4m4(const float mat1[4][4], const float mat2[4][4], float limit)
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])
void BLI_halton_2d(const unsigned int prime[2], double offset[2], int n, double *r)
#define UNUSED_FUNCTION(x)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ SCE_EEVEE_TAA_REPROJECTION
#define DRW_PASS_CREATE(pass, state)
#define DRW_shgroup_call(shgroup, geom, ob)
bScreen * ED_screen_animation_no_scrub(const struct wmWindowManager *wm)
NSNotificationCenter * center
struct GPUFrameBuffer GPUFrameBuffer
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
Group RGB to Bright Vector Camera CLAMP
GPUBatch * DRW_cache_fullscreen_quad_get(void)
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)
bool DRW_state_is_image_render(void)
bool DRW_state_is_scene_render(void)
void DRW_viewport_request_redraw(void)
DefaultTextureList * DRW_viewport_texture_list_get(void)
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)
struct GPUShader * EEVEE_shaders_taa_resolve_sh_get(EEVEE_EffectsFlag enabled_effects)
@ EFFECT_DEPTH_DOUBLE_BUFFER
#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)
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)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
MINLINE uint divide_ceil_u(uint a, uint b)
const struct bContext * evil_C
struct Depsgraph * depsgraph
struct GPUTexture * depth
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
int queued_shaders_count_prev
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