From f6652e9a501efc645fe2f7f0777d6e3a67cc7214 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Wed, 22 Apr 2015 09:33:41 +0200 Subject: [PATCH] gsdx-ogl: disable slow and buggy code until I found a better solution ogl_texture_storage 1 creates texture corruption. Advance date is too slow, code need to be updated (properly) to uses 2 passes only not 3 Maybe one could be enough (sometimes) --- plugins/GSdx/GLLoader.cpp | 3 ++- plugins/GSdx/GSTextureOGL.cpp | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index 9a445d41a4..09ccaecccc 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -290,7 +290,8 @@ namespace GLLoader { if (ext.compare("GL_ARB_shading_language_420pack") == 0) found_GL_ARB_shading_language_420pack = true; if (ext.compare("GL_ARB_texture_storage") == 0) found_GL_ARB_texture_storage = true; // Only enable this extension on nvidia - if (nvidia_buggy_driver && ext.compare("GL_ARB_shader_image_load_store") == 0) found_GL_ARB_shader_image_load_store = true; + // It is too costly on perf (big upscaling), code need to updated to reduce the number of draw stage + //if (nvidia_buggy_driver && ext.compare("GL_ARB_shader_image_load_store") == 0) found_GL_ARB_shader_image_load_store = true; // GL4.3 if (ext.compare("GL_ARB_copy_image") == 0) found_GL_ARB_copy_image = true; if (ext.compare("GL_ARB_explicit_uniform_location") == 0) found_GL_ARB_explicit_uniform_location = true; diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 5dcb7bc23a..ee0b8ed164 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -36,6 +36,7 @@ namespace PboPool { char* m_map[PBO_POOL_SIZE]; uint32 m_current_pbo = 0; uint32 m_size; + bool m_texture_storage; const uint32 m_pbo_size = 4*1024*1024; #ifndef ENABLE_GLES @@ -51,11 +52,12 @@ namespace PboPool { 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); for (size_t i = 0; i < countof(m_pool); i++) { BindPbo(); - if (GLLoader::found_GL_ARB_buffer_storage) { + if (m_texture_storage) { #ifndef ENABLE_GLES gl_BufferStorage(GL_PIXEL_UNPACK_BUFFER, m_pbo_size, NULL, create_flags); m_map[m_current_pbo] = (char*)gl_MapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, m_pbo_size, map_flags); @@ -78,7 +80,7 @@ namespace PboPool { fprintf(stderr, "BUG: PBO too small %d but need %d\n", m_pbo_size, m_size); } - if (GLLoader::found_GL_ARB_buffer_storage) { + if (m_texture_storage) { if (m_offset[m_current_pbo] + m_size >= m_pbo_size) { NextPbo(); } @@ -118,7 +120,7 @@ namespace PboPool { } void Unmap() { - if (GLLoader::found_GL_ARB_buffer_storage) { + 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); @@ -132,7 +134,7 @@ namespace PboPool { } void Destroy() { - if (GLLoader::found_GL_ARB_buffer_storage) + if (m_texture_storage) UnmapAll(); gl_DeleteBuffers(countof(m_pool), m_pool); }