Skip to content

Commit

Permalink
GS/HW: Clear dirty list on target clear
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Apr 23, 2024
1 parent fe0e71f commit 3d11057
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pcsx2/GS/Renderers/HW/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3058,6 +3058,10 @@ void GSRendererHW::Draw()
ds->ResizeTexture(new_w, new_h);
}

bool skip_draw = false;
if (!GSConfig.UserHacks_DisableSafeFeatures && is_possible_mem_clear)
skip_draw = TryTargetClear(rt, ds, preserve_rt_color, preserve_depth);

if (rt)
{
if (m_texture_shuffle || m_channel_shuffle || (!rt->m_dirty.empty() && !rt->m_dirty.GetTotalRect(rt->m_TEX0, rt->m_unscaled_size).rintersect(m_r).rempty()))
Expand Down Expand Up @@ -3138,10 +3142,6 @@ void GSRendererHW::Draw()
return;
}

bool skip_draw = false;
if (!GSConfig.UserHacks_DisableSafeFeatures && is_possible_mem_clear)
skip_draw = TryTargetClear(rt, ds, preserve_rt_color, preserve_depth);

// A couple of hack to avoid upscaling issue. So far it seems to impacts mostly sprite
// Note: first hack corrects both position and texture coordinate
// Note: second hack corrects only the texture coordinate
Expand Down Expand Up @@ -6583,6 +6583,7 @@ bool GSRendererHW::TryTargetClear(GSTextureCache::Target* rt, GSTextureCache::Ta
}

g_gs_device->ClearRenderTarget(rt->m_texture, clear_c);
rt->m_dirty.clear();

if (has_alpha)
{
Expand Down Expand Up @@ -6612,6 +6613,7 @@ bool GSRendererHW::TryTargetClear(GSTextureCache::Target* rt, GSTextureCache::Ta
const float d = static_cast<float>(z) * 0x1p-32f;
GL_INS("TryTargetClear(): DS at %x <= %f", ds->m_TEX0.TBP0, d);
g_gs_device->ClearDepth(ds->m_texture, d);
ds->m_dirty.clear();
ds->m_alpha_max = z >> 24;
ds->m_alpha_min = z >> 24;

Expand Down

0 comments on commit 3d11057

Please sign in to comment.