diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index f165eedeed..55ac2de52f 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -415,9 +415,11 @@ void GSDeviceOGL::BeforeDraw() #ifdef _DEBUG ASSERT(gl_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); #endif +#if 0 // Ensure VBOs are uploaded if (GLLoader::found_GL_ARB_buffer_storage) Barrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); +#endif //#ifdef ENABLE_OGL_STENCIL_DEBUG // if (m_date.t) diff --git a/plugins/GSdx/GSVertexArrayOGL.h b/plugins/GSdx/GSVertexArrayOGL.h index 0dd76c66e7..276cde2c76 100644 --- a/plugins/GSdx/GSVertexArrayOGL.h +++ b/plugins/GSdx/GSVertexArrayOGL.h @@ -66,7 +66,7 @@ class GSBufferOGL { const GLbitfield map_flags = GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT // | 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 // | GL_CLIENT_STORAGE_BIT @@ -130,6 +130,8 @@ class GSBufferOGL { void* dst; m_count = count; + size_t offset = m_start*m_stride; + size_t length = m_count*m_stride; // Get the pointer of the buffer { @@ -141,21 +143,25 @@ class GSBufferOGL { //fprintf(stderr, "Wrap buffer (%x)\n", m_target); // Wrap at startup m_start = 0; + offset = 0; } - dst = m_buffer_ptr + m_start*m_stride; + dst = m_buffer_ptr + offset; } #if 0 // FIXME which one to use. Note dst doesn't have any aligment guarantee // because it depends of the offset if (m_target == GL_ARRAY_BUFFER) { - GSVector4i::storent(dst, src, m_count * m_stride); + GSVector4i::storent(dst, src, length); } else { - memcpy(dst, src, m_stride*m_count); + memcpy(dst, src, length); } #else - memcpy(dst, src, m_stride*m_count); + memcpy(dst, src, length); +#endif +#if 1 + gl_FlushMappedBufferRange(m_target, offset, length); #endif }