mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-24 22:55:41 +00:00
Implement debug device/debug api message tracking for GL
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user