mirror of https://github.com/PCSX2/pcsx2.git
gsdx ogl: only print an error when VRAM is low
Until a better solution is found or people buy better GPU :)
This commit is contained in:
parent
a2086ed458
commit
a37cd40ce3
|
@ -57,7 +57,7 @@ namespace GLState {
|
||||||
GLuint program;
|
GLuint program;
|
||||||
GLuint pipeline;
|
GLuint pipeline;
|
||||||
|
|
||||||
uint64 available_vram;
|
int64 available_vram;
|
||||||
|
|
||||||
void Clear() {
|
void Clear() {
|
||||||
fbo = 0;
|
fbo = 0;
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace GLState {
|
||||||
extern GLuint program;
|
extern GLuint program;
|
||||||
extern GLuint pipeline;
|
extern GLuint pipeline;
|
||||||
|
|
||||||
extern uint64 available_vram;
|
extern int64 available_vram;
|
||||||
|
|
||||||
extern void Clear();
|
extern void Clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,17 +499,23 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
||||||
// ****************************************************************
|
// ****************************************************************
|
||||||
GLint vram[4] = {0};
|
GLint vram[4] = {0};
|
||||||
if (GLLoader::fglrx_buggy_driver) {
|
if (GLLoader::fglrx_buggy_driver) {
|
||||||
|
// Full vram, remove a small margin for others buffer
|
||||||
glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, vram);
|
glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, vram);
|
||||||
|
if (vram[0] > 200000)
|
||||||
|
vram[0] -= 128 * 1024;
|
||||||
|
|
||||||
} else if (GLLoader::found_GL_NVX_gpu_memory_info) {
|
} 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);
|
glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, vram);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stdout, "No extenstion supported to get available memory. Use default value !\n");
|
fprintf(stdout, "No extenstion supported to get available memory. Use default value !\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vram[0] > 200000)
|
if (vram[0] > 0)
|
||||||
GLState::available_vram = (uint64)(vram[0] - 200000) * 1024ul;
|
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
|
// Finish window setup and backbuffer
|
||||||
|
|
|
@ -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;
|
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 !
|
static int every_16 = 0;
|
||||||
} else {
|
GLState::available_vram -= m_mem_usage;
|
||||||
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
|
// Generate & Allocate the buffer
|
||||||
|
|
Loading…
Reference in New Issue