diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index c0754dbaa0..dae60ddb9e 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -161,7 +161,7 @@ GSTexture* GSRendererHW::GetOutput(int i) GSTexture* t = NULL; - if(GSTextureCache::Target* rt = m_tc->LookupTarget(TEX0, m_width, m_height)) + if(GSTextureCache::Target* rt = m_tc->LookupTarget(TEX0, m_width, m_height, GetFrameRect(i).bottom)) { t = rt->m_texture; diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index f17a313f51..5db4bdea66 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -26,6 +26,7 @@ GSTextureCache::GSTextureCache(GSRenderer* r) : m_renderer(r) { m_spritehack = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_SpriteHack", 0) : 0; + m_preload_frame = theApp.GetConfig("preload_frame_with_gs_data", 0); UserHacks_HalfPixelOffset = !!theApp.GetConfig("UserHacks", 0) && !!theApp.GetConfig("UserHacks_HalfPixelOffset", 0); m_paltex = !!theApp.GetConfig("paltex", 0); @@ -342,7 +343,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int return dst; } -GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int w, int h) +GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int w, int h, int real_h) { uint32 bp = TEX0.TBP0; @@ -385,6 +386,17 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int } m_renderer->m_dev->ClearRenderTarget(dst->m_texture, 0); // new frame buffers after reset should be cleared, don't display memory garbage + + if (m_preload_frame) { + // Load GS data into frame. Game can directly uploads a background or the full image in + // "CTRC" buffer. It will also avoid various black screen issue in gs dump. + // + // Code is more or less an equivalent of the SW renderer + // + // Option is hidden and not enabled by default to avoid any regression + dst->m_dirty.push_back(GSDirtyRect(GSVector4i(0, 0, TEX0.TBW * 64, real_h), TEX0.PSM)); + dst->Update(); + } } else { diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index d3e2ff68f3..0d337e8662 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -112,6 +112,7 @@ protected: list m_dst[2]; bool m_paltex; int m_spritehack; + bool m_preload_frame; uint8* m_temp; bool m_can_convert_depth; @@ -139,7 +140,7 @@ public: Source* LookupSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& r); Target* LookupTarget(const GIFRegTEX0& TEX0, int w, int h, int type, bool used); - Target* LookupTarget(const GIFRegTEX0& TEX0, int w, int h); + Target* LookupTarget(const GIFRegTEX0& TEX0, int w, int h, int real_h); void InvalidateVideoMemType(int type, uint32 bp); void InvalidateVideoMem(GSOffset* off, const GSVector4i& r, bool target = true);