diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index d18be7fb2f..6b46facbc4 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -289,7 +289,8 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1) #ifdef __LINUX__ // Get the Xwindow from dsp. - s_gs->m_wnd.Attach((void*)((uint32*)(dsp)+1), false); + if( !s_gs->m_wnd.Attach((void*)((uint32*)(dsp)+1), false) ) + return -1; #else s_gs->m_wnd.Attach(*dsp, false); #endif diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 8f7150a8b7..591aafd6a7 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -159,10 +159,11 @@ bool GSDeviceOGL::Create(GSWnd* wnd) } } - m_window = wnd; - // FIXME disable it when code is ready glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); + glDebugMessageCallbackARB(&GSDeviceOGL::DebugCallback, NULL); + + m_window = wnd; // **************************************************************** // Various object @@ -1150,6 +1151,12 @@ void GSDeviceOGL::CompileShaderFromSource(const std::string& glsl_file, const st free(log); } +void GSDeviceOGL::DebugCallback(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, int length, const char* message, void* userParam) +{ + DebugOutputToFile(source, type, id, severity, message); +} + + void GSDeviceOGL::CheckDebugLog() { unsigned int count = 64; // max. num. of messages that will be read from the log diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 4cdc3cc9d4..d6e081db12 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -228,12 +228,6 @@ class GSDeviceOGL : public GSDevice PSConstantBuffer m_ps_cb_cache; #endif - //GLenum frag_back[1] = { GL_BACK }; - //GLenum frag_target[1] = { GL_COLOR_ATTACHMENT0 }: - - void CheckDebugLog(); - void DebugOutputToFile(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, const char* message); - protected: GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format); GSTexture* FetchSurface(int type, int w, int h, bool msaa, int format); @@ -244,6 +238,11 @@ class GSDeviceOGL : public GSDevice GSDeviceOGL(); virtual ~GSDeviceOGL(); + static void DebugCallback(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, int length, const char* message, void* userParam); + void CheckDebugLog(); + static void DebugOutputToFile(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, const char* message); + + bool Create(GSWnd* wnd); bool Reset(int w, int h); void Flip(); diff --git a/plugins/GSdx/GSWnd.cpp b/plugins/GSdx/GSWnd.cpp index f1a93b37ea..27aedd894a 100644 --- a/plugins/GSdx/GSWnd.cpp +++ b/plugins/GSdx/GSWnd.cpp @@ -361,8 +361,9 @@ bool GSWnd::Attach(void* handle, bool managed) { GLX_CONTEXT_MAJOR_VERSION_ARB, 4, GLX_CONTEXT_MINOR_VERSION_ARB, 1, - // FIXME : Request a debug context to ease opengl development - GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB, + // FIXME : Request a debug context to ease opengl development + // Note: don't support deprecated feature (pre openg 3.1) + GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, 0 }; m_context = glXCreateContextAttribsARB(m_XDisplay, fbc[0], 0, true, context_attribs); diff --git a/plugins/GSdx/res/convert.glsl b/plugins/GSdx/res/convert.glsl index 861191a97b..32a91074c0 100644 --- a/plugins/GSdx/res/convert.glsl +++ b/plugins/GSdx/res/convert.glsl @@ -94,6 +94,20 @@ void ps_main6() // diagonal SV_Target0 = c; } +// Avoid to log useless error compilation failure +void ps_main1() +{ +} +void ps_main2() +{ +} +void ps_main3() +{ +} +void ps_main4() +{ +} + //void ps_main1() //{ // vec4 c = sample_c(TEXCOORD);