glx: Remove ->forceCurrent from the context vtable
All the implementations of makeCurrent and forceCurrent are identical, so just use makeCurrent everywhere. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
		
							parent
							
								
									a48dadc98a
								
							
						
					
					
						commit
						c327d07cc6
					
				| 
						 | 
					@ -53,8 +53,6 @@ struct __GLXcontext {
 | 
				
			||||||
    int            (*copy)          (__GLXcontext *dst,
 | 
					    int            (*copy)          (__GLXcontext *dst,
 | 
				
			||||||
				     __GLXcontext *src,
 | 
									     __GLXcontext *src,
 | 
				
			||||||
				     unsigned long mask);
 | 
									     unsigned long mask);
 | 
				
			||||||
    int            (*forceCurrent)  (__GLXcontext *context);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Bool           (*wait)          (__GLXcontext *context,
 | 
					    Bool           (*wait)          (__GLXcontext *context,
 | 
				
			||||||
				     __GLXclientState *cl,
 | 
									     __GLXclientState *cl,
 | 
				
			||||||
				     int *error);
 | 
									     int *error);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								glx/glxdri.c
								
								
								
								
							
							
						
						
									
										14
									
								
								glx/glxdri.c
								
								
								
								
							| 
						 | 
					@ -335,19 +335,6 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
 | 
				
			||||||
					src->driContext, mask);
 | 
										src->driContext, mask);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					 | 
				
			||||||
__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
 | 
					 | 
				
			||||||
    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
 | 
					 | 
				
			||||||
    __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
 | 
					 | 
				
			||||||
    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return (*screen->core->bindContext)(context->driContext,
 | 
					 | 
				
			||||||
					draw->driDrawable,
 | 
					 | 
				
			||||||
					read->driDrawable);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
glxFillAlphaChannel (CARD32 *pixels, CARD32 rowstride, int width, int height)
 | 
					glxFillAlphaChannel (CARD32 *pixels, CARD32 rowstride, int width, int height)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -641,7 +628,6 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 | 
				
			||||||
    context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
 | 
					    context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
 | 
				
			||||||
    context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
 | 
					    context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
 | 
				
			||||||
    context->base.copy              = __glXDRIcontextCopy;
 | 
					    context->base.copy              = __glXDRIcontextCopy;
 | 
				
			||||||
    context->base.forceCurrent      = __glXDRIcontextForceCurrent;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
 | 
					    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
 | 
				
			||||||
    /* Find the requested X visual */
 | 
					    /* Find the requested X visual */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -283,19 +283,6 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
 | 
				
			||||||
					src->driContext, mask);
 | 
										src->driContext, mask);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					 | 
				
			||||||
__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
 | 
					 | 
				
			||||||
    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
 | 
					 | 
				
			||||||
    __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
 | 
					 | 
				
			||||||
    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return (*screen->core->bindContext)(context->driContext,
 | 
					 | 
				
			||||||
					draw->driDrawable,
 | 
					 | 
				
			||||||
					read->driDrawable);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static Bool
 | 
					static Bool
 | 
				
			||||||
__glXDRIcontextWait(__GLXcontext *baseContext,
 | 
					__glXDRIcontextWait(__GLXcontext *baseContext,
 | 
				
			||||||
		    __GLXclientState *cl, int *error)
 | 
							    __GLXclientState *cl, int *error)
 | 
				
			||||||
| 
						 | 
					@ -411,7 +398,6 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 | 
				
			||||||
    context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
 | 
					    context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
 | 
				
			||||||
    context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
 | 
					    context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
 | 
				
			||||||
    context->base.copy              = __glXDRIcontextCopy;
 | 
					    context->base.copy              = __glXDRIcontextCopy;
 | 
				
			||||||
    context->base.forceCurrent      = __glXDRIcontextForceCurrent;
 | 
					 | 
				
			||||||
    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
 | 
					    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
 | 
				
			||||||
    context->base.wait              = __glXDRIcontextWait;
 | 
					    context->base.wait              = __glXDRIcontextWait;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -174,19 +174,6 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
 | 
				
			||||||
					src->driContext, mask);
 | 
										src->driContext, mask);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					 | 
				
			||||||
__glXDRIcontextForceCurrent(__GLXcontext *baseContext)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
 | 
					 | 
				
			||||||
    __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
 | 
					 | 
				
			||||||
    __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
 | 
					 | 
				
			||||||
    __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return (*screen->core->bindContext)(context->driContext,
 | 
					 | 
				
			||||||
					draw->driDrawable,
 | 
					 | 
				
			||||||
					read->driDrawable);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef __DRI_TEX_BUFFER
 | 
					#ifdef __DRI_TEX_BUFFER
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
| 
						 | 
					@ -289,7 +276,6 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 | 
				
			||||||
    context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
 | 
					    context->base.makeCurrent       = __glXDRIcontextMakeCurrent;
 | 
				
			||||||
    context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
 | 
					    context->base.loseCurrent       = __glXDRIcontextLoseCurrent;
 | 
				
			||||||
    context->base.copy              = __glXDRIcontextCopy;
 | 
					    context->base.copy              = __glXDRIcontextCopy;
 | 
				
			||||||
    context->base.forceCurrent      = __glXDRIcontextForceCurrent;
 | 
					 | 
				
			||||||
    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
 | 
					    context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context->driContext =
 | 
					    context->driContext =
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -420,7 +420,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Make this context the current one for the GL. */
 | 
					    /* Make this context the current one for the GL. */
 | 
				
			||||||
    if (!cx->isDirect) {
 | 
					    if (!cx->isDirect) {
 | 
				
			||||||
	if (!(*cx->forceCurrent)(cx)) {
 | 
						if (!(*cx->makeCurrent)(cx)) {
 | 
				
			||||||
	    /* Bind failed, and set the error code.  Bummer */
 | 
						    /* Bind failed, and set the error code.  Bummer */
 | 
				
			||||||
	    cl->client->errorValue = cx->id;
 | 
						    cl->client->errorValue = cx->id;
 | 
				
			||||||
	    *error = __glXError(GLXBadContextState);
 | 
						    *error = __glXError(GLXBadContextState);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -174,7 +174,6 @@ static __GLXdrawable * __glXAquaScreenCreateDrawable(ClientPtr client, __GLXscre
 | 
				
			||||||
static void __glXAquaContextDestroy(__GLXcontext *baseContext);
 | 
					static void __glXAquaContextDestroy(__GLXcontext *baseContext);
 | 
				
			||||||
static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext);
 | 
					static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext);
 | 
				
			||||||
static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext);
 | 
					static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext);
 | 
				
			||||||
static int __glXAquaContextForceCurrent(__GLXcontext *baseContext);
 | 
					 | 
				
			||||||
static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask);
 | 
					static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static CGLPixelFormatObj makeFormat(__GLXconfig *conf);
 | 
					static CGLPixelFormatObj makeFormat(__GLXconfig *conf);
 | 
				
			||||||
| 
						 | 
					@ -235,7 +234,6 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
 | 
				
			||||||
    context->base.makeCurrent    = __glXAquaContextMakeCurrent;
 | 
					    context->base.makeCurrent    = __glXAquaContextMakeCurrent;
 | 
				
			||||||
    context->base.loseCurrent    = __glXAquaContextLoseCurrent;
 | 
					    context->base.loseCurrent    = __glXAquaContextLoseCurrent;
 | 
				
			||||||
    context->base.copy           = __glXAquaContextCopy;
 | 
					    context->base.copy           = __glXAquaContextCopy;
 | 
				
			||||||
    context->base.forceCurrent   = __glXAquaContextForceCurrent;
 | 
					 | 
				
			||||||
    /*FIXME verify that the context->base is fully initialized. */
 | 
					    /*FIXME verify that the context->base is fully initialized. */
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    context->pixelFormat = makeFormat(conf);
 | 
					    context->pixelFormat = makeFormat(conf);
 | 
				
			||||||
| 
						 | 
					@ -458,19 +456,6 @@ static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, un
 | 
				
			||||||
    return gl_err == 0;
 | 
					    return gl_err == 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int __glXAquaContextForceCurrent(__GLXcontext *baseContext)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    CGLError gl_err;
 | 
					 | 
				
			||||||
    __GLXAquaContext *context = (__GLXAquaContext *) baseContext;
 | 
					 | 
				
			||||||
    GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx %p)\n", context->ctx);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    gl_err = CGLSetCurrentContext(context->ctx);
 | 
					 | 
				
			||||||
    if (gl_err != 0)
 | 
					 | 
				
			||||||
        ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return gl_err == 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Drawing surface notification callbacks */
 | 
					/* Drawing surface notification callbacks */
 | 
				
			||||||
static GLboolean __glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base) {
 | 
					static GLboolean __glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base) {
 | 
				
			||||||
    CGLError err;
 | 
					    CGLError err;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1480,13 +1480,6 @@ glxWinContextCopy(__GLXcontext *dst_base, __GLXcontext *src_base, unsigned long
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					 | 
				
			||||||
glxWinContextForceCurrent(__GLXcontext *base)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  /* wglMakeCurrent always flushes the previous context, so this is equivalent to glxWinContextMakeCurrent */
 | 
					 | 
				
			||||||
  return glxWinContextMakeCurrent(base);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
glxWinContextDestroy(__GLXcontext *base)
 | 
					glxWinContextDestroy(__GLXcontext *base)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -1541,7 +1534,6 @@ glxWinCreateContext(__GLXscreen *screen,
 | 
				
			||||||
    context->base.makeCurrent    = glxWinContextMakeCurrent;
 | 
					    context->base.makeCurrent    = glxWinContextMakeCurrent;
 | 
				
			||||||
    context->base.loseCurrent    = glxWinContextLoseCurrent;
 | 
					    context->base.loseCurrent    = glxWinContextLoseCurrent;
 | 
				
			||||||
    context->base.copy           = glxWinContextCopy;
 | 
					    context->base.copy           = glxWinContextCopy;
 | 
				
			||||||
    context->base.forceCurrent   = glxWinContextForceCurrent;
 | 
					 | 
				
			||||||
    context->base.textureFromPixmap = &glxWinTextureFromPixmap;
 | 
					    context->base.textureFromPixmap = &glxWinTextureFromPixmap;
 | 
				
			||||||
    context->base.config = modes;
 | 
					    context->base.config = modes;
 | 
				
			||||||
    context->base.pGlxScreen = screen;
 | 
					    context->base.pGlxScreen = screen;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue