diff options
Diffstat (limited to 'source/blender')
4 files changed, 24 insertions, 9 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index e73c170fecf..29e75ea2c45 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -201,6 +201,7 @@ static void eevee_draw_background(void *vedata) /* Refresh Probes */ DRW_stats_group_start("Probes Refresh"); EEVEE_lightprobes_refresh(sldata, vedata); + EEVEE_lightprobes_refresh_planar(sldata, vedata); DRW_stats_group_end(); /* Update common buffer after probe rendering. */ diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 7403da737dd..ab0b2c7fd29 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -1420,7 +1420,7 @@ static void lightprobes_refresh_initialize_grid(EEVEE_ViewLayerData *sldata, EEV pinfo->grid_initialized = true; } -static void lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) +void EEVEE_lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) { EEVEE_CommonUniformBuffer *common_data = &sldata->common_data; EEVEE_TextureList *txl = vedata->txl; @@ -1464,6 +1464,9 @@ static void lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data * common_data->prb_lod_planar_max = (float)(max_lod); DRW_stats_group_end(); } + + /* Disable SSR if we cannot read previous frame */ + common_data->ssr_toggle = vedata->stl->g_data->valid_double_buffer; } static void lightprobes_refresh_cube(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) @@ -1497,6 +1500,8 @@ static void lightprobes_refresh_cube(EEVEE_ViewLayerData *sldata, EEVEE_Data *ve /* Only do one probe per frame */ return; } + + pinfo->do_cube_update = false; } static void lightprobes_refresh_all_no_world(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) @@ -1645,11 +1650,20 @@ static void lightprobes_refresh_all_no_world(EEVEE_ViewLayerData *sldata, EEVEE_ lightprobes_refresh_cube(sldata, vedata); } -void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) +bool EEVEE_lightprobes_all_probes_ready(EEVEE_ViewLayerData *sldata, EEVEE_Data *UNUSED(vedata)) { EEVEE_LightProbesInfo *pinfo = sldata->probes; EEVEE_CommonUniformBuffer *common_data = &sldata->common_data; + return ((pinfo->do_cube_update == false) && + (pinfo->updated_bounce == pinfo->num_bounce) && + (common_data->prb_num_render_cube == pinfo->num_cube)); +} + +void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) +{ + EEVEE_CommonUniformBuffer *common_data = &sldata->common_data; + /* Disable specular lighting when rendering probes to avoid feedback loops (looks bad). */ common_data->spec_toggle = false; common_data->ssr_toggle = false; @@ -1665,7 +1679,7 @@ void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) if (e_data.update_world) { lightprobes_refresh_world(sldata, vedata); } - else if (pinfo->do_cube_update || (pinfo->updated_bounce < pinfo->num_bounce)) { + else if (EEVEE_lightprobes_all_probes_ready(sldata, vedata) == false) { lightprobes_refresh_all_no_world(sldata, vedata); } @@ -1675,11 +1689,6 @@ void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) common_data->sss_toggle = true; common_data->ao_dist = tmp_ao_dist; common_data->ao_settings = tmp_ao_settings; - - lightprobes_refresh_planar(sldata, vedata); - - /* Disable SSR if we cannot read previous frame */ - common_data->ssr_toggle = vedata->stl->g_data->valid_double_buffer; } void EEVEE_lightprobes_free(void) diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 0381f841ea7..b9d1fa884e5 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -796,11 +796,13 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_PassList *psl); void EEVEE_lights_free(void); /* eevee_lightprobes.c */ +bool EEVEE_lightprobes_all_probes_ready(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_lightprobes_cache_add(EEVEE_ViewLayerData *sldata, Object *ob); void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); +void EEVEE_lightprobes_refresh_planar(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_lightprobes_free(void); /* eevee_depth_of_field.c */ diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c index b2a9e177790..c2c7959ae7e 100644 --- a/source/blender/draw/engines/eevee/eevee_render.c +++ b/source/blender/draw/engines/eevee/eevee_render.c @@ -430,7 +430,10 @@ void EEVEE_render_draw(EEVEE_Data *vedata, struct RenderEngine *engine, struct D EEVEE_volumes_set_jitter(sldata, stl->effects->taa_current_sample - 1); /* Refresh Probes */ - EEVEE_lightprobes_refresh(sldata, vedata); + while (EEVEE_lightprobes_all_probes_ready(sldata, vedata) == false) { + EEVEE_lightprobes_refresh(sldata, vedata); + } + EEVEE_lightprobes_refresh_planar(sldata, vedata); DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data); /* Set matrices. */ DRW_viewport_matrix_override_set(stl->effects->overide_persmat, DRW_MAT_PERS); |