gsdx-ogl: only call PixelStorei when parameters are updated

It won't improve performance but it would reduce a bit the noise in gl retracer tool
This commit is contained in:
Gregory Hainaut 2014-11-08 19:11:11 +01:00
parent 47f40ed79a
commit 16377f7249
1 changed files with 14 additions and 2 deletions

View File

@ -314,7 +314,13 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
// big upscale // big upscale
// Note: with latest improvement, Pbo could be faster // Note: with latest improvement, Pbo could be faster
#if 1 #if 1
glPixelStorei(GL_UNPACK_ALIGNMENT, m_int_alignment); // Note: not really a performance optimization but it reduces noise
// for gl retracers
static uint32 unpack_alignment = 0;
if (unpack_alignment != m_int_alignment) {
unpack_alignment = m_int_alignment;
glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment);
}
char* src = (char*)data; char* src = (char*)data;
char* map = PboPool::Map(r.height() * pitch); char* map = PboPool::Map(r.height() * pitch);
@ -329,7 +335,13 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
PboPool::Unmap(); PboPool::Unmap();
glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch >> m_int_shift); // Note: not really a performance optimization but it reduces noise
// for gl retracers
static int unpack_row_length = 0;
if (unpack_row_length != (pitch >> m_int_shift)) {
unpack_row_length = pitch >> m_int_shift;
glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_row_length);
}
glTexSubImage2D(GL_TEXTURE_2D, 0, r.x, r.y, r.width(), r.height(), m_int_format, m_int_type, (const void*)PboPool::Offset()); glTexSubImage2D(GL_TEXTURE_2D, 0, r.x, r.y, r.width(), r.height(), m_int_format, m_int_type, (const void*)PboPool::Offset());
// Normally only affect TexSubImage call. (i.e. only the previous line) // Normally only affect TexSubImage call. (i.e. only the previous line)
//glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); //glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);