mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-25 07:05:48 +00:00
Add a vendor check to detect if FBOs or VAOs are actually shared
* This lets us detect if the FBO/VAO behaviour is different from the main spec, and so we won't miss deletes or other events if the context is different since we'll treat them as shared like any other object.
This commit is contained in:
@@ -298,6 +298,46 @@ class OpenGLHook : LibraryHook
|
||||
if(glXMakeCurrent_real)
|
||||
glXMakeCurrent_real(data.dpy, data.wnd, data.ctx);
|
||||
}
|
||||
|
||||
GLWindowingData MakeContext(GLWindowingData share)
|
||||
{
|
||||
GLWindowingData ret = {0};
|
||||
if(glXCreateContextAttribsARB_real)
|
||||
{
|
||||
const int attribs[] = {
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB,
|
||||
3,
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB,
|
||||
2,
|
||||
GLX_CONTEXT_FLAGS_ARB,
|
||||
0,
|
||||
0, 0,
|
||||
};
|
||||
|
||||
PFNGLXCHOOSEFBCONFIGPROC glXChooseFBConfigProc = (PFNGLXCHOOSEFBCONFIGPROC)dlsym(RTLD_NEXT, "glXChooseFBConfig");
|
||||
|
||||
if(glXChooseFBConfigProc)
|
||||
{
|
||||
// don't need to care about the fb config as we won't be using the default framebuffer (backbuffer)
|
||||
int visAttribs[] = { 0 };
|
||||
int numCfgs = 0;
|
||||
GLXFBConfig *fbcfg = glXChooseFBConfigProc(dpy, DefaultScreen(dpy), visAttribs, &numCfgs);
|
||||
|
||||
if(fbcfg)
|
||||
{
|
||||
ret.dpy = share.dpy;
|
||||
ret.ctx = glXCreateContextAttribsARB_real(share.dpy, fbcfg[0], share.ctx, false, attribs);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DeleteContext(GLWindowingData context)
|
||||
{
|
||||
if(context.ctx && glXDestroyContext_real)
|
||||
glXDestroyContext_real(context.dpy, context.ctx);
|
||||
}
|
||||
|
||||
WrappedOpenGL *GetDriver()
|
||||
{
|
||||
@@ -628,3 +668,13 @@ void MakeContextCurrent(GLWindowingData data)
|
||||
OpenGLHook::glhooks.MakeContextCurrent(data);
|
||||
}
|
||||
|
||||
GLWindowingData MakeContext(GLWindowingData share)
|
||||
{
|
||||
return OpenGLHook::glhooks.MakeContext(share);
|
||||
}
|
||||
|
||||
void DeleteContext(GLWindowingData context)
|
||||
{
|
||||
OpenGLHook::glhooks.DeleteContext(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -258,6 +258,32 @@ class OpenGLHook : LibraryHook
|
||||
if(wglMakeCurrent_hook())
|
||||
wglMakeCurrent_hook()(data.DC, data.ctx);
|
||||
}
|
||||
|
||||
GLWindowingData MakeContext(GLWindowingData share)
|
||||
{
|
||||
GLWindowingData ret = {0};
|
||||
if(wglCreateContextAttribsARB_realfunc)
|
||||
{
|
||||
const int attribs[] = {
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB,
|
||||
3,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB,
|
||||
2,
|
||||
WGL_CONTEXT_FLAGS_ARB,
|
||||
0,
|
||||
0, 0,
|
||||
};
|
||||
ret.DC = share.DC;
|
||||
ret.ctx = wglCreateContextAttribsARB_realfunc(share.DC, share.ctx, attribs);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DeleteContext(GLWindowingData context)
|
||||
{
|
||||
if(context.ctx && wglDeleteContext_hook())
|
||||
wglDeleteContext_hook()(context.ctx);
|
||||
}
|
||||
|
||||
private:
|
||||
WrappedOpenGL *GetDriver()
|
||||
@@ -650,3 +676,13 @@ void MakeContextCurrent(GLWindowingData data)
|
||||
{
|
||||
OpenGLHook::glhooks.MakeContextCurrent(data);
|
||||
}
|
||||
|
||||
GLWindowingData MakeContext(GLWindowingData share)
|
||||
{
|
||||
return OpenGLHook::glhooks.MakeContext(share);
|
||||
}
|
||||
|
||||
void DeleteContext(GLWindowingData context)
|
||||
{
|
||||
OpenGLHook::glhooks.DeleteContext(context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user