diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-06-14 20:12:39 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-06-14 20:17:06 +0300 |
commit | 0707177ab868f1845dba1ecfd396e58c091e89b0 (patch) | |
tree | a3ba924b06631c961eb2ec49f9e5c6ca3ac88ae8 | |
parent | 486755460ab23f555036537f1ac79037d5e7ef08 (diff) |
Fix T64913 Eevee: shader compilation does not reset TAA
This tracks the number of compiling shaders and just reset the TAA
if previous number mismatch.
5 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index cb2b3763c74..99be7ec631c 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -60,6 +60,7 @@ static void eevee_engine_init(void *ved) stl->g_data->background_alpha = DRW_state_draw_background() ? 1.0f : 0.0f; stl->g_data->valid_double_buffer = (txl->color_double_buffer != NULL); stl->g_data->valid_taa_history = (txl->taa_history != NULL); + stl->g_data->queued_shaders_count = 0; /* Main Buffer */ DRW_texture_ensure_fullscreen_2d(&txl->color, GPU_RGBA16F, DRW_TEX_FILTER | DRW_TEX_MIPMAP); @@ -145,6 +146,7 @@ void EEVEE_cache_populate(void *vedata, Object *ob) static void eevee_cache_finish(void *vedata) { EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure(); + EEVEE_PrivateData *g_data = ((EEVEE_Data *)vedata)->stl->g_data; EEVEE_volumes_cache_finish(sldata, vedata); EEVEE_materials_cache_finish(sldata, vedata); @@ -153,6 +155,13 @@ static void eevee_cache_finish(void *vedata) EEVEE_effects_draw_init(sldata, vedata); EEVEE_volumes_draw_init(sldata, vedata); + + /* Restart taa if a shader has finish compiling. */ + /* HACK We should use notification of some sort from the compilation job instead. */ + if (g_data->queued_shaders_count != g_data->queued_shaders_count_prev) { + g_data->queued_shaders_count_prev = g_data->queued_shaders_count; + EEVEE_temporal_sampling_reset(vedata); + } } /* As renders in an HDR offscreen buffer, we need draw everything once diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 848634f311e..ddc5eae768e 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -344,6 +344,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat if (wo->use_nodes && wo->nodetree) { static float error_col[3] = {1.0f, 0.0f, 1.0f}; + static float queue_col[3] = {0.5f, 0.5f, 0.5f}; struct GPUMaterial *gpumat = EEVEE_material_world_lightprobe_get(scene, wo); eGPUMaterialStatus status = GPU_material_status(gpumat); @@ -361,6 +362,10 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo); DRW_shgroup_call(grp, geom, NULL); break; + case GPU_MAT_QUEUED: + stl->g_data->queued_shaders_count++; + col = queue_col; + break; default: col = error_col; break; diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 97b0f079500..5ac4545d223 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -1000,6 +1000,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) break; case GPU_MAT_QUEUED: /* TODO Bypass probe compilation. */ + stl->g_data->queued_shaders_count++; col = compile_col; break; case GPU_MAT_FAILED: @@ -1352,6 +1353,7 @@ static void material_opaque(Material *ma, break; } case GPU_MAT_QUEUED: { + stl->g_data->queued_shaders_count++; color_p = compile_col; metal_p = spec_p = rough_p = ½ break; @@ -1458,6 +1460,7 @@ static void material_transparent(Material *ma, } case GPU_MAT_QUEUED: { /* TODO Bypass probe compilation. */ + stl->g_data->queued_shaders_count++; color_p = compile_col; metal_p = spec_p = rough_p = ½ break; @@ -1785,6 +1788,7 @@ void EEVEE_hair_cache_populate(EEVEE_Data *vedata, break; } case GPU_MAT_QUEUED: { + stl->g_data->queued_shaders_count++; color_p = compile_col; metal_p = spec_p = rough_p = ½ break; diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index fbbd5bc4ab3..166e8ac7473 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -840,6 +840,10 @@ typedef struct EEVEE_PrivateData { /* Color Management */ bool use_color_render_settings; + /* Compiling shaders count. This is to track if a shader has finished compiling. */ + int queued_shaders_count; + int queued_shaders_count_prev; + /* LookDev Settings */ int studiolight_index; float studiolight_rot_z; diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index a14e9b08053..9162a604d7c 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -394,9 +394,13 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, } struct GPUMaterial *mat = EEVEE_material_mesh_volume_get(scene, ma); + eGPUMaterialStatus status = GPU_material_status(mat); + if (status == GPU_MAT_QUEUED) { + vedata->stl->g_data->queued_shaders_count++; + } /* If shader failed to compile or is currently compiling. */ - if (GPU_material_status(mat) != GPU_MAT_SUCCESS) { + if (status != GPU_MAT_SUCCESS) { return; } |