gsdx-ogl: allow to invalidate the texture

It just a hint to the driver to avoid any useless transfer

I don't expect any change but it is free so why not ;)
This commit is contained in:
Gregory Hainaut 2015-04-25 12:44:59 +02:00
parent 75817bb27b
commit 757726bb91
7 changed files with 14 additions and 0 deletions

View File

@ -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;

View File

@ -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?)

View File

@ -154,6 +154,8 @@ void GSDevice::Recycle(GSTexture* t)
{
if(t)
{
Invalidate(t);
t->last_frame_used = m_frame;
m_pool.push_front(t);

View File

@ -111,6 +111,7 @@ public:
virtual ~GSDevice();
void Recycle(GSTexture* t);
virtual void Invalidate(GSTexture* t) {}
enum {Windowed, Fullscreen, DontCare};

View File

@ -603,6 +603,12 @@ void GSDeviceOGL::Barrier(GLbitfield b)
#endif
}
void GSDeviceOGL::Invalidate(GSTexture* t)
{
if (gl_InvalidateTexImage)
gl_InvalidateTexImage(static_cast<GSTextureOGL*>(t)->GetID(), GL_TEX_LEVEL_0);
}
/* Note: must be here because tfx_glsl is static */
GLuint GSDeviceOGL::CompileVS(VSSelector sel, int logz)
{

View File

@ -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);

View File

@ -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?)