gsdx-ogl: only open debug file once

This commit is contained in:
Gregory Hainaut 2015-05-17 14:43:56 +02:00
parent 7979dec5b0
commit 5cfb496700
2 changed files with 11 additions and 9 deletions

View File

@ -42,6 +42,7 @@ static const uint32 g_fx_cb_index = 14;
bool GSDeviceOGL::m_debug_gl_call = false; bool GSDeviceOGL::m_debug_gl_call = false;
int GSDeviceOGL::s_n = 0; int GSDeviceOGL::s_n = 0;
FILE* GSDeviceOGL::m_debug_gl_file = NULL;
GSDeviceOGL::GSDeviceOGL() GSDeviceOGL::GSDeviceOGL()
: m_free_window(false) : m_free_window(false)
@ -62,8 +63,7 @@ GSDeviceOGL::GSDeviceOGL()
// Reset the debug file // Reset the debug file
#ifdef ENABLE_OGL_DEBUG #ifdef ENABLE_OGL_DEBUG
FILE* f = fopen("GSdx_opengl_debug.txt","w"); m_debug_gl_file = fopen("GSdx_opengl_debug.txt","w");
fclose(f);
#endif #endif
m_debug_gl_call = theApp.GetConfig("debug_opengl", 0); m_debug_gl_call = theApp.GetConfig("debug_opengl", 0);
@ -71,6 +71,11 @@ GSDeviceOGL::GSDeviceOGL()
GSDeviceOGL::~GSDeviceOGL() GSDeviceOGL::~GSDeviceOGL()
{ {
if (m_debug_gl_file) {
fclose(m_debug_gl_file);
m_debug_gl_file = NULL;
}
// If the create function wasn't called nothing to do. // If the create function wasn't called nothing to do.
if (m_shader == NULL) if (m_shader == NULL)
return; return;
@ -1252,13 +1257,9 @@ void GSDeviceOGL::DebugOutputToFile(GLenum gl_source, GLenum gl_type, GLuint id,
} }
#endif #endif
// FIXME move open/close in constructor/destructor if (m_debug_gl_file)
FILE* f = fopen("GSdx_opengl_debug.txt","a"); fprintf(m_debug_gl_file,"Type:%s\tID:%d\tSeverity:%s\tMessage:%s\n", type.c_str(), s_n, severity.c_str(), message.c_str());
if(f)
{
fprintf(f,"Type:%s\tID:%d\tSeverity:%s\tMessage:%s\n", type.c_str(), s_n, severity.c_str(), message.c_str());
fclose(f);
}
ASSERT(sev_counter < 5); ASSERT(sev_counter < 5);
} }

View File

@ -462,6 +462,7 @@ class GSDeviceOGL : public GSDevice
uint32 m_msaa; // Level of Msaa uint32 m_msaa; // Level of Msaa
static bool m_debug_gl_call; static bool m_debug_gl_call;
static FILE* m_debug_gl_file;
bool m_free_window; bool m_free_window;
GSWnd* m_window; GSWnd* m_window;