glx: Return the right GLX opcode in synthetic MakeCurrent errors
If you're trying to figure out why an operation failed it helps if the error matches the function you thought you called. Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10381>
This commit is contained in:
+17
-14
@@ -172,7 +172,8 @@ glXGetCurrentDrawable(void)
|
||||
*/
|
||||
static Bool
|
||||
MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
||||
GLXDrawable read, GLXContext gc_user)
|
||||
GLXDrawable read, GLXContext gc_user,
|
||||
int opcode)
|
||||
{
|
||||
struct glx_context *gc = (struct glx_context *) gc_user;
|
||||
struct glx_context *oldGC = __glXGetCurrentContext();
|
||||
@@ -197,7 +198,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
||||
/* can't have only one be 0 */
|
||||
if (!!draw != !!read) {
|
||||
__glXUnlock();
|
||||
__glXSendError(dpy, BadMatch, None, X_GLXMakeContextCurrent, True);
|
||||
__glXSendError(dpy, BadMatch, None, opcode, True);
|
||||
return False;
|
||||
}
|
||||
|
||||
@@ -220,8 +221,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
||||
if (gc->vtable->bind(gc, oldGC, draw, read) != Success) {
|
||||
__glXSetCurrentContextNull();
|
||||
__glXUnlock();
|
||||
__glXSendError(dpy, GLXBadContext, None, X_GLXMakeContextCurrent,
|
||||
False);
|
||||
__glXSendError(dpy, GLXBadContext, None, opcode, False);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -248,19 +248,22 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
_GLX_PUBLIC Bool
|
||||
glXMakeCurrent(Display * dpy, GLXDrawable draw, GLXContext gc)
|
||||
{
|
||||
return MakeContextCurrent(dpy, draw, draw, gc);
|
||||
return MakeContextCurrent(dpy, draw, draw, gc, X_GLXMakeCurrent);
|
||||
}
|
||||
|
||||
_GLX_PUBLIC
|
||||
GLX_ALIAS(Bool, glXMakeCurrentReadSGI,
|
||||
(Display * dpy, GLXDrawable d, GLXDrawable r, GLXContext ctx),
|
||||
(dpy, d, r, ctx), MakeContextCurrent)
|
||||
_GLX_PUBLIC Bool
|
||||
glXMakeContextCurrent(Display *dpy, GLXDrawable d, GLXDrawable r,
|
||||
GLXContext ctx)
|
||||
{
|
||||
return MakeContextCurrent(dpy, d, r, ctx, X_GLXMakeContextCurrent);
|
||||
}
|
||||
|
||||
_GLX_PUBLIC
|
||||
GLX_ALIAS(Bool, glXMakeContextCurrent,
|
||||
(Display * dpy, GLXDrawable d, GLXDrawable r,
|
||||
GLXContext ctx), (dpy, d, r, ctx), MakeContextCurrent)
|
||||
_GLX_PUBLIC Bool
|
||||
glXMakeCurrentReadSGI(Display *dpy, GLXDrawable d, GLXDrawable r,
|
||||
GLXContext ctx)
|
||||
{
|
||||
return MakeContextCurrent(dpy, d, r, ctx, X_GLXvop_MakeCurrentReadSGI);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user