Implement debug device/debug api message tracking for GL

This commit is contained in:
baldurk
2014-11-02 10:52:24 +00:00
parent a4fe8e3261
commit 6308d78cd4
9 changed files with 295 additions and 14 deletions
+41 -1
View File
@@ -328,7 +328,47 @@ void glXDestroyContext(Display *dpy, GLXContext ctx)
__attribute__ ((visibility ("default")))
GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, GLXContext shareList, Bool direct, const int *attribList)
{
GLXContext ret = OpenGLHook::glhooks.glXCreateContextAttribsARB_real(dpy, config, shareList, direct, attribList);
const int *attribs = attribList;
vector<int> attribVec;
if(RenderDoc::Inst().GetCaptureOptions().DebugDeviceMode)
{
bool flagsNext = false;
bool flagsFound = false;
const int *a = attribList;
while(*a)
{
int val = *a;
if(flagsNext)
{
val |= GLX_CONTEXT_DEBUG_BIT_ARB;
flagsNext = false;
}
if(val == GLX_CONTEXT_FLAGS_ARB)
{
flagsNext = true;
flagsFound = true;
}
attribVec.push_back(val);
a++;
}
if(!flagsFound)
{
attribVec.push_back(GLX_CONTEXT_FLAGS_ARB);
attribVec.push_back(GLX_CONTEXT_DEBUG_BIT_ARB);
}
attribVec.push_back(0);
attribs = &attribVec[0];
}
GLXContext ret = OpenGLHook::glhooks.glXCreateContextAttribsARB_real(dpy, config, shareList, direct, attribs);
XVisualInfo *vis = OpenGLHook::glhooks.glXGetVisualFromFBConfig_real(dpy, config);
+41 -1
View File
@@ -333,8 +333,48 @@ class OpenGLHook : LibraryHook
static HGLRC WINAPI wglCreateContextAttribsARB_hooked(HDC dc, HGLRC hShareContext, const int *attribList)
{
HGLRC ret = glhooks.wglCreateContextAttribsARB_realfunc(dc, hShareContext, attribList);
const int *attribs = attribList;
vector<int> attribVec;
if(RenderDoc::Inst().GetCaptureOptions().DebugDeviceMode)
{
bool flagsNext = false;
bool flagsFound = false;
const int *a = attribList;
while(*a)
{
int val = *a;
if(flagsNext)
{
val |= WGL_CONTEXT_DEBUG_BIT_ARB;
flagsNext = false;
}
if(val == WGL_CONTEXT_FLAGS_ARB)
{
flagsNext = true;
flagsFound = true;
}
attribVec.push_back(val);
a++;
}
if(!flagsFound)
{
attribVec.push_back(WGL_CONTEXT_FLAGS_ARB);
attribVec.push_back(WGL_CONTEXT_DEBUG_BIT_ARB);
}
attribVec.push_back(0);
attribs = &attribVec[0];
}
HGLRC ret = glhooks.wglCreateContextAttribsARB_realfunc(dc, hShareContext, attribs);
glhooks.GetDriver()->CreateContext(WindowFromDC(dc), ret, hShareContext, GetInitParamsForDC(dc));
return ret;