From a8bcc760b4e75aba28833d95cdc4f2d94b3bc63e Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 27 Jun 2015 11:08:29 +0200 Subject: [PATCH] gsdx-tc: only clean RT in openGL It is a debug feature for myself --- plugins/GSdx/GSTextureCache.cpp | 14 +++++++------- plugins/GSdx/GSTextureCache.h | 1 + plugins/GSdx/GSTextureCacheOGL.h | 4 +++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index b4df5377a4..f338bcb047 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -200,12 +200,10 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con return NULL; } -#ifdef ENABLE_OGL_DEBUG } else { GL_CACHE("TC: src hit: %d (0x%x F:0x%x)", src->m_texture ? src->m_texture->GetID() : 0, TEX0.TBP0, TEX0.PSM); -#endif } if (src->m_palette) @@ -308,10 +306,12 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int // // From a performance point of view, it might cost a little on big upscaling // but normally few RT are miss so it must remain reasonable. - switch (type) { - case RenderTarget: m_renderer->m_dev->ClearRenderTarget(dst->m_texture, 0); break; - case DepthStencil: m_renderer->m_dev->ClearDepth(dst->m_texture, 0); break; - default:break; + if (IsOpenGL()) { + switch (type) { + case RenderTarget: m_renderer->m_dev->ClearRenderTarget(dst->m_texture, 0); break; + case DepthStencil: m_renderer->m_dev->ClearDepth(dst->m_texture, 0); break; + default:break; + } } #endif } @@ -998,7 +998,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con if(tmp != NULL) { - // tmp is texture before a MultiSample resolve + // tmp is the texture before a MultiSample resolve m_renderer->m_dev->Recycle(dst->m_texture); dst->m_texture = tmp; diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index 0d337e8662..748f0205c5 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -128,6 +128,7 @@ protected: #endif virtual bool CanConvertDepth() { return m_can_convert_depth; } + virtual bool IsOpenGL() { return false; } public: GSTextureCache(GSRenderer* r); diff --git a/plugins/GSdx/GSTextureCacheOGL.h b/plugins/GSdx/GSTextureCacheOGL.h index 40840e7670..4e241d4be4 100644 --- a/plugins/GSdx/GSTextureCacheOGL.h +++ b/plugins/GSdx/GSTextureCacheOGL.h @@ -28,10 +28,12 @@ class GSTextureCacheOGL : public GSTextureCache { protected: - int Get8bitFormat() { return GL_R8; /* TODO return DXGI_FORMAT_A8_UNORM;*/} + int Get8bitFormat() { return GL_R8;} void Read(Target* t, const GSVector4i& r); + virtual bool IsOpenGL() { return true; } + public: GSTextureCacheOGL(GSRenderer* r); };