diff --git a/plugins/GSdx/GLState.cpp b/plugins/GSdx/GLState.cpp index 88fbb80b35..79786539d4 100644 --- a/plugins/GSdx/GLState.cpp +++ b/plugins/GSdx/GLState.cpp @@ -57,7 +57,7 @@ namespace GLState { GLuint program; GLuint pipeline; - uint64 available_vram; + int64 available_vram; void Clear() { fbo = 0; diff --git a/plugins/GSdx/GLState.h b/plugins/GSdx/GLState.h index 69e60c342d..2f55635ae3 100644 --- a/plugins/GSdx/GLState.h +++ b/plugins/GSdx/GLState.h @@ -59,7 +59,7 @@ namespace GLState { extern GLuint program; extern GLuint pipeline; - extern uint64 available_vram; + extern int64 available_vram; extern void Clear(); } diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index c31b8855e0..4f904cc948 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -499,17 +499,23 @@ bool GSDeviceOGL::Create(GSWnd* wnd) // **************************************************************** GLint vram[4] = {0}; if (GLLoader::fglrx_buggy_driver) { + // Full vram, remove a small margin for others buffer glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, vram); + if (vram[0] > 200000) + vram[0] -= 128 * 1024; + } else if (GLLoader::found_GL_NVX_gpu_memory_info) { + // GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX <= give full memory + // Available vram glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, vram); } else { fprintf(stdout, "No extenstion supported to get available memory. Use default value !\n"); } - if (vram[0] > 200000) - GLState::available_vram = (uint64)(vram[0] - 200000) * 1024ul; + if (vram[0] > 0) + GLState::available_vram = (int64)(vram[0]) * 1024ul; - fprintf(stdout, "Available VRAM:%lluMB\n", GLState::available_vram >> 20u); + fprintf(stdout, "Available VRAM:%lldMB\n", GLState::available_vram >> 20u); // **************************************************************** // Finish window setup and backbuffer diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 43d59afb11..fccef04199 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -239,10 +239,12 @@ GSTextureOGL::GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read) } m_mem_usage = (m_size.x * m_size.y) << m_int_shift; - if (m_mem_usage > GLState::available_vram) { - throw GSDXErrorOOM(); // Still time to do a prayer ! - } else { - GLState::available_vram -= m_mem_usage; + + static int every_16 = 0; + GLState::available_vram -= m_mem_usage; + if ((GLState::available_vram < 0) && (every_16 % 16 == 0)) { + fprintf(stderr, "Available VRAM is very low, a crash is expected ! Disable Larger framebuffer or reduce upscaling!"); + every_16++; } // Generate & Allocate the buffer