From bb5c84fcbc22b4fef28cf4589d6410eb3c35a496 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 Jul 2005 01:22:25 +0000 Subject: [PATCH] Remove NEW_RENDERBUFFER stuff. Now, OLD_RENDERBUFFER marks code that needs to eventually be removed when all the drivers are updated to no longer need the SetBuffer() function. --- src/mesa/drivers/x11/xm_api.c | 14 +++++++------- src/mesa/drivers/x11/xm_dd.c | 8 -------- src/mesa/main/config.h | 5 ++--- src/mesa/main/context.c | 6 +----- src/mesa/main/mtypes.h | 2 +- src/mesa/swrast/s_buffers.c | 2 +- src/mesa/swrast/s_context.c | 2 -- src/mesa/swrast/s_drawpix.c | 2 -- src/mesa/swrast/s_logic.c | 2 +- src/mesa/swrast/s_span.c | 8 ++++---- src/mesa/swrast/swrast.h | 2 +- 11 files changed, 18 insertions(+), 35 deletions(-) diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index f710a298664..bd8b9e6c7b3 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1204,9 +1204,7 @@ static GLboolean initialize_visual_and_buffer( int client, XMesaDrawable window, XMesaColormap cmap ) { -#if NEW_RENDERBUFFER struct xmesa_renderbuffer *front_xrb, *back_xrb; -#endif #ifndef XFree86Server XGCValues gcvalues; #endif @@ -1215,7 +1213,6 @@ static GLboolean initialize_visual_and_buffer( int client, assert(b->xm_visual == v); } -#if NEW_RENDERBUFFER if (b) { front_xrb = b->frontxrb; back_xrb = b->backxrb; @@ -1223,7 +1220,6 @@ static GLboolean initialize_visual_and_buffer( int client, else { front_xrb = back_xrb = NULL; } -#endif /* Save true bits/pixel */ v->BitsPerPixel = bits_per_pixel(v); @@ -2637,8 +2633,12 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y, */ void XMesaResizeBuffers( XMesaBuffer b ) { -#if OLD_RENDERBUFFER - xmesa_resize_buffers(ctx, &(b->mesa_buffer), 0, 0 ); -#endif + Window root; + int xpos, ypos; + unsigned int width, height, bw, depth; + GET_CURRENT_CONTEXT(ctx); + XGetGeometry( b->xm_visual->display, b->frontxrb->pixmap, + &root, &xpos, &ypos, &width, &height, &bw, &depth); + xmesa_resize_buffers(ctx, &(b->mesa_buffer), width, height); } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 201880d5cc8..7ab09d444d6 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -563,9 +563,7 @@ xmesa_resize_buffers(GLcontext *ctx, GLframebuffer *buffer, xmesa_alloc_back_buffer(xmBuffer, width, height); -#if NEW_RENDERBUFFER _mesa_resize_framebuffer(ctx, buffer, width, height); -#endif } @@ -1022,12 +1020,6 @@ xmesa_update_state( GLcontext *ctx, GLuint new_state ) } } -#if OLD_RENDERBUFFER && 0 - if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) { - xmesa_update_span_funcs(ctx); - } -#endif - if (xmesa->xm_visual->hpcr_clear_flag) { /* this depends on whether we're drawing to the front or back buffer */ /* XXX FIX THIS! */ diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 476ed63aadc..719c68e3000 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -322,9 +322,8 @@ #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) -/* XXX these are temporary */ -#define NEW_RENDERBUFFER 1 -#define OLD_RENDERBUFFER 0 +/* XXX everything marked with OLD_RENDERBUFFER will be going away... */ +#define OLD_RENDERBUFFER 1 #endif /* CONFIG_H */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 2c444c80d8a..ba8a456248c 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1555,7 +1555,6 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, if (drawBuffer && readBuffer) { /* TODO: check if newCtx and buffer's visual match??? */ -#if NEW_RENDERBUFFER ASSERT(drawBuffer->Name == 0); ASSERT(readBuffer->Name == 0); newCtx->WinSysDrawBuffer = drawBuffer; @@ -1565,10 +1564,7 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, newCtx->DrawBuffer = drawBuffer; newCtx->ReadBuffer = readBuffer; } -#else - newCtx->DrawBuffer = drawBuffer; - newCtx->ReadBuffer = readBuffer; -#endif + newCtx->NewState |= _NEW_BUFFERS; #if _HAVE_FULL_GL diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 1733c43bce0..655e30336af 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2184,7 +2184,7 @@ struct gl_framebuffer struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS][4]; struct gl_renderbuffer *_ColorReadBuffer; -#if OLD_RENDERBUFFER || NEW_RENDERBUFFER +#if OLD_RENDERBUFFER /* XXX THIS IS TEMPORARY */ GLuint _ColorDrawBit[MAX_DRAW_BUFFERS][4]; #endif diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c index e7889008972..7af9d9d5134 100644 --- a/src/mesa/swrast/s_buffers.c +++ b/src/mesa/swrast/s_buffers.c @@ -234,7 +234,7 @@ clear_color_buffers(GLcontext *ctx) for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers[0]; i++) { struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][i]; -#if OLD_RENDERBUFFER || NEW_RENDERBUFFER +#if OLD_RENDERBUFFER /* SetBuffer will go away */ if (swrast->Driver.SetBuffer) swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer, diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 4a4d1b880a3..5c57b42d6cb 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -88,9 +88,7 @@ _swrast_update_rasterflags( GLcontext *ctx ) * MULTI_DRAW_BIT flag. Also set it if we're drawing to no * buffers or the RGBA or CI mask disables all writes. */ -#if NEW_RENDERBUFFER if (ctx->DrawBuffer->_NumColorDrawBuffers[0] != 1) { -#endif /* more than one color buffer designated for writing (or zero buffers) */ rasterMask |= MULTI_DRAW_BIT; } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 9d231472c21..709f9a13c71 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -51,9 +51,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels) { -#if NEW_RENDERBUFFER struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; -#endif SWcontext *swrast = SWRAST_CONTEXT(ctx); struct sw_span span; diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c index 56bc01203a8..05e2e0ade47 100644 --- a/src/mesa/swrast/s_logic.c +++ b/src/mesa/swrast/s_logic.c @@ -224,7 +224,7 @@ _swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, _swrast_read_rgba_span(ctx, rb, span->end, span->x, span->y, dest); } - /* NEW_RENDERBUFFER: XXX make this a runtime test */ + /* XXX make this a runtime test */ #if CHAN_TYPE == GL_UNSIGNED_BYTE /* treat 4*GLubyte as GLuint */ logicop_uint(ctx, span->end, (GLuint *) rgba, diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 3a6e7195b1b..aec9a999127 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -987,7 +987,7 @@ _swrast_write_index_span( GLcontext *ctx, struct sw_span *span) } } -#if OLD_RENDERBUFFER || NEW_RENDERBUFFER +#if OLD_RENDERBUFFER /* restore default dest buffer */ _swrast_use_draw_buffer(ctx); #endif @@ -1033,7 +1033,7 @@ add_colors(GLuint n, GLchan rgba[][4], GLchan specular[][4] ) static void multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) { -#if OLD_RENDERBUFFER || NEW_RENDERBUFFER +#if OLD_RENDERBUFFER SWcontext *swrast = SWRAST_CONTEXT(ctx); #endif const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); @@ -1048,7 +1048,7 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[output][i]; GLchan rgbaTmp[MAX_WIDTH][4]; -#if OLD_RENDERBUFFER || NEW_RENDERBUFFER +#if OLD_RENDERBUFFER /* obsolete code */ GLuint bufferBit = fb->_ColorDrawBit[output][i]; /* Set the current read/draw buffer */ @@ -1085,7 +1085,7 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) } } -#if OLD_RENDERBUFFER || NEW_RENDERBUFFER +#if OLD_RENDERBUFFER /* restore default dest buffer */ _swrast_use_draw_buffer(ctx); #endif diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 3aa30d35318..299eda5dc3e 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -257,7 +257,7 @@ _swrast_copy_texsubimage3d(GLcontext *ctx, * Unless otherwise noted, all functions are mandatory. */ struct swrast_device_driver { -#if OLD_RENDERBUFFER || NEW_RENDERBUFFER +#if OLD_RENDERBUFFER void (*SetBuffer)(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit); /* * Specifies the current color buffer for span/pixel writing/reading. -- 2.30.2