GL/ContextGLX: Add additional logging

This commit is contained in:
Connor McLaughlin 2020-07-15 15:50:30 +10:00
parent dd9a4191e6
commit 71cef1de3f
2 changed files with 14 additions and 3 deletions

View file

@ -15,6 +15,9 @@ ContextGLX::~ContextGLX()
if (m_context)
glXDestroyContext(GetDisplay(), m_context);
if (m_vi)
XFree(m_vi);
if (m_libGL_handle)
dlclose(m_libGL_handle);
}
@ -242,14 +245,14 @@ bool ContextGLX::CreateWindow(int screen)
return false;
}
const XVisualInfo* vi = glXGetVisualFromFBConfig(GetDisplay(), m_fb_config);
if (!vi)
m_vi = glXGetVisualFromFBConfig(GetDisplay(), m_fb_config);
if (!m_vi)
{
Log_ErrorPrintf("glXGetVisualFromFBConfig() failed");
return false;
}
return m_window.Create(GetDisplay(), static_cast<Window>(reinterpret_cast<uintptr_t>(m_wi.window_handle)), vi);
return m_window.Create(GetDisplay(), static_cast<Window>(reinterpret_cast<uintptr_t>(m_wi.window_handle)), m_vi);
}
bool ContextGLX::CreateAnyContext(GLXContext share_context, bool make_current)

View file

@ -1,6 +1,9 @@
#include "x11_window.h"
#include "../assert.h"
#include "../log.h"
#include <cstdio>
Log_SetChannel(X11Window);
namespace GL {
X11Window::X11Window() = default;
@ -87,6 +90,11 @@ X11InhibitErrors::~X11InhibitErrors()
int X11InhibitErrors::ErrorHandler(Display* display, XErrorEvent* ee)
{
char error_string[256] = {};
XGetErrorText(display, ee->error_code, error_string, sizeof(error_string));
Log_WarningPrintf("X11 Error: %s (Error %u Minor %u Request %u)", error_string, ee->error_code, ee->minor_code,
ee->request_code);
s_current_error_inhibiter->m_had_error = true;
return 0;
}