41 int closest_index = 0;
42 float closest_squared_distance = 1.0f;
44 for (
int index = 0; index < num; index++) {
45 const float squared_dist =
square_f(table[index][0]) +
square_f(table[index][1]);
46 if (squared_dist < closest_squared_distance) {
47 closest_squared_distance = squared_dist;
48 closest_index = index;
52 float closest_sample[2];
53 copy_v2_v2(closest_sample, table[closest_index]);
54 for (
int index = 0; index < num; index++) {
57 for (
int i = 0; i < 2; i++) {
59 table[index][i] =
fmodf(table[index][i] + 0.5f, 1.0f);
61 table[index][i] = table[index][i] * 2.0f - 1.0f;
66 if (closest_index != 0) {
71 for (
int i = 0; i < num - 2; i++) {
72 float f_squared_dist = 0.0;
74 for (
int j = i + 1; j < num; j++) {
75 const float squared_dist =
square_f(table[i][0] - table[j][0]) +
77 if (squared_dist > f_squared_dist) {
78 f_squared_dist = squared_dist;
88 if (
e_data.init ==
false) {
121 if (stl && stl->
wpd) {
201 if (in_front_history) {
213 GPU_ATTACHMENT_TEXTURE(txl->depth_buffer_tx),
214 GPU_ATTACHMENT_TEXTURE(txl->history_buffer_tx),
216 if (in_front_history) {
219 GPU_ATTACHMENT_TEXTURE(txl->depth_buffer_in_front_tx),
226 GPU_ATTACHMENT_TEXTURE(wpd->smaa_edge_tx),
232 GPU_ATTACHMENT_TEXTURE(wpd->smaa_weight_tx),
265 return 0.35875f - 0.48829f *
cosf(
x) + 0.14128f *
cosf(2.0f *
x) - 0.01168f *
cosf(3.0f *
x);
274 const float filter_width = 2.0f;
275 *r_weight_sum = 0.0f;
277 for (
int x = -1;
x <= 1;
x++) {
278 for (
int y = -1;
y <= 1;
y++, i++) {
279 float sample_co[2] = {
x,
y};
284 *r_weight_sum += weight;
285 r_weights[i] = weight;
315 const float metrics[4] = {sizeinv[0], sizeinv[1],
size[0],
size[1]};
375 float *transform_offset;
399 float winmat[4][4], viewmat[4][4], persmat[4][4];
406 transform_offset[0] / viewport_size[0],
407 transform_offset[1] / viewport_size[1]);
void BLI_jitter_init(float(*jitarr)[2], int num)
MINLINE int min_ii(int a, int b)
MINLINE float clamp_f(float value, float min, float max)
MINLINE float square_f(float a)
void window_translate_m4(float winmat[4][4], float perspmat[4][4], float x, float y)
bool equals_m4m4(const float mat1[4][4], const float mat2[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
MINLINE void swap_v2_v2(float a[2], float b[2])
MINLINE void sub_v2_v2(float r[2], const float a[2])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
#define V3D_HIDE_OVERLAYS
#define DRW_PASS_INSTANCE_CREATE(pass, original, state)
@ DRW_STATE_BLEND_ADD_FULL
#define DRW_PASS_CREATE(pass, state)
#define DRW_TEXTURE_FREE_SAFE(tex)
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 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
_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 y
_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
struct GPUShader GPUShader
void GPU_texture_copy(GPUTexture *dst, GPUTexture *src)
void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *data)
void GPU_texture_filter_mode(GPUTexture *tex, bool use_filter)
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
const DRWContextState * DRW_context_state_get(void)
const float * DRW_viewport_size_get(void)
bool DRW_state_is_image_render(void)
const float * DRW_viewport_invert_size_get(void)
void DRW_viewport_request_redraw(void)
DefaultTextureList * DRW_viewport_texture_list_get(void)
void DRW_view_persmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
const DRWView * DRW_view_default_get(void)
void DRW_shgroup_call_procedural_triangles(DRWShadingGroup *shgroup, Object *ob, uint tri_count)
void DRW_view_winmat_get(const DRWView *view, float mat[4][4], bool inverse)
void DRW_shgroup_uniform_texture_ex(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex, eGPUSamplerState sampler_state)
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_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_clear_framebuffer(DRWShadingGroup *shgroup, eGPUFrameBufferBits channels, uchar r, uchar g, uchar b, uchar a, float depth, uchar stencil)
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_draw_pass(DRWPass *pass)
void DRW_view_set_active(const DRWView *view)
void DRW_texture_ensure_fullscreen_2d(GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags)
GPUTexture * DRW_texture_pool_query_fullscreen(eGPUTextureFormat format, DrawEngineType *engine_type)
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
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_gpu_kernel_postfix ccl_global float int int int int sh
const unsigned char searchTexBytes[]
const unsigned char areaTexBytes[]
struct GPUFrameBuffer * default_fb
struct GPUTexture * depth
struct GPUTexture * depth_in_front
struct GPUTexture * color
struct SceneDisplay display
WORKBENCH_FramebufferList * fbl
WORKBENCH_StorageList * stl
WORKBENCH_TextureList * txl
struct GPUFrameBuffer * smaa_edge_fb
struct GPUFrameBuffer * antialiasing_fb
struct GPUFrameBuffer * antialiasing_in_front_fb
struct GPUFrameBuffer * smaa_weight_fb
struct DRWPass * aa_weight_ps
struct DRWPass * aa_accum_ps
struct DRWPass * aa_edge_ps
struct DRWPass * aa_accum_replace_ps
struct DRWPass * aa_resolve_ps
int taa_sample_len_previous
const UserDef * preferences
struct GPUTexture * smaa_edge_tx
struct GPUTexture * smaa_weight_tx
struct WORKBENCH_PrivateData * wpd
struct GPUTexture * depth_buffer_in_front_tx
struct GPUTexture * depth_buffer_tx
struct GPUTexture * smaa_search_tx
struct GPUTexture * smaa_area_tx
struct GPUTexture * history_buffer_tx
void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata)
static void workbench_taa_jitter_init_order(float(*table)[2], int num)
static void workbench_taa_jitter_init(void)
bool workbench_antialiasing_setup(WORKBENCH_Data *vedata)
void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata)
static struct @269 e_data
void workbench_antialiasing_cache_init(WORKBENCH_Data *vedata)
static float filter_blackman_harris(float x, const float width)
static bool workbench_in_front_history_needed(WORKBENCH_Data *vedata)
int workbench_antialiasing_sample_count_get(WORKBENCH_PrivateData *wpd)
void workbench_antialiasing_view_updated(WORKBENCH_Data *vedata)
static void workbench_antialiasing_weights_get(const float offset[2], float r_weights[9], float *r_weight_sum)
GPUShader * workbench_shader_antialiasing_get(int stage)
GPUShader * workbench_shader_antialiasing_accumulation_get(void)