mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Test alternative functions for binding contexts on GL
This commit is contained in:
@@ -181,6 +181,9 @@ void main()
|
||||
}
|
||||
#endif
|
||||
|
||||
ActivateContext(NULL, NULL);
|
||||
ActivateContext(mainWindow, mainContext, true);
|
||||
|
||||
while(Running())
|
||||
{
|
||||
// trash the texture pack/unpack state
|
||||
|
||||
@@ -40,7 +40,7 @@ struct OpenGLGraphicsTest : public GraphicsTest
|
||||
GraphicsWindow *MakeWindow(int width, int height, const char *title);
|
||||
void *MakeContext(GraphicsWindow *win, void *share);
|
||||
void DestroyContext(void *ctx);
|
||||
void ActivateContext(GraphicsWindow *win, void *ctx);
|
||||
void ActivateContext(GraphicsWindow *win, void *ctx, bool alt = false);
|
||||
|
||||
void PostInit();
|
||||
|
||||
|
||||
@@ -224,18 +224,24 @@ void OpenGLGraphicsTest::DestroyContext(void *ctx)
|
||||
glXDestroyContext(x11win->xlib.display, (GLXContext)ctx);
|
||||
}
|
||||
|
||||
void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx)
|
||||
void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx, bool alt)
|
||||
{
|
||||
X11Window *x11win = (X11Window *)win;
|
||||
|
||||
if(ctx == NULL)
|
||||
{
|
||||
glXMakeContextCurrent(x11win->xlib.display, (GLXDrawable)NULL, (GLXDrawable)NULL, NULL);
|
||||
if(glXMakeCurrent && alt)
|
||||
glXMakeCurrent(x11win->xlib.display, (GLXDrawable)NULL, NULL);
|
||||
else
|
||||
glXMakeContextCurrent(x11win->xlib.display, (GLXDrawable)NULL, (GLXDrawable)NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
glXMakeContextCurrent(x11win->xlib.display, x11win->xlib.window, x11win->xlib.window,
|
||||
(GLXContext)ctx);
|
||||
if(glXMakeCurrent && alt)
|
||||
glXMakeCurrent(x11win->xlib.display, x11win->xlib.window, (GLXContext)ctx);
|
||||
else
|
||||
glXMakeContextCurrent(x11win->xlib.display, x11win->xlib.window, x11win->xlib.window,
|
||||
(GLXContext)ctx);
|
||||
}
|
||||
|
||||
void OpenGLGraphicsTest::Present(GraphicsWindow *window)
|
||||
|
||||
@@ -258,11 +258,14 @@ void OpenGLGraphicsTest::DestroyContext(void *ctx)
|
||||
deleteContext((HGLRC)ctx);
|
||||
}
|
||||
|
||||
void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx)
|
||||
void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx, bool alt)
|
||||
{
|
||||
if(ctx == NULL)
|
||||
{
|
||||
makeCurrent(NULL, NULL);
|
||||
if(alt && wglMakeContextCurrentARB)
|
||||
wglMakeContextCurrentARB(NULL, NULL, NULL);
|
||||
else
|
||||
makeCurrent(NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -270,7 +273,10 @@ void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx)
|
||||
|
||||
HDC dc = GetDC(win32win->wnd);
|
||||
|
||||
makeCurrent(dc, (HGLRC)ctx);
|
||||
if(alt && wglMakeContextCurrentARB)
|
||||
wglMakeContextCurrentARB(dc, dc, (HGLRC)ctx);
|
||||
else
|
||||
makeCurrent(dc, (HGLRC)ctx);
|
||||
|
||||
ReleaseDC(win32win->wnd, dc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user