gsdx-hw: add an hidden option to preload the final frame with GS mem data

Game can directly uploads a background or the full image in
"CTRC" buffer. Previous code was a full black screen.

It will also avoid various black screen issue in gs dump.

hidden option: preload_frame_with_gs_data

Note: impact on upscaling was not tested and it's likely broken
This commit is contained in:
Gregory Hainaut 2015-06-26 09:25:50 +02:00
parent a751db5f2b
commit e66aac8ab7
3 changed files with 16 additions and 3 deletions

View File

@ -161,7 +161,7 @@ GSTexture* GSRendererHW::GetOutput(int i)
GSTexture* t = NULL; 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; t = rt->m_texture;

View File

@ -26,6 +26,7 @@ GSTextureCache::GSTextureCache(GSRenderer* r)
: m_renderer(r) : m_renderer(r)
{ {
m_spritehack = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_SpriteHack", 0) : 0; 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); UserHacks_HalfPixelOffset = !!theApp.GetConfig("UserHacks", 0) && !!theApp.GetConfig("UserHacks_HalfPixelOffset", 0);
m_paltex = !!theApp.GetConfig("paltex", 0); m_paltex = !!theApp.GetConfig("paltex", 0);
@ -342,7 +343,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
return dst; 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; 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 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 else
{ {

View File

@ -112,6 +112,7 @@ protected:
list<Target*> m_dst[2]; list<Target*> m_dst[2];
bool m_paltex; bool m_paltex;
int m_spritehack; int m_spritehack;
bool m_preload_frame;
uint8* m_temp; uint8* m_temp;
bool m_can_convert_depth; bool m_can_convert_depth;
@ -139,7 +140,7 @@ public:
Source* LookupSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& r); 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, 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 InvalidateVideoMemType(int type, uint32 bp);
void InvalidateVideoMem(GSOffset* off, const GSVector4i& r, bool target = true); void InvalidateVideoMem(GSOffset* off, const GSVector4i& r, bool target = true);