mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-08 22:57:12 +02:00
Video Common: Avoid 'presenting' duplicate frames by detecting when swap
hasn't changed since the last frame
This commit is contained in:
parent
c58010404d
commit
e6d85b0915
@ -639,11 +639,10 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const
|
|||||||
auto* xfb_entry = g_texture_cache->GetTexture(xfbAddr, fbWidth, fbHeight, TextureFormat::XFB,
|
auto* xfb_entry = g_texture_cache->GetTexture(xfbAddr, fbWidth, fbHeight, TextureFormat::XFB,
|
||||||
force_safe_texture_cache_hash);
|
force_safe_texture_cache_hash);
|
||||||
|
|
||||||
if (xfb_entry)
|
if (xfb_entry && xfb_entry->id != m_last_xfb_id)
|
||||||
{
|
{
|
||||||
// TODO, check if xfb_entry is a duplicate of the previous frame and skip SwapImpl
|
|
||||||
|
|
||||||
m_last_xfb_texture = xfb_entry->texture.get();
|
m_last_xfb_texture = xfb_entry->texture.get();
|
||||||
|
m_last_xfb_id = xfb_entry->id;
|
||||||
|
|
||||||
// TODO: merge more generic parts into VideoCommon
|
// TODO: merge more generic parts into VideoCommon
|
||||||
g_renderer->SwapImpl(xfb_entry->texture.get(), rc, ticks, xfb_entry->gamma);
|
g_renderer->SwapImpl(xfb_entry->texture.get(), rc, ticks, xfb_entry->gamma);
|
||||||
|
@ -207,6 +207,7 @@ private:
|
|||||||
} m_frame_dump_config;
|
} m_frame_dump_config;
|
||||||
|
|
||||||
AbstractTexture * m_last_xfb_texture;
|
AbstractTexture * m_last_xfb_texture;
|
||||||
|
u64 m_last_xfb_id = 0;
|
||||||
|
|
||||||
// Note: Only used for auto-ir
|
// Note: Only used for auto-ir
|
||||||
u32 m_last_xfb_width = MAX_XFB_WIDTH;
|
u32 m_last_xfb_width = MAX_XFB_WIDTH;
|
||||||
|
@ -1611,6 +1611,7 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::AllocateCacheEntry(const Textur
|
|||||||
}
|
}
|
||||||
TCacheEntry* cacheEntry = new TCacheEntry(std::move(texture));
|
TCacheEntry* cacheEntry = new TCacheEntry(std::move(texture));
|
||||||
cacheEntry->textures_by_hash_iter = textures_by_hash.end();
|
cacheEntry->textures_by_hash_iter = textures_by_hash.end();
|
||||||
|
cacheEntry->id = last_entry_id++;
|
||||||
return cacheEntry;
|
return cacheEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ public:
|
|||||||
bool is_xfb_copy = false;
|
bool is_xfb_copy = false;
|
||||||
float y_scale = 1.0f;
|
float y_scale = 1.0f;
|
||||||
float gamma = 1.0f;
|
float gamma = 1.0f;
|
||||||
|
u64 id;
|
||||||
|
|
||||||
unsigned int native_width,
|
unsigned int native_width,
|
||||||
native_height; // Texture dimensions from the GameCube's point of view
|
native_height; // Texture dimensions from the GameCube's point of view
|
||||||
@ -268,6 +269,7 @@ private:
|
|||||||
TexAddrCache textures_by_address;
|
TexAddrCache textures_by_address;
|
||||||
TexHashCache textures_by_hash;
|
TexHashCache textures_by_hash;
|
||||||
TexPool texture_pool;
|
TexPool texture_pool;
|
||||||
|
u64 last_entry_id = 0;
|
||||||
|
|
||||||
// Backup configuration values
|
// Backup configuration values
|
||||||
struct BackupConfig
|
struct BackupConfig
|
||||||
|
Loading…
Reference in New Issue
Block a user