Don't update context parameters when MakeCurrent is called with NULL

This commit is contained in:
baldurk
2018-09-10 10:49:54 +01:00
parent 4dea565a61
commit c9c51b5a3e
4 changed files with 26 additions and 17 deletions
+6 -3
View File
@@ -126,9 +126,12 @@ CGLError GL_EXPORT_NAME(CGLSetCurrentContext)(CGLContextObj ctx)
cglhook.driver.ActivateContext(data);
GLInitParams &params = cglhook.driver.GetInitParams(data);
params.width = 400;
params.height = 200;
if(data.ctx)
{
GLInitParams &params = cglhook.driver.GetInitParams(data);
params.width = 400;
params.height = 200;
}
}
return ret;
+16 -13
View File
@@ -295,23 +295,26 @@ HOOK_EXPORT EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay display, EGLSurface
eglhook.driver.ActivateContext(data);
GLInitParams &params = eglhook.driver.GetInitParams(data);
if(ctx && draw)
{
GLInitParams &params = eglhook.driver.GetInitParams(data);
int height, width;
EGL.QuerySurface(display, draw, EGL_HEIGHT, &height);
EGL.QuerySurface(display, draw, EGL_WIDTH, &width);
int height, width;
EGL.QuerySurface(display, draw, EGL_HEIGHT, &height);
EGL.QuerySurface(display, draw, EGL_WIDTH, &width);
int colorspace = 0;
EGL.QuerySurface(display, draw, EGL_GL_COLORSPACE, &colorspace);
// GL_SRGB8_ALPHA8 is specified as color-renderable, unlike GL_SRGB8.
bool isSRGB = params.colorBits == 32 && colorspace == EGL_GL_COLORSPACE_SRGB;
int colorspace = 0;
EGL.QuerySurface(display, draw, EGL_GL_COLORSPACE, &colorspace);
// GL_SRGB8_ALPHA8 is specified as color-renderable, unlike GL_SRGB8.
bool isSRGB = params.colorBits == 32 && colorspace == EGL_GL_COLORSPACE_SRGB;
bool isYFlipped = eglhook.IsYFlipped(display, draw);
bool isYFlipped = eglhook.IsYFlipped(display, draw);
params.width = width;
params.height = height;
params.isSRGB = isSRGB;
params.isYFlipped = isYFlipped;
params.width = width;
params.height = height;
params.isSRGB = isSRGB;
params.isYFlipped = isYFlipped;
}
}
return ret;
+3
View File
@@ -64,6 +64,9 @@ public:
void UpdateWindowSize(GLWindowingData data, Display *dpy, GLXDrawable drawable)
{
if(!data.ctx || !drawable)
return;
// if we use the GLXDrawable in XGetGeometry and it's a GLXWindow, then we get
// a BadDrawable error and things go south. Instead we track GLXWindows created
// in glXCreateWindow/glXDestroyWindow and look up the source window it was
+1 -1
View File
@@ -369,7 +369,7 @@ static BOOL WINAPI wglMakeCurrent_hooked(HDC dc, HGLRC rc)
data.wnd = WindowFromDC(dc);
data.ctx = rc;
if(wglhook.haveContextCreation)
if(wglhook.haveContextCreation && data.ctx && data.wnd)
{
RECT r;
GetClientRect(data.wnd, &r);