Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/workbench/workbench_effect_taa.c
| Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | static void workbench_taa_jitter_init(void) | ||||
| workbench_taa_jitter_init_order(e_data.jitter_16, 16); | workbench_taa_jitter_init_order(e_data.jitter_16, 16); | ||||
| workbench_taa_jitter_init_order(e_data.jitter_32, 32); | workbench_taa_jitter_init_order(e_data.jitter_32, 32); | ||||
| } | } | ||||
| int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata) | int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata) | ||||
| { | { | ||||
| WORKBENCH_StorageList *stl = vedata->stl; | WORKBENCH_StorageList *stl = vedata->stl; | ||||
| WORKBENCH_PrivateData *wpd = stl->g_data; | WORKBENCH_PrivateData *wpd = stl->g_data; | ||||
| int result = 1; | |||||
| if (TAA_ENABLED(wpd)) { | |||||
| if (DRW_state_is_image_render()) { | |||||
| const Scene *scene = DRW_context_state_get()->scene; | const Scene *scene = DRW_context_state_get()->scene; | ||||
| result = (scene->r.mode & R_OSA) ? scene->r.osa : 1; | int result = scene->display.viewport_aa; | ||||
| if (workbench_is_taa_enabled(wpd)) { | |||||
| if (DRW_state_is_image_render()) { | |||||
| result = scene->display.render_aa; | |||||
| } | } | ||||
| else if (IN_RANGE_INCL(wpd->preferences->gpu_viewport_quality, | else if (IN_RANGE_INCL(wpd->preferences->gpu_viewport_quality, | ||||
| GPU_VIEWPORT_QUALITY_TAA8, | GPU_VIEWPORT_QUALITY_TAA8, | ||||
| GPU_VIEWPORT_QUALITY_TAA16)) { | GPU_VIEWPORT_QUALITY_TAA16)) { | ||||
| result = 8; | result = MIN2(result, 8); | ||||
| } | } | ||||
| else if (IN_RANGE_INCL(wpd->preferences->gpu_viewport_quality, | else if (IN_RANGE_INCL(wpd->preferences->gpu_viewport_quality, | ||||
| GPU_VIEWPORT_QUALITY_TAA16, | GPU_VIEWPORT_QUALITY_TAA16, | ||||
| GPU_VIEWPORT_QUALITY_TAA32)) { | GPU_VIEWPORT_QUALITY_TAA32)) { | ||||
| result = 16; | result = MIN2(result, 16); | ||||
| } | } | ||||
| else { | else { | ||||
| result = 32; | result = MIN2(result, 32); | ||||
| } | } | ||||
| } | } | ||||
| else { | |||||
| /* when no TAA is disabled return 1 to render a single sample | |||||
| * see `workbench_render.c` */ | |||||
| result = 1; | |||||
| } | |||||
| return result; | return result; | ||||
| } | } | ||||
| void workbench_taa_engine_init(WORKBENCH_Data *vedata) | void workbench_taa_engine_init(WORKBENCH_Data *vedata) | ||||
| { | { | ||||
| WORKBENCH_EffectInfo *effect_info = vedata->stl->effects; | WORKBENCH_EffectInfo *effect_info = vedata->stl->effects; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| RegionView3D *rv3d = draw_ctx->rv3d; | RegionView3D *rv3d = draw_ctx->rv3d; | ||||
| ▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines | |||||