gsdx-ogl: add some flags to trace texture state

goal1: avoid 2 consecutives clean of the render target
goal2: only invalidate texture correctly
This commit is contained in:
Gregory Hainaut 2015-05-12 18:03:06 +02:00
parent 2e34d48e97
commit 3e784d57e8
2 changed files with 14 additions and 2 deletions

View File

@ -164,7 +164,7 @@ namespace PboPool {
// glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GSTextureOGL::GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read)
: m_pbo_size(0), m_dirty(false)
: m_pbo_size(0), m_dirty(false), m_clean(false)
{
// OpenGL didn't like dimensions of size 0
m_size.x = max(1,w);
@ -246,8 +246,16 @@ GSTextureOGL::~GSTextureOGL()
void GSTextureOGL::Invalidate()
{
if (m_dirty && gl_InvalidateTexImage)
if (m_dirty && gl_InvalidateTexImage) {
gl_InvalidateTexImage(m_texture_id, GL_TEX_LEVEL_0);
m_dirty = false;
}
}
bool GSTextureOGL::HasBeenCleaned() {
bool old = m_clean;
m_clean = true;
return old;
}
bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
@ -256,6 +264,7 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
GL_PUSH(format("Upload Texture %d", m_texture_id).c_str());
m_dirty = true;
m_clean = false;
// Note: reduce noise for gl retracers
// It might introduce bug after an emulator pause so always set it in standard mode

View File

@ -49,6 +49,7 @@ class GSTextureOGL : public GSTexture
int m_pbo_size;
GLuint m_fbo_read;
bool m_dirty;
bool m_clean;
// internal opengl format/type/alignment
GLenum m_int_format;
@ -78,4 +79,6 @@ class GSTextureOGL : public GSTexture
uint32 GetID() { return m_texture_id; }
GLuint64 GetHandle(GLuint sampler_id);
bool HasBeenCleaned();
void WasAttached() { m_clean = false; m_dirty = true; }
};