diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index 35de7cefa3..1d8a8ce066 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -100,6 +100,7 @@ PFNGLGETSHADERINFOLOGPROC gl_GetShaderInfoLog = NU PFNGLPROGRAMUNIFORM1IPROC gl_ProgramUniform1i = NULL; // GL4.3 PFNGLCOPYIMAGESUBDATAPROC gl_CopyImageSubData = NULL; +PFNGLINVALIDATETEXIMAGEPROC gl_InvalidateTexImage = NULL; // GL4.2 PFNGLBINDIMAGETEXTUREPROC gl_BindImageTexture = NULL; PFNGLMEMORYBARRIERPROC gl_MemoryBarrier = NULL; diff --git a/plugins/GSdx/GLLoader.h b/plugins/GSdx/GLLoader.h index 1a2bf9cd81..7f9f0382ef 100644 --- a/plugins/GSdx/GLLoader.h +++ b/plugins/GSdx/GLLoader.h @@ -292,6 +292,7 @@ extern PFNGLMEMORYBARRIERPROC gl_MemoryBarrier; extern PFNGLTEXSTORAGE2DPROC gl_TexStorage2D; // GL4.3 extern PFNGLCOPYIMAGESUBDATAPROC gl_CopyImageSubData; +extern PFNGLINVALIDATETEXIMAGEPROC gl_InvalidateTexImage; // GL4.4 extern PFNGLBUFFERSTORAGEPROC gl_BufferStorage; // GL_ARB_bindless_texture (GL5?) diff --git a/plugins/GSdx/GSDevice.cpp b/plugins/GSdx/GSDevice.cpp index 43cad330a1..1b0c44d51e 100644 --- a/plugins/GSdx/GSDevice.cpp +++ b/plugins/GSdx/GSDevice.cpp @@ -154,6 +154,8 @@ void GSDevice::Recycle(GSTexture* t) { if(t) { + Invalidate(t); + t->last_frame_used = m_frame; m_pool.push_front(t); diff --git a/plugins/GSdx/GSDevice.h b/plugins/GSdx/GSDevice.h index 115824e1a3..a498cdc5d4 100644 --- a/plugins/GSdx/GSDevice.h +++ b/plugins/GSdx/GSDevice.h @@ -111,6 +111,7 @@ public: virtual ~GSDevice(); void Recycle(GSTexture* t); + virtual void Invalidate(GSTexture* t) {} enum {Windowed, Fullscreen, DontCare}; diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 92362689bf..9259464a52 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -603,6 +603,12 @@ void GSDeviceOGL::Barrier(GLbitfield b) #endif } +void GSDeviceOGL::Invalidate(GSTexture* t) +{ + if (gl_InvalidateTexImage) + gl_InvalidateTexImage(static_cast(t)->GetID(), GL_TEX_LEVEL_0); +} + /* Note: must be here because tfx_glsl is static */ GLuint GSDeviceOGL::CompileVS(VSSelector sel, int logz) { diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 64e29dbcd9..f6a6b69ca2 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -600,6 +600,8 @@ class GSDeviceOGL : public GSDevice void BeforeDraw(); void AfterDraw(); + void Invalidate(GSTexture* t); + void ClearRenderTarget(GSTexture* t, const GSVector4& c); void ClearRenderTarget(GSTexture* t, uint32 c); void ClearRenderTarget_ui(GSTexture* t, uint32 c); diff --git a/plugins/GSdx/GSWnd.cpp b/plugins/GSdx/GSWnd.cpp index 747e85700d..9c41ca16f1 100644 --- a/plugins/GSdx/GSWnd.cpp +++ b/plugins/GSdx/GSWnd.cpp @@ -107,6 +107,7 @@ void GSWndGL::PopulateGlFunction() *(void**)&(gl_TexStorage2D) = GetProcAddress("glTexStorage2D"); // GL4.3 *(void**)&(gl_CopyImageSubData) = GetProcAddress("glCopyImageSubData", true); + *(void**)&(gl_InvalidateTexImage) = GetProcAddress("glInvalidateTexImage", true); // GL4.4 *(void**)&(gl_BufferStorage) = GetProcAddress("glBufferStorage", true); // GL_ARB_bindless_texture (GL5?)