diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 4f904cc948..8aa1533198 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -501,9 +501,6 @@ bool GSDeviceOGL::Create(GSWnd* wnd) 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 @@ -512,10 +509,13 @@ bool GSDeviceOGL::Create(GSWnd* wnd) fprintf(stdout, "No extenstion supported to get available memory. Use default value !\n"); } - if (vram[0] > 0) - GLState::available_vram = (int64)(vram[0]) * 1024ul; + // When VRAM is at least 2GB, we set the limit to the default i.e. 3.8 GB + // When VRAM is below 2GB, we add a factor 2 because RAM can be used. Potentially + // low VRAM gpu can go higher but perf will be bad anyway. + if (vram[0] > 0 && vram[0] < 1800000) + GLState::available_vram = (int64)(vram[0]) * 1024ul * 2ul; - fprintf(stdout, "Available VRAM:%lldMB\n", GLState::available_vram >> 20u); + fprintf(stdout, "Available VRAM/RAM:%lldMB for textures\n", GLState::available_vram >> 20u); // **************************************************************** // Finish window setup and backbuffer diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index fccef04199..f980e6b1f8 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -240,11 +240,13 @@ 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; - static int every_16 = 0; + static int every_512 = 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++; + if ((GLState::available_vram < 0) && (every_512 % 512 == 0)) { + fprintf(stderr, "Available VRAM is very low (%lld), a crash is expected ! Disable Larger framebuffer or reduce upscaling!\n", GLState::available_vram); + every_512++; + // Pull emergency break + throw GSDXErrorOOM(); } // Generate & Allocate the buffer