Eevee: Fix T52713: SSR not working in AMD

This was cause by a fairly funky unitialize buffer (last frame) that was causing NANs during the SSR resolve stage.
They were then propagated to the whole image during the next swap.

Bypassing the SSR completly if no valid history exists fixes the problem. Also disabling SSR data output in this case so we can have correct reflection in the 1st history buffer.
This commit is contained in:
Clément Foucault 2017-09-12 18:32:29 +02:00
parent 79a1d74c78
commit 8a5af5202c
Notes: blender-bot 2023-02-14 06:35:51 +01:00
Referenced by issue #52713, Eevee: SSR not working in AMD
2 changed files with 4 additions and 10 deletions

View File

@ -1257,7 +1257,7 @@ void EEVEE_effects_do_ssr(EEVEE_SceneLayerData *UNUSED(sldata), EEVEE_Data *veda
EEVEE_TextureList *txl = vedata->txl;
EEVEE_EffectsInfo *effects = stl->effects;
if ((effects->enabled_effects & EFFECT_SSR) != 0) {
if (((effects->enabled_effects & EFFECT_SSR) != 0) && stl->g_data->valid_double_buffer) {
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
e_data.depth_src = dtxl->depth;
@ -1266,14 +1266,8 @@ void EEVEE_effects_do_ssr(EEVEE_SceneLayerData *UNUSED(sldata), EEVEE_Data *veda
}
DRW_framebuffer_bind(fbl->screen_tracing_fb);
if (stl->g_data->valid_double_buffer) {
/* Raytrace. */
DRW_draw_pass(psl->ssr_raytrace);
}
else {
float clear_col[4] = {0.0f, 0.0f, -1.0f, 0.001f};
DRW_framebuffer_clear(true, false, false, clear_col, 0.0f);
}
/* Raytrace. */
DRW_draw_pass(psl->ssr_raytrace);
for (int i = 0; i < effects->ssr_ray_count; ++i) {
DRW_framebuffer_texture_detach(stl->g_data->ssr_hit_output[i]);

View File

@ -366,7 +366,7 @@ static void add_standard_uniforms(
DRWShadingGroup *shgrp, EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata,
int *ssr_id, float *refract_depth, bool use_ssrefraction)
{
if (ssr_id == NULL) {
if (ssr_id == NULL || !vedata->stl->g_data->valid_double_buffer) {
static int no_ssr = -1.0f;
ssr_id = &no_ssr;
}