From 613e215c736f5bebac14ce14c391cd263cfdc3de Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Thu, 14 May 2015 20:05:49 +0200 Subject: [PATCH] gsdx-ogl: add some note for the persistent buffer + add a flush Persistent is slower (at least on my gs dump) because data is put in host instead of the video memory I don't understand why upload the data directly to the video memory is faster --- plugins/GSdx/GSTextureOGL.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 32efec0c6c..8746370a95 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -48,6 +48,14 @@ namespace PboPool { const GLbitfield map_flags = common_flags | GL_MAP_FLUSH_EXPLICIT_BIT; const GLbitfield create_flags = common_flags | GL_CLIENT_STORAGE_BIT; + // Perf impact (test was only done on a gs dump): + // Normal (fast): Message:Buffer detailed info: Buffer object 9 (bound to + // GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_STREAM_COPY) will use VIDEO + // memory as the source for buffer object operations. + // + // Persistent (slower): Message:Buffer detailed info: Buffer object 8 + // (bound to GL_PIXEL_UNPACK_BUFFER_ARB, usage hint is GL_DYNAMIC_DRAW) + // will use DMA CACHED memory as the source for buffer object operations void Init() { gl_GenBuffers(countof(m_pool), m_pool); m_texture_storage = ((theApp.GetConfig("ogl_texture_storage", 0) == 1) && GLLoader::found_GL_ARB_buffer_storage); @@ -119,9 +127,7 @@ namespace PboPool { void Unmap() { if (m_texture_storage) { - // As far as I understand glTexSubImage2D is a client-server transfer so no need to make - // the value visible to the server - //gl_MemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); + gl_FlushMappedBufferRange(GL_PIXEL_UNPACK_BUFFER, m_offset[m_current_pbo], m_size); } else { gl_UnmapBuffer(GL_PIXEL_UNPACK_BUFFER); }