diff options
author | Brian Paul <[email protected]> | 2000-11-19 23:10:25 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-11-19 23:10:25 +0000 |
commit | a852378a6289d154364dde440f89a39bbfc33e2d (patch) | |
tree | dbaf6946d80e517a2f0b349a11d1736cde1b83e1 /src/mesa/main/state.c | |
parent | b12d8e3b0ddf6dc56dc866530b66230bdc5d73db (diff) |
Replaced Texture.CurrentD[] with separate Texture.Current1/2/3D vars.
Completely removed the dirty texture object list. Set texObj->Complete
to GL_FALSE to indicate dirty.
Made point/line/triangle/quad SWvertex parameters const.
Minor code clean-ups.
Diffstat (limited to 'src/mesa/main/state.c')
-rw-r--r-- | src/mesa/main/state.c | 153 |
1 files changed, 74 insertions, 79 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index d1dde8c88ed..2439655143e 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.45 2000/11/16 21:05:35 keithw Exp $ */ +/* $Id: state.c,v 1.46 2000/11/19 23:10:25 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -692,7 +692,7 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) static void -_mesa_update_polygon( GLcontext *ctx ) +update_polygon( GLcontext *ctx ) { ctx->_TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK; @@ -726,7 +726,7 @@ _mesa_update_polygon( GLcontext *ctx ) } static void -_mesa_calculate_model_project_matrix( GLcontext *ctx ) +calculate_model_project_matrix( GLcontext *ctx ) { if (!ctx->_NeedEyeCoords) { _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix, @@ -738,7 +738,7 @@ _mesa_calculate_model_project_matrix( GLcontext *ctx ) } static void -_mesa_update_modelview_scale( GLcontext *ctx ) +update_modelview_scale( GLcontext *ctx ) { ctx->_ModelViewInvScale = 1.0F; if (ctx->ModelView.flags & (MAT_FLAG_UNIFORM_SCALE | @@ -759,34 +759,32 @@ _mesa_update_modelview_scale( GLcontext *ctx ) /* Bring uptodate any state that relies on _NeedEyeCoords. */ static void -_mesa_update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords ) +update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords ) { /* Check if the truth-value interpretations of the bitfields have * changed: */ - if ((oldneedeyecoords == 0) != (ctx->_NeedEyeCoords == 0)) - { + if ((oldneedeyecoords == 0) != (ctx->_NeedEyeCoords == 0)) { /* Recalculate all state that depends on _NeedEyeCoords. */ - _mesa_update_modelview_scale(ctx); - _mesa_calculate_model_project_matrix(ctx); + update_modelview_scale(ctx); + calculate_model_project_matrix(ctx); gl_compute_light_positions( ctx ); if (ctx->Driver.LightingSpaceChange) ctx->Driver.LightingSpaceChange( ctx ); } - else - { + else { GLuint new_state = ctx->NewState; /* Recalculate that same state if and only if it has been * invalidated by other statechanges. */ if (new_state & _NEW_MODELVIEW) - _mesa_update_modelview_scale(ctx); + update_modelview_scale(ctx); if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) - _mesa_calculate_model_project_matrix(ctx); + calculate_model_project_matrix(ctx); if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW)) gl_compute_light_positions( ctx ); @@ -795,7 +793,7 @@ _mesa_update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords ) static void -_mesa_update_drawbuffer( GLcontext *ctx ) +update_drawbuffer( GLcontext *ctx ) { ctx->DrawBuffer->_Xmin = 0; ctx->DrawBuffer->_Ymin = 0; @@ -824,7 +822,7 @@ _mesa_update_drawbuffer( GLcontext *ctx ) * uptodate across changes to the Transform attributes. */ static void -_mesa_update_projection( GLcontext *ctx ) +update_projection( GLcontext *ctx ) { _math_matrix_analyze( &ctx->ProjectionMatrix ); @@ -845,6 +843,61 @@ _mesa_update_projection( GLcontext *ctx ) +/* + * Return a bitmask of IMAGE_*_BIT flags which to indicate which + * pixel transfer operations are enabled. + */ +static void +update_image_transfer_state(GLcontext *ctx) +{ + GLuint mask = 0; + + if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F || + ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F || + ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F || + ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F) + mask |= IMAGE_SCALE_BIAS_BIT; + + if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) + mask |= IMAGE_SHIFT_OFFSET_BIT; + + if (ctx->Pixel.MapColorFlag) + mask |= IMAGE_MAP_COLOR_BIT; + + if (ctx->Pixel.ColorTableEnabled) + mask |= IMAGE_COLOR_TABLE_BIT; + + if (ctx->Pixel.Convolution1DEnabled || + ctx->Pixel.Convolution2DEnabled || + ctx->Pixel.Separable2DEnabled) + mask |= IMAGE_CONVOLUTION_BIT; + + if (ctx->Pixel.PostConvolutionColorTableEnabled) + mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT; + + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.PostColorMatrixScale[0] != 1.0F || + ctx->Pixel.PostColorMatrixBias[0] != 0.0F || + ctx->Pixel.PostColorMatrixScale[1] != 1.0F || + ctx->Pixel.PostColorMatrixBias[1] != 0.0F || + ctx->Pixel.PostColorMatrixScale[2] != 1.0F || + ctx->Pixel.PostColorMatrixBias[2] != 0.0F || + ctx->Pixel.PostColorMatrixScale[3] != 1.0F || + ctx->Pixel.PostColorMatrixBias[3] != 0.0F) + mask |= IMAGE_COLOR_MATRIX_BIT; + + if (ctx->Pixel.PostColorMatrixColorTableEnabled) + mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT; + + if (ctx->Pixel.HistogramEnabled) + mask |= IMAGE_HISTOGRAM_BIT; + + if (ctx->Pixel.MinMaxEnabled) + mask |= IMAGE_MIN_MAX_BIT; + + ctx->_ImageTransferState = mask; +} + /* * If ctx->NewState is non-zero then this function MUST be called before @@ -871,7 +924,7 @@ void gl_update_state( GLcontext *ctx ) _math_matrix_analyze( &ctx->ModelView ); if (new_state & _NEW_PROJECTION) - _mesa_update_projection( ctx ); + update_projection( ctx ); if (new_state & _NEW_TEXTURE_MATRIX) _mesa_update_texture_matrices( ctx ); @@ -882,18 +935,18 @@ void gl_update_state( GLcontext *ctx ) /* References ColorMatrix.type (derived above). */ if (new_state & (_NEW_PIXEL|_NEW_COLOR_MATRIX)) - _mesa_update_image_transfer_state(ctx); + update_image_transfer_state(ctx); /* Contributes to NeedEyeCoords, NeedNormals. */ if (new_state & _NEW_TEXTURE) - _mesa_update_textures( ctx ); + _mesa_update_texture_state( ctx ); if (new_state & (_NEW_BUFFERS|_NEW_SCISSOR)) - _mesa_update_drawbuffer( ctx ); + update_drawbuffer( ctx ); if (new_state & _NEW_POLYGON) - _mesa_update_polygon( ctx ); + update_polygon( ctx ); /* Contributes to NeedEyeCoords, NeedNormals. */ @@ -924,7 +977,7 @@ void gl_update_state( GLcontext *ctx ) _TNL_NEW_NORMAL_TRANSFORM | _NEW_LIGHT | _TNL_NEW_NEED_EYE_COORDS)) - _mesa_update_tnl_spaces( ctx, oldneedeyecoords ); + update_tnl_spaces( ctx, oldneedeyecoords ); /* * Here the driver sets up all the ctx->Driver function pointers @@ -935,61 +988,3 @@ void gl_update_state( GLcontext *ctx ) ctx->Driver.UpdateState(ctx); ctx->NewState = 0; } - - - - -/* - * Return a bitmask of IMAGE_*_BIT flags which to indicate which - * pixel transfer operations are enabled. - */ -void -_mesa_update_image_transfer_state(GLcontext *ctx) -{ - GLuint mask = 0; - - if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F || - ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F || - ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F || - ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F) - mask |= IMAGE_SCALE_BIAS_BIT; - - if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) - mask |= IMAGE_SHIFT_OFFSET_BIT; - - if (ctx->Pixel.MapColorFlag) - mask |= IMAGE_MAP_COLOR_BIT; - - if (ctx->Pixel.ColorTableEnabled) - mask |= IMAGE_COLOR_TABLE_BIT; - - if (ctx->Pixel.Convolution1DEnabled || - ctx->Pixel.Convolution2DEnabled || - ctx->Pixel.Separable2DEnabled) - mask |= IMAGE_CONVOLUTION_BIT; - - if (ctx->Pixel.PostConvolutionColorTableEnabled) - mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT; - - if (ctx->ColorMatrix.type != MATRIX_IDENTITY || - ctx->Pixel.PostColorMatrixScale[0] != 1.0F || - ctx->Pixel.PostColorMatrixBias[0] != 0.0F || - ctx->Pixel.PostColorMatrixScale[1] != 1.0F || - ctx->Pixel.PostColorMatrixBias[1] != 0.0F || - ctx->Pixel.PostColorMatrixScale[2] != 1.0F || - ctx->Pixel.PostColorMatrixBias[2] != 0.0F || - ctx->Pixel.PostColorMatrixScale[3] != 1.0F || - ctx->Pixel.PostColorMatrixBias[3] != 0.0F) - mask |= IMAGE_COLOR_MATRIX_BIT; - - if (ctx->Pixel.PostColorMatrixColorTableEnabled) - mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT; - - if (ctx->Pixel.HistogramEnabled) - mask |= IMAGE_HISTOGRAM_BIT; - - if (ctx->Pixel.MinMaxEnabled) - mask |= IMAGE_MIN_MAX_BIT; - - ctx->_ImageTransferState = mask; -} |