gsdx ogl: flush vbo range instead of barrier

For testing purpose. I don't know which one is better.

It seems flushing have less fps fluctuation than barrier.
This commit is contained in:
Gregory Hainaut 2015-04-21 21:44:50 +02:00
parent ce98276322
commit 19eb1f00d1
2 changed files with 13 additions and 5 deletions

View File

@ -415,9 +415,11 @@ void GSDeviceOGL::BeforeDraw()
#ifdef _DEBUG #ifdef _DEBUG
ASSERT(gl_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); ASSERT(gl_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
#endif #endif
#if 0
// Ensure VBOs are uploaded // Ensure VBOs are uploaded
if (GLLoader::found_GL_ARB_buffer_storage) if (GLLoader::found_GL_ARB_buffer_storage)
Barrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); Barrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT);
#endif
//#ifdef ENABLE_OGL_STENCIL_DEBUG //#ifdef ENABLE_OGL_STENCIL_DEBUG
// if (m_date.t) // if (m_date.t)

View File

@ -66,7 +66,7 @@ class GSBufferOGL {
const GLbitfield map_flags = GL_MAP_WRITE_BIT const GLbitfield map_flags = GL_MAP_WRITE_BIT
| GL_MAP_PERSISTENT_BIT | GL_MAP_PERSISTENT_BIT
// | GL_MAP_COHERENT_BIT (see barrier in GSDeviceOGL::BeforeDraw) // | GL_MAP_COHERENT_BIT (see barrier in GSDeviceOGL::BeforeDraw)
| GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT
; ;
const GLbitfield create_flags = map_flags const GLbitfield create_flags = map_flags
// | GL_CLIENT_STORAGE_BIT // | GL_CLIENT_STORAGE_BIT
@ -130,6 +130,8 @@ class GSBufferOGL {
void* dst; void* dst;
m_count = count; m_count = count;
size_t offset = m_start*m_stride;
size_t length = m_count*m_stride;
// Get the pointer of the buffer // Get the pointer of the buffer
{ {
@ -141,21 +143,25 @@ class GSBufferOGL {
//fprintf(stderr, "Wrap buffer (%x)\n", m_target); //fprintf(stderr, "Wrap buffer (%x)\n", m_target);
// Wrap at startup // Wrap at startup
m_start = 0; m_start = 0;
offset = 0;
} }
dst = m_buffer_ptr + m_start*m_stride; dst = m_buffer_ptr + offset;
} }
#if 0 #if 0
// FIXME which one to use. Note dst doesn't have any aligment guarantee // FIXME which one to use. Note dst doesn't have any aligment guarantee
// because it depends of the offset // because it depends of the offset
if (m_target == GL_ARRAY_BUFFER) { if (m_target == GL_ARRAY_BUFFER) {
GSVector4i::storent(dst, src, m_count * m_stride); GSVector4i::storent(dst, src, length);
} else { } else {
memcpy(dst, src, m_stride*m_count); memcpy(dst, src, length);
} }
#else #else
memcpy(dst, src, m_stride*m_count); memcpy(dst, src, length);
#endif
#if 1
gl_FlushMappedBufferRange(m_target, offset, length);
#endif #endif
} }