From 7f7b205259b228f81442f89e8318829737b08db6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 Sep 2000 21:44:55 +0000 Subject: [PATCH] removed ctx->Driver.Dither function --- src/mesa/drivers/glide/fxdd.c | 17 ----------- src/mesa/drivers/glide/fxsetup.c | 8 ++++- src/mesa/drivers/windows/wmesa.c | 29 ++++++++++-------- src/mesa/drivers/windows/wmesa_stereo.c | 30 ------------------- src/mesa/drivers/x11/xm_dd.c | 39 +++++++++++++------------ src/mesa/main/dd.h | 9 +----- src/mesa/main/state.c | 5 +--- 7 files changed, 47 insertions(+), 90 deletions(-) diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 14c0c5f64ea..1295d6011a4 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -102,21 +102,6 @@ void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder) /***** Miscellaneous functions *****/ /**********************************************************************/ -/* Enalbe/Disable dithering */ -static void fxDDDither(GLcontext *ctx, GLboolean enable) -{ - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDDither()\n"); - } - - if (enable) { - FX_grDitherMode(GR_DITHER_4x4); - } else { - FX_grDitherMode(GR_DITHER_DISABLE); - } -} - - /* Return buffer size information */ static void fxDDBufferSize(GLcontext *ctx, GLuint *width, GLuint *height) { @@ -1099,8 +1084,6 @@ void fxSetupDDPointers(GLcontext *ctx) ctx->Driver.GetString=fxDDGetString; - ctx->Driver.Dither=fxDDDither; - ctx->Driver.NearFar=fxDDSetNearFar; ctx->Driver.GetParameteri=fxDDGetParameteri; diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index b6bbb0c85b6..45be2b84828 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -1406,7 +1406,6 @@ void fxDDColorMask(GLcontext *ctx, fxMesa->new_state |= FX_NEW_COLOR_MASK; ctx->Driver.RenderStart = fxSetupFXUnits; (void) r; (void) g; (void) b; (void) a; - return GL_FALSE; } static void fxSetupColorMask(GLcontext *ctx) @@ -1620,6 +1619,13 @@ void fxDDEnable(GLcontext *ctx, GLenum cap, GLboolean state) ctx->Driver.RenderStart = fxSetupFXUnits; } break; + case GL_DITHER: + if (state) { + FX_grDitherMode(GR_DITHER_4x4); + } else { + FX_grDitherMode(GR_DITHER_DISABLE); + } + break; case GL_SCISSOR_TEST: fxMesa->new_state |= FX_NEW_SCISSOR; ctx->Driver.RenderStart = fxSetupFXUnits; diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c index f0a1c84fe5c..33a8f196310 100644 --- a/src/mesa/drivers/windows/wmesa.c +++ b/src/mesa/drivers/windows/wmesa.c @@ -1,4 +1,4 @@ -/* $Id: wmesa.c,v 1.5 2000/09/07 15:45:28 brianp Exp $ */ +/* $Id: wmesa.c,v 1.6 2000/09/08 21:44:56 brianp Exp $ */ /* * File name : wmesa.c @@ -22,6 +22,9 @@ /* * $Log: wmesa.c,v $ + * Revision 1.6 2000/09/08 21:44:56 brianp + * removed ctx->Driver.Dither function + * * Revision 1.5 2000/09/07 15:45:28 brianp * Removed ctx->Driver.LogicOp(). * ctx->Driver.Index/ColorMask() now return void. @@ -570,24 +573,26 @@ static void set_color( GLcontext* ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte } -static void dither( GLcontext* ctx, GLboolean enable ) +static void enable( GLcontext* ctx, GLenum pname, GLboolean enable ) { if (!Current) return; - if(enable == GL_FALSE){ - Current->dither_flag = GL_FALSE; - if(Current->cColorBits == 8) + if (pname == GL_DITHER) { + if(enable == GL_FALSE){ + Current->dither_flag = GL_FALSE; + if(Current->cColorBits == 8) Current->pixelformat = PF_INDEX8; - } - else{ - if (Current->rgb_flag && Current->cColorBits == 8){ + } + else{ + if (Current->rgb_flag && Current->cColorBits == 8){ Current->pixelformat = PF_DITHER8; Current->dither_flag = GL_TRUE; - } - else + } + else Current->dither_flag = GL_FALSE; - } + } + } } @@ -1165,7 +1170,7 @@ void setup_DD_pointers( GLcontext* ctx ) ctx->Driver.Index = set_index; ctx->Driver.Color = set_color; - ctx->Driver.Dither = dither; + ctx->Driver.Enable = enable; ctx->Driver.SetBuffer = set_buffer; ctx->Driver.GetBufferSize = buffer_size; diff --git a/src/mesa/drivers/windows/wmesa_stereo.c b/src/mesa/drivers/windows/wmesa_stereo.c index fe3c315bd9a..934e6a5f832 100644 --- a/src/mesa/drivers/windows/wmesa_stereo.c +++ b/src/mesa/drivers/windows/wmesa_stereo.c @@ -279,32 +279,6 @@ static void set_color( GLcontext* ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte -/* Set the index mode bitplane mask. */ -static GLboolean index_mask(GLcontext* ctx, GLuint mask) -{ - /* can't implement */ - return GL_FALSE; -} - - - -/* Set the RGBA drawing mask. */ -static GLboolean color_mask( GLcontext* ctx, - GLboolean rmask, GLboolean gmask, - GLboolean bmask, GLboolean amask) -{ - /* can't implement */ - return GL_FALSE; -} - - - -static void dither( GLcontext* ctx, GLboolean enable ) -{ - /* No op */ -} - - static GLboolean set_buffer( GLcontext* ctx, GLenum mode ) { @@ -1031,10 +1005,6 @@ void setup_DD_pointers( GLcontext* ctx ) ctx->Driver.Index = set_index; ctx->Driver.Color = set_color; - ctx->Driver.IndexMask = index_mask; - ctx->Driver.ColorMask = color_mask; - - ctx->Driver.Dither = dither; ctx->Driver.SetBuffer = set_buffer; ctx->Driver.GetBufferSize = buffer_size; diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 271cb13f083..f10684dcf7a 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1,4 +1,4 @@ -/* $Id: xm_dd.c,v 1.1 2000/09/07 15:40:30 brianp Exp $ */ +/* $Id: xm_dd.c,v 1.2 2000/09/08 21:44:57 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -349,22 +349,6 @@ color_mask(GLcontext *ctx, } -/* - * Enable/disable dithering - */ -static void -dither( GLcontext *ctx, GLboolean enable ) -{ - const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - if (enable) { - xmesa->pixelformat = xmesa->xm_visual->dithered_pf; - } - else { - xmesa->pixelformat = xmesa->xm_visual->undithered_pf; - } -} - - /**********************************************************************/ /*** glClear implementations ***/ @@ -920,6 +904,25 @@ get_string( GLcontext *ctx, GLenum name ) } +static void +enable( GLcontext *ctx, GLenum pname, GLboolean state ) +{ + const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + + switch (pname) { + case GL_DITHER: + if (state) + xmesa->pixelformat = xmesa->xm_visual->dithered_pf; + else + xmesa->pixelformat = xmesa->xm_visual->undithered_pf; + break; + default: + ; /* silence compiler warning */ + } +} + + + /* * Initialize all the DD.* function pointers depending on the color * buffer configuration. This is mainly called by XMesaMakeCurrent. @@ -957,7 +960,7 @@ xmesa_update_state( GLcontext *ctx ) ctx->Driver.Clear = clear_buffers; ctx->Driver.IndexMask = index_mask; ctx->Driver.ColorMask = color_mask; - ctx->Driver.Dither = dither; + ctx->Driver.Enable = enable; ctx->Driver.PointsFunc = xmesa_get_points_func( ctx ); ctx->Driver.LineFunc = xmesa_get_line_func( ctx ); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 66a740d4ec6..68982004a2a 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $Id: dd.h,v 1.30 2000/09/07 15:45:27 brianp Exp $ */ +/* $Id: dd.h,v 1.31 2000/09/08 21:44:55 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -336,13 +336,6 @@ struct dd_function_table { * This is called whenever glFlush() is called. */ - void (*Dither)( GLcontext *ctx, GLboolean enable ); - /* - * Enable/disable dithering. - * NOTE: This function will be removed in the future in favor - * of the "Enable" driver function. - */ - void (*Error)( GLcontext *ctx ); /* * Called whenever an error is generated. ctx->ErrorValue contains diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index e9f68398a49..9d95264cbec 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.25 2000/09/08 21:28:04 brianp Exp $ */ +/* $Id: state.c,v 1.26 2000/09/08 21:44:55 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -885,9 +885,6 @@ void gl_update_state( GLcontext *ctx ) if (ctx->NewState & (NEW_RASTER_OPS | NEW_TEXTURE_ENABLE)) { update_fog_mode(ctx); update_rasterflags(ctx); - if (ctx->Driver.Dither) { - (*ctx->Driver.Dither)( ctx, ctx->Color.DitherFlag ); - } /* update scissor region */ ctx->DrawBuffer->Xmin = 0; -- 2.30.2