diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2000-10-30 13:31:59 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2000-10-30 13:31:59 +0000 |
commit | a96308c37db0bc0086a017d318bc3504aa5f0b1a (patch) | |
tree | 0010de3aa19901acf13b57e57e7ba465abffa95e /src/mesa/main | |
parent | a4575499679d9d91055a35c7673b81872ec127cb (diff) |
Replace the flags Mesa was using for ctx->NewState with a new set
based on the GL attribute groups.
Introduced constants describing the circumstances under which some
key derived values can change:
_SWRAST_NEW_RASTERMASK -- ctx->RasterMask
_SWRAST_NEW_TRIANGLE -- The software rasterizer's triangle
function
_DD_NEW_FEEDBACK -- the 'DD_FEEDBACK' bit in ctx->TriangleCaps
These are helpful in deciding whether you need to recalculate state if your
recalculation involves reference to a derived value.
Diffstat (limited to 'src/mesa/main')
30 files changed, 504 insertions, 518 deletions
diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 315efe932b..a2c8d04880 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -1,4 +1,4 @@ -/* $Id: accum.c,v 1.29 2000/10/29 18:23:16 brianp Exp $ */ +/* $Id: accum.c,v 1.30 2000/10/30 13:31:59 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -107,6 +107,7 @@ _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) ctx->Accum.ClearColor[1] = CLAMP( green, -1.0, 1.0 ); ctx->Accum.ClearColor[2] = CLAMP( blue, -1.0, 1.0 ); ctx->Accum.ClearColor[3] = CLAMP( alpha, -1.0, 1.0 ); + ctx->NewState |= _NEW_ACCUM; } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 7d4199e27f..bacd2e1ca4 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.30 2000/10/29 18:12:14 brianp Exp $ */ +/* $Id: attrib.c,v 1.31 2000/10/30 13:31:59 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -564,6 +564,7 @@ _mesa_PopAttrib(void) switch (attr->kind) { case GL_ACCUM_BUFFER_BIT: MEMCPY( &ctx->Accum, attr->data, sizeof(struct gl_accum_attrib) ); + ctx->NewState |= _NEW_ACCUM; break; case GL_COLOR_BUFFER_BIT: { @@ -575,6 +576,7 @@ _mesa_PopAttrib(void) GLenum oldLogicOp = ctx->Color.LogicOp; MEMCPY( &ctx->Color, attr->data, sizeof(struct gl_colorbuffer_attrib) ); + ctx->NewState |= _NEW_COLOR; if (ctx->Color.DrawBuffer != oldDrawBuffer) { _mesa_DrawBuffer( ctx->Color.DrawBuffer); } @@ -623,6 +625,7 @@ _mesa_PopAttrib(void) GLfloat oldDepthClear = ctx->Depth.Clear; MEMCPY( &ctx->Depth, attr->data, sizeof(struct gl_depthbuffer_attrib) ); + ctx->NewState |= _NEW_DEPTH; if (ctx->Depth.Test != oldDepthTest && ctx->Driver.Enable) (*ctx->Driver.Enable)( ctx, GL_DEPTH_TEST, ctx->Depth.Test); if (ctx->Depth.Func != oldDepthFunc && ctx->Driver.DepthFunc) @@ -638,15 +641,18 @@ _mesa_PopAttrib(void) const struct gl_enable_attrib *enable; enable = (const struct gl_enable_attrib *) attr->data; pop_enable_group(ctx, enable); + ctx->NewState |= _NEW_ALL; } break; case GL_EVAL_BIT: MEMCPY( &ctx->Eval, attr->data, sizeof(struct gl_eval_attrib) ); + ctx->NewState |= _NEW_EVAL; break; case GL_FOG_BIT: { GLboolean anyChange = (GLboolean) (memcmp( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) ) != 0); MEMCPY( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) ); + ctx->NewState |= _NEW_FOG; if (anyChange && ctx->Driver.Fogfv) { const GLfloat mode = (GLfloat) ctx->Fog.Mode; const GLfloat density = ctx->Fog.Density; @@ -666,6 +672,7 @@ _mesa_PopAttrib(void) break; case GL_HINT_BIT: MEMCPY( &ctx->Hint, attr->data, sizeof(struct gl_hint_attrib) ); + ctx->NewState |= _NEW_HINT; if (ctx->Driver.Hint) { (*ctx->Driver.Hint)( ctx, GL_PERSPECTIVE_CORRECTION_HINT, ctx->Hint.PerspectiveCorrection ); @@ -680,6 +687,7 @@ _mesa_PopAttrib(void) break; case GL_LIGHTING_BIT: MEMCPY( &ctx->Light, attr->data, sizeof(struct gl_light_attrib) ); + ctx->NewState |= _NEW_LIGHT; if (ctx->Driver.Enable) { GLuint i; for (i = 0; i < MAX_LIGHTS; i++) { @@ -700,6 +708,7 @@ _mesa_PopAttrib(void) break; case GL_LINE_BIT: MEMCPY( &ctx->Line, attr->data, sizeof(struct gl_line_attrib) ); + ctx->NewState |= _NEW_LINE; if (ctx->Driver.Enable) { (*ctx->Driver.Enable)( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag ); (*ctx->Driver.Enable)( ctx, GL_LINE_STIPPLE, ctx->Line.StippleFlag ); @@ -715,9 +724,11 @@ _mesa_PopAttrib(void) break; case GL_PIXEL_MODE_BIT: MEMCPY( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) ); + ctx->NewState |= _NEW_PIXEL; break; case GL_POINT_BIT: MEMCPY( &ctx->Point, attr->data, sizeof(struct gl_point_attrib) ); + ctx->NewState |= _NEW_POINT; if (ctx->Driver.Enable) (*ctx->Driver.Enable)( ctx, GL_POINT_SMOOTH, ctx->Point.SmoothFlag ); break; @@ -727,6 +738,7 @@ _mesa_PopAttrib(void) GLenum oldBackMode = ctx->Polygon.BackMode; MEMCPY( &ctx->Polygon, attr->data, sizeof(struct gl_polygon_attrib) ); + ctx->NewState |= _NEW_POLYGON; if ((ctx->Polygon.FrontMode != oldFrontMode || ctx->Polygon.BackMode != oldBackMode) && ctx->Driver.PolygonMode) { @@ -745,12 +757,14 @@ _mesa_PopAttrib(void) break; case GL_POLYGON_STIPPLE_BIT: MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) ); + ctx->NewState |= _NEW_POLYGONSTIPPLE; if (ctx->Driver.PolygonStipple) ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data ); break; case GL_SCISSOR_BIT: MEMCPY( &ctx->Scissor, attr->data, sizeof(struct gl_scissor_attrib) ); + ctx->NewState |= _NEW_SCISSOR; if (ctx->Driver.Enable) (*ctx->Driver.Enable)( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled ); if (ctx->Driver.Scissor) @@ -760,6 +774,7 @@ _mesa_PopAttrib(void) case GL_STENCIL_BUFFER_BIT: MEMCPY( &ctx->Stencil, attr->data, sizeof(struct gl_stencil_attrib) ); + ctx->NewState |= _NEW_STENCIL; if (ctx->Driver.StencilFunc) (*ctx->Driver.StencilFunc)( ctx, ctx->Stencil.Function, ctx->Stencil.Ref, ctx->Stencil.ValueMask); @@ -780,6 +795,7 @@ _mesa_PopAttrib(void) case GL_TRANSFORM_BIT: MEMCPY( &ctx->Transform, attr->data, sizeof(struct gl_transform_attrib) ); + ctx->NewState |= _NEW_TRANSFORM; if (ctx->Driver.Enable) { (*ctx->Driver.Enable)( ctx, GL_NORMALIZE, ctx->Transform.Normalize ); (*ctx->Driver.Enable)( ctx, GL_RESCALE_NORMAL_EXT, ctx->Transform.RescaleNormals ); @@ -799,6 +815,7 @@ _mesa_PopAttrib(void) } MEMCPY( &ctx->Texture, attr->data, sizeof(struct gl_texture_attrib) ); + ctx->NewState |= _NEW_TEXTURE; /* restore state of the currently bound texture objects */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { copy_texobj_state( ctx->Texture.Unit[u].CurrentD[1], @@ -822,7 +839,8 @@ _mesa_PopAttrib(void) { struct gl_viewport_attrib *v = (struct gl_viewport_attrib *)attr->data; - + + ctx->NewState |= _NEW_VIEWPORT; _mesa_Viewport( v->X, v->Y, v->Width, v->Height ); _mesa_DepthRange( v->Near, v->Far ); break; @@ -838,7 +856,6 @@ _mesa_PopAttrib(void) attr = next; } - ctx->NewState = NEW_ALL; ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE; } @@ -940,7 +957,7 @@ _mesa_PopClientAttrib(void) attr = next; } - ctx->NewState = NEW_ALL; + ctx->NewState = _NEW_ARRAY; } diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index b1ab7c5f28..65f890d10f 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -1,4 +1,4 @@ -/* $Id: blend.c,v 1.21 2000/10/28 18:34:48 brianp Exp $ */ +/* $Id: blend.c,v 1.22 2000/10/30 13:31:59 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -55,7 +55,7 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) switch (sfactor) { case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: - if (!ctx->Extensions.HaveBlendSquare) { + if (!ctx->Extensions.NV_blend_square) { gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(sfactor)" ); return; } @@ -83,7 +83,7 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) switch (dfactor) { case GL_DST_COLOR: case GL_ONE_MINUS_DST_COLOR: - if (!ctx->Extensions.HaveBlendSquare) { + if (!ctx->Extensions.NV_blend_square) { gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(dfactor)" ); return; } @@ -112,7 +112,7 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) } ctx->Color.BlendFunc = NULL; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_COLOR; } @@ -134,7 +134,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, switch (sfactorRGB) { case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: - if (!ctx->Extensions.HaveBlendSquare) { + if (!ctx->Extensions.NV_blend_square) { gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorRGB)"); return; } @@ -162,7 +162,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, switch (dfactorRGB) { case GL_DST_COLOR: case GL_ONE_MINUS_DST_COLOR: - if (!ctx->Extensions.HaveBlendSquare) { + if (!ctx->Extensions.NV_blend_square) { gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorRGB)"); return; } @@ -189,7 +189,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, switch (sfactorA) { case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: - if (!ctx->Extensions.HaveBlendSquare) { + if (!ctx->Extensions.NV_blend_square) { gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorA)"); return; } @@ -217,7 +217,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, switch (dfactorA) { case GL_DST_COLOR: case GL_ONE_MINUS_DST_COLOR: - if (!ctx->Extensions.HaveBlendSquare) { + if (!ctx->Extensions.NV_blend_square) { gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorA)"); return; } @@ -242,7 +242,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, } ctx->Color.BlendFunc = NULL; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_COLOR; if (ctx->Driver.BlendFuncSeparate) { (*ctx->Driver.BlendFuncSeparate)( ctx, sfactorRGB, dfactorRGB, @@ -267,7 +267,7 @@ _mesa_BlendEquation( GLenum mode ) case GL_MIN_EXT: case GL_MAX_EXT: case GL_FUNC_ADD_EXT: - if (ctx->Extensions.HaveBlendMinmax) { + if (ctx->Extensions.EXT_blend_minmax) { ctx->Color.BlendEquation = mode; } else { @@ -279,7 +279,7 @@ _mesa_BlendEquation( GLenum mode ) break; case GL_FUNC_SUBTRACT_EXT: case GL_FUNC_REVERSE_SUBTRACT_EXT: - if (ctx->Extensions.HaveBlendSubtract) { + if (ctx->Extensions.EXT_blend_subtract) { ctx->Color.BlendEquation = mode; } else { @@ -303,7 +303,7 @@ _mesa_BlendEquation( GLenum mode ) } ctx->Color.BlendFunc = NULL; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_COLOR; if (ctx->Driver.BlendEquation) ctx->Driver.BlendEquation( ctx, mode ); @@ -319,6 +319,7 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) ctx->Color.BlendColor[1] = CLAMP( green, 0.0F, 1.0F ); ctx->Color.BlendColor[2] = CLAMP( blue, 0.0F, 1.0F ); ctx->Color.BlendColor[3] = CLAMP( alpha, 0.0F, 1.0F ); + ctx->NewState |= _NEW_COLOR; } #ifdef USE_MMX_ASM diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 7d6528291b..33e7bc0016 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -1,4 +1,4 @@ -/* $Id: buffers.c,v 1.15 2000/10/28 18:34:48 brianp Exp $ */ +/* $Id: buffers.c,v 1.16 2000/10/30 13:31:59 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -51,6 +51,8 @@ _mesa_ClearIndex( GLfloat c ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex"); ctx->Color.ClearIndex = (GLuint) c; + ctx->NewState |= _NEW_COLOR; + if (!ctx->Visual.RGBAflag) { /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); @@ -70,6 +72,7 @@ _mesa_ClearColor( GLclampf red, GLclampf green, ctx->Color.ClearColor[1] = CLAMP( green, 0.0F, 1.0F ); ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F ); ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F ); + ctx->NewState |= _NEW_COLOR; if (ctx->Visual.RGBAflag) { GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF); @@ -469,7 +472,7 @@ _mesa_DrawBuffer( GLenum mode ) } ctx->Color.DrawBuffer = mode; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_COLOR; } @@ -527,7 +530,7 @@ _mesa_ReadBuffer( GLenum mode ) } ctx->Pixel.ReadBuffer = mode; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_PIXEL; } @@ -552,7 +555,7 @@ _mesa_ResizeBuffersMESA( void ) ctx->DrawBuffer->Height == (GLint) buf_height) return; - ctx->NewState |= NEW_RASTER_OPS; /* to update scissor / window bounds */ + ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ /* save buffer size */ ctx->DrawBuffer->Width = buf_width; diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c index 92788c638f..28d4e33daa 100644 --- a/src/mesa/main/clip.c +++ b/src/mesa/main/clip.c @@ -1,4 +1,4 @@ -/* $Id: clip.c,v 1.11 2000/10/28 20:41:13 brianp Exp $ */ +/* $Id: clip.c,v 1.12 2000/10/30 13:31:59 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -203,8 +203,6 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) if (ctx->Transform.ClipEnabled[p]) { - ctx->NewState |= NEW_USER_CLIP; - if (ctx->ProjectionMatrix.flags & MAT_DIRTY_ALL_OVER) { gl_matrix_analyze( &ctx->ProjectionMatrix ); } @@ -212,6 +210,8 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) ctx->Transform.EyeUserPlane[p], ctx->ProjectionMatrix.inv ); } + + ctx->NewState |= _NEW_TRANSFORM; } diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index a06557266e..c629c76de5 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -1,4 +1,4 @@ -/* $Id: colortab.c,v 1.23 2000/10/29 18:12:14 brianp Exp $ */ +/* $Id: colortab.c,v 1.24 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -435,6 +435,8 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } + + ctx->NewState |= _NEW_PIXEL; } @@ -608,6 +610,8 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } + + ctx->NewState |= _NEW_PIXEL; } @@ -907,6 +911,8 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); return; } + + ctx->NewState |= _NEW_PIXEL; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 6f46041887..3268f55070 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.98 2000/10/29 19:02:23 brianp Exp $ */ +/* $Id: context.c,v 1.99 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -825,8 +825,6 @@ init_attrib_groups( GLcontext *ctx ) gl_matrix_alloc_inv( &ctx->ProjectionMatrix ); gl_matrix_ctr( &ctx->ModelProjectMatrix ); - gl_matrix_ctr( &ctx->ModelProjectWinMatrix ); - ctx->ModelProjectWinMatrixUptodate = GL_FALSE; ctx->ProjectionStackDepth = 0; ctx->NearFarStack[0][0] = 1.0; /* These values seem weird by make */ @@ -1338,7 +1336,7 @@ init_attrib_groups( GLcontext *ctx ) _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable); /* Miscellaneous */ - ctx->NewState = NEW_ALL; + ctx->NewState = _NEW_ALL; ctx->RenderMode = GL_RENDER; ctx->StippleCounter = 0; ctx->NeedNormals = GL_FALSE; @@ -1836,6 +1834,9 @@ _mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) if (mask & GL_VIEWPORT_BIT) { MEMCPY( &dst->Viewport, &src->Viewport, sizeof(struct gl_viewport_attrib) ); } + /* XXX FIXME: Call callbacks? + */ + dst->NewState = _NEW_ALL; } @@ -1896,7 +1897,7 @@ _mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, /* TODO: check if newCtx and buffer's visual match??? */ newCtx->DrawBuffer = drawBuffer; newCtx->ReadBuffer = readBuffer; - newCtx->NewState = NEW_ALL; /* just to be safe */ + newCtx->NewState |= _NEW_BUFFERS; gl_update_state( newCtx ); } diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index b32b3e7373..2a5f5f9b2d 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -1,4 +1,4 @@ -/* $Id: convolve.c,v 1.7 2000/10/28 20:41:13 brianp Exp $ */ +/* $Id: convolve.c,v 1.8 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -170,6 +170,8 @@ _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, G ctx->Convolution1D.Filter[i * 4 + 3] = a; } } + + ctx->NewState |= _NEW_IMAGING; } @@ -248,6 +250,8 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G ctx->Convolution2D.Filter[i * 4 + 3] = a; } } + + ctx->NewState |= _NEW_IMAGING; } @@ -290,6 +294,8 @@ _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(pname)"); return; } + + ctx->NewState |= _NEW_PIXEL; } @@ -345,6 +351,8 @@ _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(pname)"); return; } + + ctx->NewState |= _NEW_PIXEL; } @@ -387,6 +395,8 @@ _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(pname)"); return; } + + ctx->NewState |= _NEW_PIXEL; } @@ -445,6 +455,8 @@ _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)"); return; } + + ctx->NewState |= _NEW_PIXEL; } @@ -530,11 +542,13 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi ctx->Unpack.SkipImages = 0; ctx->Unpack.SwapBytes = GL_FALSE; ctx->Unpack.LsbFirst = GL_FALSE; + ctx->NewState |= _NEW_PACKUNPACK; _mesa_ConvolutionFilter2D(target, internalFormat, width, height, GL_RGBA, GL_UNSIGNED_BYTE, rgba); ctx->Unpack = packSave; /* restore pixel packing params */ + ctx->NewState |= _NEW_PACKUNPACK; } @@ -860,6 +874,8 @@ _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLs ctx->Separable2D.Filter[i * 4 + 3 + colStart] = a; } } + + ctx->NewState |= _NEW_IMAGING; } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 287185f846..e196a241ab 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $Id: dd.h,v 1.35 2000/10/29 18:12:14 brianp Exp $ */ +/* $Id: dd.h,v 1.36 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -141,6 +141,12 @@ struct dd_function_table { * NULL can be returned. */ + GLuint UpdateStateNotify; + /* + * Tell mesa exactly when to call UpdateState. This is a bitwise + * or of the _NEW_* flags defined in types.h. + */ + void (*UpdateState)( GLcontext *ctx ); /* * UpdateState() is called whenver Mesa thinks the device driver should diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index c5e113e4e7..a5d9c34efc 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -1,4 +1,4 @@ -/* $Id: depth.c,v 1.20 2000/10/29 18:23:16 brianp Exp $ */ +/* $Id: depth.c,v 1.21 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -54,6 +54,7 @@ _mesa_ClearDepth( GLclampd depth ) ctx->Depth.Clear = (GLfloat) CLAMP( depth, 0.0, 1.0 ); if (ctx->Driver.ClearDepth) (*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear ); + ctx->NewState |= _NEW_DEPTH; } @@ -77,7 +78,7 @@ _mesa_DepthFunc( GLenum func ) case GL_ALWAYS: if (ctx->Depth.Func != func) { ctx->Depth.Func = func; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_DEPTH; ctx->TriangleCaps &= ~DD_Z_NEVER; if (ctx->Driver.DepthFunc) { (*ctx->Driver.DepthFunc)( ctx, func ); @@ -87,7 +88,7 @@ _mesa_DepthFunc( GLenum func ) case GL_NEVER: if (ctx->Depth.Func != func) { ctx->Depth.Func = func; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_DEPTH; ctx->TriangleCaps |= DD_Z_NEVER; if (ctx->Driver.DepthFunc) { (*ctx->Driver.DepthFunc)( ctx, func ); @@ -116,7 +117,7 @@ _mesa_DepthMask( GLboolean flag ) */ if (ctx->Depth.Mask != flag) { ctx->Depth.Mask = flag; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_DEPTH; if (ctx->Driver.DepthMask) { (*ctx->Driver.DepthMask)( ctx, flag ); } @@ -1598,7 +1599,7 @@ _mesa_alloc_depth_buffer( GLcontext *ctx ) if (!ctx->DrawBuffer->DepthBuffer) { /* out of memory */ ctx->Depth.Test = GL_FALSE; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_DEPTH; gl_error( ctx, GL_OUT_OF_MEMORY, "Couldn't allocate depth buffer" ); } } diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index f60fcc44f2..6c5514fc98 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.28 2000/10/29 19:02:23 brianp Exp $ */ +/* $Id: enable.c,v 1.29 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -61,11 +61,12 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_ALPHA_TEST: if (ctx->Color.AlphaEnabled!=state) { ctx->Color.AlphaEnabled = state; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_COLOR; } break; case GL_AUTO_NORMAL: ctx->Eval.AutoNormal = state; + ctx->NewState |= _NEW_EVAL; break; case GL_BLEND: if (ctx->Color.BlendEnabled!=state) { @@ -77,7 +78,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) else { ctx->Color.ColorLogicOpEnabled = GL_FALSE; } - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_COLOR; } break; case GL_CLIP_PLANE0: @@ -86,14 +87,12 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: - if (cap >= GL_CLIP_PLANE0 && - cap <= GL_CLIP_PLANE5 && - ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0] != state) + if (ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0] != state) { GLuint p = cap-GL_CLIP_PLANE0; ctx->Transform.ClipEnabled[p] = state; - ctx->NewState |= NEW_USER_CLIP; + ctx->NewState |= _NEW_TRANSFORM; if (state) { ctx->Enabled |= ENABLE_USERCLIP; @@ -115,7 +114,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_COLOR_MATERIAL: if (ctx->Light.ColorMaterialEnabled!=state) { ctx->Light.ColorMaterialEnabled = state; - ctx->NewState |= NEW_LIGHTING; + ctx->NewState |= _NEW_LIGHT; if (state) gl_update_color_material( ctx, ctx->Current.Color ); } @@ -124,7 +123,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) if (ctx->Polygon.CullFlag!=state) { ctx->Polygon.CullFlag = state; ctx->TriangleCaps ^= DD_TRI_CULL; - ctx->NewState |= NEW_POLYGON; + ctx->NewState |= _NEW_POLYGON; } break; case GL_DEPTH_TEST: @@ -134,7 +133,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } if (ctx->Depth.Test!=state) { ctx->Depth.Test = state; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_DEPTH; } break; case GL_DITHER: @@ -144,19 +143,20 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } if (ctx->Color.DitherFlag!=state) { ctx->Color.DitherFlag = state; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_COLOR; } break; case GL_FOG: if (ctx->Fog.Enabled!=state) { ctx->Fog.Enabled = state; ctx->Enabled ^= ENABLE_FOG; - ctx->NewState |= NEW_FOG|NEW_RASTER_OPS; + ctx->NewState |= _NEW_FOG; } break; case GL_HISTOGRAM: - if (ctx->Extensions.HaveHistogram) { + if (ctx->Extensions.EXT_histogram) { ctx->Pixel.HistogramEnabled = state; + ctx->NewState |= _NEW_PIXEL; } else { gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); @@ -185,7 +185,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->Enabled &= ~ENABLE_LIGHT; } - ctx->NewState |= NEW_LIGHTING; + ctx->NewState |= _NEW_LIGHT; } break; case GL_LIGHTING: @@ -194,96 +194,115 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->Enabled &= ~ENABLE_LIGHT; if (state) ctx->Enabled |= ENABLE_LIGHT; - ctx->NewState |= NEW_LIGHTING; + ctx->NewState |= _NEW_LIGHT; } break; case GL_LINE_SMOOTH: if (ctx->Line.SmoothFlag!=state) { ctx->Line.SmoothFlag = state; ctx->TriangleCaps ^= DD_LINE_SMOOTH; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_LINE; } break; case GL_LINE_STIPPLE: if (ctx->Line.StippleFlag!=state) { ctx->Line.StippleFlag = state; ctx->TriangleCaps ^= DD_LINE_STIPPLE; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_LINE; } break; case GL_INDEX_LOGIC_OP: if (ctx->Color.IndexLogicOpEnabled!=state) { ctx->Color.IndexLogicOpEnabled = state; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_COLOR; } break; case GL_COLOR_LOGIC_OP: if (ctx->Color.ColorLogicOpEnabled!=state) { ctx->Color.ColorLogicOpEnabled = state; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_COLOR; } break; case GL_MAP1_COLOR_4: ctx->Eval.Map1Color4 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP1_INDEX: ctx->Eval.Map1Index = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP1_NORMAL: ctx->Eval.Map1Normal = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP1_TEXTURE_COORD_1: ctx->Eval.Map1TextureCoord1 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP1_TEXTURE_COORD_2: ctx->Eval.Map1TextureCoord2 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP1_TEXTURE_COORD_3: ctx->Eval.Map1TextureCoord3 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP1_TEXTURE_COORD_4: ctx->Eval.Map1TextureCoord4 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP1_VERTEX_3: ctx->Eval.Map1Vertex3 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP1_VERTEX_4: ctx->Eval.Map1Vertex4 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP2_COLOR_4: ctx->Eval.Map2Color4 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP2_INDEX: ctx->Eval.Map2Index = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP2_NORMAL: ctx->Eval.Map2Normal = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP2_TEXTURE_COORD_1: ctx->Eval.Map2TextureCoord1 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP2_TEXTURE_COORD_2: ctx->Eval.Map2TextureCoord2 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP2_TEXTURE_COORD_3: ctx->Eval.Map2TextureCoord3 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP2_TEXTURE_COORD_4: ctx->Eval.Map2TextureCoord4 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP2_VERTEX_3: ctx->Eval.Map2Vertex3 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MAP2_VERTEX_4: ctx->Eval.Map2Vertex4 = state; + ctx->NewState |= _NEW_EVAL; break; case GL_MINMAX: ctx->Pixel.MinMaxEnabled = state; + ctx->NewState |= _NEW_PIXEL; break; case GL_NORMALIZE: if (ctx->Transform.Normalize != state) { ctx->Transform.Normalize = state; - ctx->NewState |= NEW_NORMAL_TRANSFORM|NEW_LIGHTING; + ctx->NewState |= _NEW_TRANSFORM; ctx->Enabled ^= ENABLE_NORMALIZE; } break; @@ -291,57 +310,58 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) if (ctx->Point.SmoothFlag!=state) { ctx->Point.SmoothFlag = state; ctx->TriangleCaps ^= DD_POINT_SMOOTH; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_POINT; } break; case GL_POLYGON_SMOOTH: if (ctx->Polygon.SmoothFlag!=state) { ctx->Polygon.SmoothFlag = state; ctx->TriangleCaps ^= DD_TRI_SMOOTH; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_POLYGON; } break; case GL_POLYGON_STIPPLE: if (ctx->Polygon.StippleFlag!=state) { ctx->Polygon.StippleFlag = state; ctx->TriangleCaps ^= DD_TRI_STIPPLE; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_POLYGON; } break; case GL_POLYGON_OFFSET_POINT: if (ctx->Polygon.OffsetPoint!=state) { ctx->Polygon.OffsetPoint = state; - ctx->NewState |= NEW_POLYGON; + ctx->NewState |= _NEW_POLYGON; } break; case GL_POLYGON_OFFSET_LINE: if (ctx->Polygon.OffsetLine!=state) { ctx->Polygon.OffsetLine = state; - ctx->NewState |= NEW_POLYGON; + ctx->NewState |= _NEW_POLYGON; } break; case GL_POLYGON_OFFSET_FILL: /*case GL_POLYGON_OFFSET_EXT:*/ if (ctx->Polygon.OffsetFill!=state) { ctx->Polygon.OffsetFill = state; - ctx->NewState |= NEW_POLYGON; + ctx->NewState |= _NEW_POLYGON; } break; case GL_RESCALE_NORMAL_EXT: if (ctx->Transform.RescaleNormals != state) { ctx->Transform.RescaleNormals = state; - ctx->NewState |= NEW_NORMAL_TRANSFORM|NEW_LIGHTING; + ctx->NewState |= _NEW_TRANSFORM; ctx->Enabled ^= ENABLE_RESCALE; } break; case GL_SCISSOR_TEST: if (ctx->Scissor.Enabled!=state) { ctx->Scissor.Enabled = state; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_SCISSOR; } break; case GL_SHARED_TEXTURE_PALETTE_EXT: ctx->Texture.SharedPalette = state; + ctx->NewState |= _NEW_TEXTURE; break; case GL_STENCIL_TEST: if (state && ctx->Visual.StencilBits==0) { @@ -350,7 +370,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } if (ctx->Stencil.Enabled!=state) { ctx->Stencil.Enabled = state; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_STENCIL; ctx->TriangleCaps ^= DD_STENCIL; } break; @@ -358,7 +378,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) if (ctx->Visual.RGBAflag) { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - ctx->NewState |= NEW_TEXTURE_ENABLE; + ctx->NewState |= _NEW_TEXTURE; if (state) { texUnit->Enabled |= TEXTURE0_1D; } @@ -371,7 +391,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) if (ctx->Visual.RGBAflag) { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - ctx->NewState |= NEW_TEXTURE_ENABLE; + ctx->NewState |= _NEW_TEXTURE; if (state) { texUnit->Enabled |= TEXTURE0_2D; } @@ -384,7 +404,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) if (ctx->Visual.RGBAflag) { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - ctx->NewState |= NEW_TEXTURE_ENABLE; + ctx->NewState |= _NEW_TEXTURE; if (state) { texUnit->Enabled |= TEXTURE0_3D; } @@ -400,7 +420,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) texUnit->TexGenEnabled |= Q_BIT; else texUnit->TexGenEnabled &= ~Q_BIT; - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } break; case GL_TEXTURE_GEN_R: @@ -410,7 +430,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) texUnit->TexGenEnabled |= R_BIT; else texUnit->TexGenEnabled &= ~R_BIT; - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } break; case GL_TEXTURE_GEN_S: @@ -420,7 +440,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) texUnit->TexGenEnabled |= S_BIT; else texUnit->TexGenEnabled &= ~S_BIT; - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } break; case GL_TEXTURE_GEN_T: @@ -430,7 +450,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) texUnit->TexGenEnabled |= T_BIT; else texUnit->TexGenEnabled &= ~T_BIT; - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } break; @@ -439,32 +459,38 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) */ case GL_VERTEX_ARRAY: ctx->Array.Vertex.Enabled = state; - break; + ctx->NewState |= _NEW_ARRAY; + break; case GL_NORMAL_ARRAY: ctx->Array.Normal.Enabled = state; + ctx->NewState |= _NEW_ARRAY; break; case GL_COLOR_ARRAY: ctx->Array.Color.Enabled = state; + ctx->NewState |= _NEW_ARRAY; break; case GL_INDEX_ARRAY: ctx->Array.Index.Enabled = state; + ctx->NewState |= _NEW_ARRAY; break; case GL_TEXTURE_COORD_ARRAY: ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state; + ctx->NewState |= _NEW_ARRAY; break; case GL_EDGE_FLAG_ARRAY: ctx->Array.EdgeFlag.Enabled = state; + ctx->NewState |= _NEW_ARRAY; break; /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { ctx->Depth.OcclusionTest = state; + ctx->NewState |= _NEW_DEPTH; if (state) ctx->OcclusionResult = ctx->OcclusionResultSaved; else ctx->OcclusionResultSaved = ctx->OcclusionResult; - ctx->NewState |= NEW_RASTER_OPS; } else { gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); @@ -476,12 +502,14 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_PIXEL_TEXTURE_SGIS: /* XXX check for extension */ ctx->Pixel.PixelTextureEnabled = state; + ctx->NewState |= _NEW_PIXEL; break; /* GL_SGIX_pixel_texture */ case GL_PIXEL_TEX_GEN_SGIX: /* XXX check for extension */ ctx->Pixel.PixelTextureEnabled = state; + ctx->NewState |= _NEW_PIXEL; break; /* GL_SGI_color_table */ @@ -489,14 +517,17 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* XXX check for extension */ ctx->Pixel.ColorTableEnabled = state; ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE; + ctx->NewState |= _NEW_PIXEL; break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: ctx->Pixel.PostConvolutionColorTableEnabled = state; ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE; + ctx->NewState |= _NEW_PIXEL; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: ctx->Pixel.PostColorMatrixColorTableEnabled = state; ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE; + ctx->NewState |= _NEW_PIXEL; break; /* GL_EXT_convolution */ @@ -504,23 +535,26 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) /* XXX check for extension */ ctx->Pixel.Convolution1DEnabled = state; ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE; + ctx->NewState |= _NEW_PIXEL; break; case GL_CONVOLUTION_2D: ctx->Pixel.Convolution2DEnabled = state; ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE; + ctx->NewState |= _NEW_PIXEL; break; case GL_SEPARABLE_2D: ctx->Pixel.Separable2DEnabled = state; ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE; + ctx->NewState |= _NEW_PIXEL; break; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) { + if (ctx->Extensions.ARB_texture_cube_map) { if (ctx->Visual.RGBAflag) { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - ctx->NewState |= NEW_TEXTURE_ENABLE; + ctx->NewState |= _NEW_TEXTURE; if (state) { texUnit->Enabled |= TEXTURE0_CUBE; } @@ -542,7 +576,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) SET_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR) CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_FOG; break; default: @@ -605,7 +639,7 @@ _mesa_IsEnabled( GLenum cap ) case GL_FOG: return ctx->Fog.Enabled; case GL_HISTOGRAM: - if (ctx->Extensions.HaveHistogram) { + if (ctx->Extensions.EXT_histogram) { return ctx->Pixel.HistogramEnabled; } else { @@ -746,7 +780,7 @@ _mesa_IsEnabled( GLenum cap ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { return ctx->Depth.OcclusionTest; } else { @@ -780,7 +814,7 @@ _mesa_IsEnabled( GLenum cap ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) { + if (ctx->Extensions.ARB_texture_cube_map) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE; } @@ -835,7 +869,7 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state ) gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); } - ctx->NewState |= NEW_CLIENT_STATE; + ctx->NewState |= _NEW_ARRAY; } diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 658fa0cbd6..1c779eb5e3 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -1,4 +1,4 @@ -/* $Id: eval.c,v 1.13 2000/10/29 18:12:15 brianp Exp $ */ +/* $Id: eval.c,v 1.14 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -938,6 +938,8 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, default: gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); } + + ctx->NewState |= _NEW_EVAL; } @@ -1132,6 +1134,8 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, default: gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); } + + ctx->NewState |= _NEW_EVAL; } @@ -2642,6 +2646,8 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) ctx->Eval.MapGrid1u1 = u1; ctx->Eval.MapGrid1u2 = u2; ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un; + + ctx->NewState |= _NEW_EVAL; } @@ -2674,6 +2680,8 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, ctx->Eval.MapGrid2v1 = v1; ctx->Eval.MapGrid2v2 = v2; ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn; + + ctx->NewState |= _NEW_EVAL; } @@ -2686,7 +2694,6 @@ _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, - /* KW: If are compiling, we don't know whether eval will produce a * vertex when it is run in the future. If this is pure immediate * mode, eval is a noop if neither vertex map is enabled. @@ -2853,7 +2860,6 @@ _mesa_EvalPoint2( GLint i, GLint j ) - void _mesa_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) { diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 823c7f405e..5cc6647af0 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.38 2000/10/27 18:31:22 brianp Exp $ */ +/* $Id: extensions.c,v 1.39 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -42,102 +42,86 @@ struct extension { struct extension *next, *prev; GLint enabled; + GLboolean *flag; /* optional flag stored elsewhere */ char name[MAX_EXT_NAMELEN+1]; void (*notify)( GLcontext *, GLboolean ); }; - - -static struct { int enabled; const char *name; } default_extensions[] = { - { DEFAULT_ON, "GL_ARB_imaging" }, - { DEFAULT_ON, "GL_ARB_multitexture" }, - { DEFAULT_OFF, "GL_ARB_texture_compression" }, - { DEFAULT_OFF, "GL_ARB_texture_cube_map" }, - { DEFAULT_ON, "GL_ARB_texture_env_add" }, - { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" }, - { ALWAYS_ENABLED, "GL_EXT_abgr" }, - { DEFAULT_OFF, "GL_EXT_bgra" }, - { DEFAULT_ON, "GL_EXT_blend_color" }, - { DEFAULT_ON, "GL_EXT_blend_func_separate" }, - { DEFAULT_ON, "GL_EXT_blend_logic_op" }, - { DEFAULT_ON, "GL_EXT_blend_minmax" }, - { DEFAULT_ON, "GL_EXT_blend_subtract" }, - { DEFAULT_ON, "GL_EXT_clip_volume_hint" }, - { DEFAULT_OFF, "GL_EXT_cull_vertex" }, - { DEFAULT_ON, "GL_EXT_convolution" }, - { DEFAULT_ON, "GL_EXT_compiled_vertex_array" }, - { DEFAULT_ON, "GL_EXT_fog_coord" }, - { DEFAULT_ON, "GL_EXT_histogram" }, - { DEFAULT_ON, "GL_EXT_packed_pixels" }, - { DEFAULT_ON, "GL_EXT_paletted_texture" }, - { DEFAULT_ON, "GL_EXT_point_parameters" }, - { ALWAYS_ENABLED, "GL_EXT_polygon_offset" }, - { ALWAYS_ENABLED, "GL_EXT_rescale_normal" }, - { DEFAULT_ON, "GL_EXT_secondary_color" }, - { DEFAULT_ON, "GL_EXT_shared_texture_palette" }, - { DEFAULT_ON, "GL_EXT_stencil_wrap" }, - { DEFAULT_ON, "GL_EXT_texture3D" }, - { DEFAULT_OFF, "GL_EXT_texture_compression_s3tc" }, - { DEFAULT_ON, "GL_EXT_texture_env_add" }, - { DEFAULT_OFF, "GL_EXT_texture_env_combine" }, - { ALWAYS_ENABLED, "GL_EXT_texture_object" }, - { DEFAULT_ON, "GL_EXT_texture_lod_bias" }, - { ALWAYS_ENABLED, "GL_EXT_vertex_array" }, - { DEFAULT_OFF, "GL_EXT_vertex_array_set" }, - { DEFAULT_OFF, "GL_HP_occlusion_test" }, - { DEFAULT_ON, "GL_INGR_blend_func_separate" }, - { ALWAYS_ENABLED, "GL_MESA_window_pos" }, - { ALWAYS_ENABLED, "GL_MESA_resize_buffers" }, - { DEFAULT_OFF, "GL_NV_blend_square" }, - { ALWAYS_ENABLED, "GL_NV_texgen_reflection" }, - { DEFAULT_ON, "GL_PGI_misc_hints" }, - { DEFAULT_ON, "GL_SGI_color_matrix" }, - { DEFAULT_ON, "GL_SGI_color_table" }, - { DEFAULT_ON, "GL_SGIS_pixel_texture" }, - { DEFAULT_ON, "GL_SGIS_texture_edge_clamp" }, - { DEFAULT_ON, "GL_SGIX_pixel_texture" }, - { DEFAULT_OFF, "GL_3DFX_texture_compression_FXT1" } +#define F(x) (int)&(((struct gl_extensions *)0)->x) +#define ON GL_TRUE +#define OFF GL_FALSE + +static struct { + GLboolean enabled; + const char *name; + int flag_offset; +} default_extensions[] = { + { ON, "GL_ARB_imaging", F(ARB_imaging) }, + { ON, "GL_ARB_multitexture", F(ARB_multitexture) }, + { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, + { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, + { ON, "GL_ARB_texture_env_add", F(ARB_texture_env_add) }, + { ON, "GL_ARB_tranpose_matrix", 0 }, + { ON, "GL_EXT_abgr", 0 }, + { OFF, "GL_EXT_bgra", 0 }, + { ON, "GL_EXT_blend_color", F(EXT_blend_color) }, + { ON, "GL_EXT_blend_func_separate", F(EXT_blend_func_separate) }, + { ON, "GL_EXT_blend_logic_op", F(EXT_blend_logic_op) }, + { ON, "GL_EXT_blend_minmax", F(EXT_blend_minmax) }, + { ON, "GL_EXT_blend_subtract", F(EXT_blend_subtract) }, + { ON, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, + { OFF, "GL_EXT_cull_vertex", 0 }, + { ON, "GL_EXT_convolution", F(EXT_convolution) }, + { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) }, + { ON, "GL_EXT_fog_coord", F(EXT_fog_coord) }, + { ON, "GL_EXT_histogram", F(EXT_histogram) }, + { ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) }, + { ON, "GL_EXT_paletted_texture", F(EXT_paletted_texture) }, + { ON, "GL_EXT_point_parameters", F(EXT_point_parameters) }, + { ON, "GL_EXT_polygon_offset", F(EXT_polygon_offset) }, + { ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) }, + { ON, "GL_EXT_secondary_color", F(EXT_secondary_color) }, + { ON, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette) }, + { ON, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap) }, + { ON, "GL_EXT_texture3D", F(EXT_texture3D) }, + { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, + { ON, "GL_EXT_texture_env_add", F(EXT_texture_env_add) }, + { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) }, + { ON, "GL_EXT_texture_object", F(EXT_texture_object) }, + { ON, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) }, + { ON, "GL_EXT_vertex_array", 0 }, + { OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) }, + { OFF, "GL_HP_occlusion_test", F(HP_occlusion_test) }, + { ON, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) }, + { ON, "GL_MESA_window_pos", F(MESA_window_pos) }, + { ON, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, + { OFF, "GL_NV_blend_square", F(NV_blend_square) }, + { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, + { ON, "GL_PGI_misc_hints", F(PGI_misc_hints) }, + { ON, "GL_SGI_color_matrix", F(SGI_color_matrix) }, + { ON, "GL_SGI_color_table", F(SGI_color_table) }, + { ON, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) }, + { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, + { ON, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) }, + { OFF, "GL_3DFX_texture_compression_FXT1", F(_3DFX_texture_compression_FXT1) } }; -/* - * Update the boolean convenience flags in the Extensions struct. - */ -static void -update_extension_flags( GLcontext *ctx ) -{ - /* Update flags */ - ctx->Extensions.HaveBlendMinmax = gl_extension_is_enabled(ctx, "GL_EXT_blend_minmax") || gl_extension_is_enabled(ctx, "GL_ARB_imaging"); - ctx->Extensions.HaveBlendSquare = gl_extension_is_enabled(ctx, "GL_NV_blend_square"); - ctx->Extensions.HaveBlendSubtract = gl_extension_is_enabled(ctx, "GL_EXT_blend_subtract") || gl_extension_is_enabled(ctx, "GL_ARB_imaging"); - ctx->Extensions.HaveHistogram = gl_extension_is_enabled(ctx, "GL_EXT_histogram") || gl_extension_is_enabled(ctx, "GL_ARB_imaging"); - ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test"); - ctx->Extensions.HaveStencilWrap = gl_extension_is_enabled(ctx, "GL_EXT_stencil_wrap"); - ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add") || gl_extension_is_enabled(ctx, "GL_ARB_texture_env_add"); - ctx->Extensions.HaveTextureEnvCombine = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_combine"); - ctx->Extensions.HaveTextureCubeMap = gl_extension_is_enabled(ctx, "GL_ARB_texture_cube_map"); - ctx->Extensions.HaveTextureCompression = gl_extension_is_enabled(ctx, "GL_ARB_texture_compression"); - ctx->Extensions.HaveTextureCompressionFXT1 = gl_extension_is_enabled(ctx, "GL_3DFX_texture_compression_FXT1"); - ctx->Extensions.HaveTextureCompressionS3TC = gl_extension_is_enabled(ctx, "GL_EXT_texture_compression_s3tc"); - ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias"); -} int gl_extensions_add( GLcontext *ctx, - int state, + GLboolean enabled, const char *name, - void (*notify)(void) ) + GLboolean *flag_ptr ) { - (void) notify; - if (ctx->Extensions.ext_string == 0) { struct extension *t = MALLOC_STRUCT(extension); - t->enabled = state; + t->enabled = enabled; strncpy(t->name, name, MAX_EXT_NAMELEN); t->name[MAX_EXT_NAMELEN] = 0; - t->notify = (void (*)(GLcontext *, GLboolean)) notify; + t->flag = flag_ptr; insert_at_tail( ctx->Extensions.ext_list, t ); return 0; } @@ -158,13 +142,8 @@ static int set_extension( GLcontext *ctx, const char *name, GLint state ) if (i == ctx->Extensions.ext_list) return 1; - if (!(i->enabled & ALWAYS_ENABLED)) { - if (i->notify) i->notify( ctx, state ); - i->enabled = state; - } - - update_extension_flags(ctx); - + if (i->flag) *(i->flag) = state; + i->enabled = state; return 0; } @@ -227,18 +206,23 @@ void gl_extensions_dtr( GLcontext *ctx ) void gl_extensions_ctr( GLcontext *ctx ) { GLuint i; + GLboolean *base = (GLboolean *)&ctx->Extensions; ctx->Extensions.ext_string = 0; ctx->Extensions.ext_list = MALLOC_STRUCT(extension); make_empty_list( ctx->Extensions.ext_list ); for (i = 0 ; i < Elements(default_extensions) ; i++) { + GLboolean *ptr = 0; + + if (default_extensions[i].flag_offset) + ptr = base + default_extensions[i].flag_offset; + gl_extensions_add( ctx, default_extensions[i].enabled, default_extensions[i].name, - 0 ); + ptr); } - update_extension_flags(ctx); } diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h index 4c24bf1412..4c861b32ac 100644 --- a/src/mesa/main/extensions.h +++ b/src/mesa/main/extensions.h @@ -1,4 +1,4 @@ -/* $Id: extensions.h,v 1.8 2000/03/07 18:24:14 brianp Exp $ */ +/* $Id: extensions.h,v 1.9 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -31,14 +31,11 @@ #include "types.h" -#define DEFAULT_OFF 0x0 -#define DEFAULT_ON 0x1 -#define ALWAYS_ENABLED 0x2 /* Return 0 on success. */ -extern int gl_extensions_add( GLcontext *ctx, int state, - const char *name, void (*notify)( void ) ); +extern int gl_extensions_add( GLcontext *ctx, GLboolean enabled, + const char *name, GLboolean *flag_ptr ); extern int gl_extensions_enable( GLcontext *ctx, const char *name ); extern int gl_extensions_disable( GLcontext *ctx, const char *name ); diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 1a6b34d7fe..7f911cdddd 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -1,4 +1,4 @@ -/* $Id: feedback.c,v 1.13 2000/10/28 20:41:14 brianp Exp $ */ +/* $Id: feedback.c,v 1.14 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -104,6 +104,7 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) ctx->Feedback.BufferSize = size; ctx->Feedback.Buffer = buffer; ctx->Feedback.Count = 0; + ctx->NewState |= _NEW_FEEDBACK_SELECT; } @@ -278,6 +279,8 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) ctx->Select.HitFlag = GL_FALSE; ctx->Select.HitMinZ = 1.0; ctx->Select.HitMaxZ = 0.0; + + ctx->NewState |= _NEW_FEEDBACK_SELECT; } @@ -380,6 +383,7 @@ _mesa_InitNames( void ) ctx->Select.HitFlag = GL_FALSE; ctx->Select.HitMinZ = 1.0; ctx->Select.HitMaxZ = 0.0; + ctx->NewState |= _NEW_FEEDBACK_SELECT; } @@ -405,6 +409,7 @@ _mesa_LoadName( GLuint name ) else { ctx->Select.NameStack[MAX_NAME_STACK_DEPTH-1] = name; } + ctx->NewState |= _NEW_FEEDBACK_SELECT; } @@ -425,6 +430,7 @@ _mesa_PushName( GLuint name ) else { gl_error( ctx, GL_STACK_OVERFLOW, "glPushName" ); } + ctx->NewState |= _NEW_FEEDBACK_SELECT; } @@ -446,6 +452,7 @@ _mesa_PopName( void ) else { gl_error( ctx, GL_STACK_UNDERFLOW, "glPopName" ); } + ctx->NewState |= _NEW_FEEDBACK_SELECT; } @@ -493,6 +500,7 @@ _mesa_RenderMode( GLenum mode ) ctx->Select.BufferCount = 0; ctx->Select.Hits = 0; ctx->Select.NameStackDepth = 0; + ctx->NewState |= _NEW_FEEDBACK_SELECT; break; case GL_FEEDBACK: if (ctx->Feedback.Count > ctx->Feedback.BufferSize) { @@ -503,6 +511,7 @@ _mesa_RenderMode( GLenum mode ) result = ctx->Feedback.Count; } ctx->Feedback.Count = 0; + ctx->NewState |= _NEW_FEEDBACK_SELECT; break; default: gl_error( ctx, GL_INVALID_ENUM, "glRenderMode" ); @@ -532,7 +541,7 @@ _mesa_RenderMode( GLenum mode ) } ctx->RenderMode = mode; - ctx->NewState |= NEW_ALL; + ctx->NewState |= _NEW_RENDERMODE; return result; } diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index 4c1502227c..72c0ff4849 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -1,4 +1,4 @@ -/* $Id: fog.c,v 1.25 2000/10/28 20:41:14 brianp Exp $ */ +/* $Id: fog.c,v 1.26 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -142,7 +142,7 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) (*ctx->Driver.Fogfv)( ctx, pname, params ); } - ctx->NewState |= NEW_FOG; + ctx->NewState |= _NEW_FOG; } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 263c5ca134..8110cdfdd4 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.38 2000/10/29 19:02:23 brianp Exp $ */ +/* $Id: get.c,v 1.39 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -357,7 +357,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); break; case GL_HISTOGRAM: - if (ctx->Extensions.HaveHistogram) { + if (ctx->Extensions.EXT_histogram) { *params = ctx->Pixel.HistogramEnabled; } else { @@ -971,19 +971,19 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); else gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); return; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = INT_TO_BOOL(textureUnit->CurrentCubeMap->Name); else gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); return; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = INT_TO_BOOL(ctx->Const.MaxCubeTextureSize); else gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); @@ -991,21 +991,21 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { *params = INT_TO_BOOL(ctx->Hint.TextureCompression); } else gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { *params = INT_TO_BOOL(ctx->Const.NumCompressedTextureFormats); } else gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { GLuint i; for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) params[i] = INT_TO_BOOL(ctx->Const.CompressedTextureFormats[i]); @@ -1116,7 +1116,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { *params = ctx->Depth.OcclusionTest; } else { @@ -1124,7 +1124,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) } return; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { if (ctx->Depth.OcclusionTest) *params = ctx->OcclusionResult; else @@ -1548,7 +1548,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.GreenScale; break; case GL_HISTOGRAM: - if (ctx->Extensions.HaveHistogram) { + if (ctx->Extensions.EXT_histogram) { *params = (GLdouble) ctx->Pixel.HistogramEnabled; } else { @@ -2162,19 +2162,19 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); else gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); return; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = (GLdouble) textureUnit->CurrentCubeMap->Name; else gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); return; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = (GLdouble) ctx->Const.MaxCubeTextureSize; else gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); @@ -2182,21 +2182,21 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { *params = (GLdouble) ctx->Hint.TextureCompression; } else gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { *params = (GLdouble) ctx->Const.NumCompressedTextureFormats; } else gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { GLuint i; for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) params[i] = (GLdouble) ctx->Const.CompressedTextureFormats[i]; @@ -2307,7 +2307,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { *params = (GLdouble) ctx->Depth.OcclusionTest; } else { @@ -2315,7 +2315,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) } return; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { if (ctx->Depth.OcclusionTest) *params = (GLdouble) ctx->OcclusionResult; else @@ -2740,7 +2740,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Pixel.GreenScale; break; case GL_HISTOGRAM: - if (ctx->Extensions.HaveHistogram) { + if (ctx->Extensions.EXT_histogram) { *params = (GLfloat) ctx->Pixel.HistogramEnabled; } else { @@ -3356,19 +3356,19 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); else gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); return; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = (GLfloat) textureUnit->CurrentCubeMap->Name; else gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); return; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = (GLfloat) ctx->Const.MaxCubeTextureSize; else gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); @@ -3376,21 +3376,21 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { *params = (GLfloat) ctx->Hint.TextureCompression; } else gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { *params = (GLfloat) ctx->Const.NumCompressedTextureFormats; } else gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { GLuint i; for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) params[i] = (GLfloat) ctx->Const.CompressedTextureFormats[i]; @@ -3473,7 +3473,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { *params = (GLfloat) ctx->Depth.OcclusionTest; } else { @@ -3481,7 +3481,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) } return; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { if (ctx->Depth.OcclusionTest) *params = (GLfloat) ctx->OcclusionResult; else @@ -3908,7 +3908,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Pixel.GreenScale; break; case GL_HISTOGRAM: - if (ctx->Extensions.HaveHistogram) { + if (ctx->Extensions.EXT_histogram) { *params = (GLint) ctx->Pixel.HistogramEnabled; } else { @@ -4522,19 +4522,19 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); else gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); return; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = textureUnit->CurrentCubeMap->Name; else gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); return; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) *params = ctx->Const.MaxCubeTextureSize; else gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); @@ -4542,21 +4542,21 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { *params = (GLint) ctx->Hint.TextureCompression; } else gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { *params = (GLint) ctx->Const.NumCompressedTextureFormats; } else gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { GLuint i; for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) params[i] = (GLint) ctx->Const.CompressedTextureFormats[i]; @@ -4667,7 +4667,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { *params = (GLint) ctx->Depth.OcclusionTest; } else { @@ -4675,7 +4675,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) } return; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Extensions.HP_occlusion_test) { if (ctx->Depth.OcclusionTest) *params = (GLint) ctx->OcclusionResult; else diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index 7fb0e743b0..577d320103 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -1,4 +1,4 @@ -/* $Id: hint.c,v 1.4 2000/05/23 20:10:50 brianp Exp $ */ +/* $Id: hint.c,v 1.5 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -128,7 +128,7 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { ctx->Hint.TextureCompression = mode; } else { @@ -141,7 +141,7 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) return GL_FALSE; } - ctx->NewState |= NEW_ALL; /* just to be safe */ + ctx->NewState |= _NEW_HINT; if (ctx->Driver.Hint) { (*ctx->Driver.Hint)( ctx, target, mode ); diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index e47a5dcb2c..710c90e0cd 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,4 +1,4 @@ -/* $Id: light.c,v 1.21 2000/10/29 19:02:23 brianp Exp $ */ +/* $Id: light.c,v 1.22 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -66,7 +66,9 @@ _mesa_ShadeModel( GLenum mode ) SET_BITS(ctx->TriangleCaps, DD_FLATSHADE); else CLEAR_BITS(ctx->TriangleCaps, DD_FLATSHADE); - ctx->NewState |= NEW_RASTER_OPS; + + ctx->NewState |= _NEW_LIGHT; + if (ctx->Driver.ShadeModel) (*ctx->Driver.ShadeModel)( ctx, mode ); } @@ -185,7 +187,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) if (ctx->Driver.Lightfv) ctx->Driver.Lightfv( ctx, light, pname, params, nParams ); - ctx->NewState |= NEW_LIGHTING; + ctx->NewState |= _NEW_LIGHT; } @@ -396,7 +398,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) else { gl_error( ctx, GL_INVALID_ENUM, "glLightModel(param)" ); } - ctx->NewState |= NEW_RASTER_OPS; break; default: gl_error( ctx, GL_INVALID_ENUM, "glLightModel" ); @@ -406,7 +407,7 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) if (ctx->Driver.LightModelfv) ctx->Driver.LightModelfv( ctx, pname, params ); - ctx->NewState |= NEW_LIGHTING; + ctx->NewState |= _NEW_LIGHT; } @@ -845,6 +846,8 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) if (ctx->Light.ColorMaterialEnabled) gl_update_color_material( ctx, ctx->Current.Color ); + + ctx->NewState |= _NEW_LIGHT; } @@ -1211,30 +1214,6 @@ gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess ) -#if 0 -static void -gl_reinit_light_attrib( GLcontext *ctx, struct gl_light_attrib *l ) -{ - GLuint i; - - if (ctx->ShineTable[0]->shininess != l->Material[0].Shininess) { - gl_compute_shine_table( ctx, 0, l->Material[0].Shininess ); - gl_compute_shine_table( ctx, 2, l->Material[0].Shininess * .5 ); - } - - if (ctx->ShineTable[1]->shininess != l->Material[1].Shininess) { - gl_compute_shine_table( ctx, 1, l->Material[1].Shininess ); - gl_compute_shine_table( ctx, 3, l->Material[1].Shininess * .5 ); - } - - make_empty_list( &l->EnabledList ); - for (i = 0 ; i < MAX_LIGHTS ; i++) { - if (l->Light[i].Enabled) - insert_at_tail( &l->EnabledList, &l->Light[i] ); - } -} -#endif - /* * Examine current lighting parameters to determine if the optimized lighting @@ -1394,9 +1373,6 @@ gl_compute_light_positions( GLcontext *ctx ) void gl_update_normal_transform( GLcontext *ctx ) { - GLuint new_flag = 0; - normal_func *last = ctx->NormalTransform; - ctx->vb_rescale_factor = 1.0; if (ctx->NeedEyeCoords) { @@ -1408,9 +1384,7 @@ gl_update_normal_transform( GLcontext *ctx ) MAT_FLAG_GENERAL_3D | MAT_FLAG_PERSPECTIVE)) transform = NORM_TRANSFORM; - - new_flag = ctx->NewState & NEW_MODELVIEW; ctx->vb_rescale_factor = ctx->rescale_factor; if (ctx->Transform.Normalize) { @@ -1447,7 +1421,4 @@ gl_update_normal_transform( GLcontext *ctx ) ctx->NormalTransform = 0; } } - - if (last != ctx->NormalTransform || new_flag) - ctx->NewState |= NEW_NORMAL_TRANSFORM; } diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index df1be60a4b..f3255601ca 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -1,4 +1,4 @@ -/* $Id: lines.c,v 1.18 2000/10/28 18:34:48 brianp Exp $ */ +/* $Id: lines.c,v 1.19 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -57,7 +57,9 @@ _mesa_LineWidth( GLfloat width ) ctx->Line.Width = width; ctx->TriangleCaps &= ~DD_LINE_WIDTH; if (width != 1.0) ctx->TriangleCaps |= DD_LINE_WIDTH; - ctx->NewState |= NEW_RASTER_OPS; + + ctx->NewState |= _NEW_LINE; + if (ctx->Driver.LineWidth) (*ctx->Driver.LineWidth)(ctx, width); } @@ -72,7 +74,8 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple"); ctx->Line.StippleFactor = CLAMP( factor, 1, 256 ); ctx->Line.StipplePattern = pattern; - ctx->NewState |= NEW_RASTER_OPS; + + ctx->NewState |= _NEW_LINE; if (ctx->Driver.LineStipple) ctx->Driver.LineStipple( ctx, factor, pattern ); @@ -1099,6 +1102,9 @@ _mesa_print_line_function(GLcontext *ctx) /* * Determine which line drawing function to use given the current * rendering context. + * + * Please update the summary flag _SWRAST_NEW_LINE if you add or remove + * tests to this code. */ void gl_set_line_function( GLcontext *ctx ) { @@ -1136,7 +1142,8 @@ void gl_set_line_function( GLcontext *ctx ) } else if (ctx->Texture.ReallyEnabled) { if (ctx->Texture.MultiTextureEnabled - || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) { + || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR + || ctx->Fog.ColorSumEnabled) { /* multi-texture and/or separate specular color */ if (ctx->Light.ShadeModel==GL_SMOOTH) ctx->Driver.LineFunc = smooth_multitextured_line; diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index fe8d433110..df21d154fd 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.22 2000/10/29 18:23:16 brianp Exp $ */ +/* $Id: matrix.c,v 1.23 2000/10/30 13:32:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -85,7 +85,6 @@ void gl_print_matrix( const GLmatrix *m ) { fprintf(stderr, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); print_matrix_floats(m->m); -#if 1 fprintf(stderr, "Inverse: \n"); if (m->inv) { GLfloat prod[16]; @@ -97,7 +96,6 @@ void gl_print_matrix( const GLmatrix *m ) else { fprintf(stderr, " - not available\n"); } -#endif } @@ -132,8 +130,6 @@ static void matmul4( GLfloat *product, const GLfloat *a, const GLfloat *b ) /* Multiply two matrices known to occupy only the top three rows, * such as typical modelling matrices, and ortho matrices. - * - * KW: 3*9 = 27 muls */ static void matmul34( GLfloat *product, const GLfloat *a, const GLfloat *b ) { @@ -518,13 +514,6 @@ static inv_mat_func inv_mat_tab[7] = { static GLboolean matrix_invert( GLmatrix *mat ) { if (inv_mat_tab[mat->type](mat)) { -#if 0 - GLmatrix m; m.inv = 0; m.type = 0; m.flags = 0; - matmul4( m.m, mat->m, mat->inv ); - printf("inverted matrix of type %s:\n", types[mat->type]); - gl_print_matrix( mat ); - gl_print_matrix( &m ); -#endif return GL_TRUE; } else { MEMCPY( mat->inv, Identity, sizeof(Identity) ); @@ -905,25 +894,6 @@ void gl_matrix_analyze( GLmatrix *mat ) } -/* - * Multiply a matrix by an array of floats with known properties. - */ -#if 000 -static void gl_mat_mul_mat( GLmatrix *mat, const GLmatrix *m ) -{ - mat->flags |= (m->flags | - MAT_DIRTY_TYPE | - MAT_DIRTY_INVERSE | - MAT_DIRTY_DEPENDENTS); - - if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) - matmul34( mat->m, mat->m, m->m ); - else - matmul4( mat->m, mat->m, m->m ); -} -#endif - - static void matrix_copy( GLmatrix *to, const GLmatrix *from ) { MEMCPY( to->m, from->m, sizeof(Identity) ); @@ -991,14 +961,6 @@ void gl_matrix_dtr( GLmatrix *m ) } } -#if 0 -void gl_matrix_set_identity( GLmatrix *m ) -{ - MEMCPY( m->m, Identity, sizeof(Identity) ); - m->type = MATRIX_IDENTITY; - m->flags = MAT_DIRTY_DEPENDENTS; -} -#endif void gl_matrix_alloc_inv( GLmatrix *m ) { @@ -1037,19 +999,19 @@ do { \ switch (ctx->Transform.MatrixMode) { \ case GL_MODELVIEW: \ mat = &ctx->ModelView; \ - flags |= NEW_MODELVIEW; \ + flags |= _NEW_MODELVIEW; \ break; \ case GL_PROJECTION: \ mat = &ctx->ProjectionMatrix; \ - flags |= NEW_PROJECTION; \ + flags |= _NEW_PROJECTION; \ break; \ case GL_TEXTURE: \ mat = &ctx->TextureMatrix[ctx->Texture.CurrentTransformUnit]; \ - flags |= NEW_TEXTURE_MATRIX; \ + flags |= _NEW_TEXTURE_MATRIX; \ break; \ case GL_COLOR: \ mat = &ctx->ColorMatrix; \ - flags |= NEW_COLOR_MATRIX; \ + flags |= _NEW_COLOR_MATRIX; \ break; \ default: \ gl_problem(ctx, where); \ @@ -1242,7 +1204,7 @@ _mesa_PopMatrix( void ) } matrix_copy( &ctx->ModelView, &ctx->ModelViewStack[--ctx->ModelViewStackDepth] ); - ctx->NewState |= NEW_MODELVIEW; + ctx->NewState |= _NEW_MODELVIEW; break; case GL_PROJECTION: if (ctx->ProjectionStackDepth==0) { @@ -1252,7 +1214,7 @@ _mesa_PopMatrix( void ) matrix_copy( &ctx->ProjectionMatrix, &ctx->ProjectionStack[--ctx->ProjectionStackDepth] ); - ctx->NewState |= NEW_PROJECTION; + ctx->NewState |= _NEW_PROJECTION; /* Device driver near/far values */ { @@ -1272,6 +1234,7 @@ _mesa_PopMatrix( void ) } matrix_copy(&ctx->TextureMatrix[t], &ctx->TextureStack[t][--ctx->TextureStackDepth[t]]); + ctx->NewState |= _NEW_TEXTURE_MATRIX; } break; case GL_COLOR: @@ -1281,6 +1244,7 @@ _mesa_PopMatrix( void ) } matrix_copy(&ctx->ColorMatrix, &ctx->ColorStack[--ctx->ColorStackDepth]); + ctx->NewState |= _NEW_COLOR_MATRIX; break; default: gl_problem(ctx, "Bad matrix mode in gl_PopMatrix"); @@ -1565,9 +1529,7 @@ gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) ctx->Viewport.WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; ctx->Viewport.WindowMap.type = MATRIX_3D_NO_ROT; - - ctx->ModelProjectWinMatrixUptodate = GL_FALSE; - ctx->NewState |= NEW_VIEWPORT; + ctx->NewState |= _NEW_VIEWPORT; /* Check if window/buffer has been resized and if so, reallocate the * ancillary buffers. @@ -1620,8 +1582,7 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval ) ctx->Viewport.Far = f; ctx->Viewport.WindowMap.m[MAT_SZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0); ctx->Viewport.WindowMap.m[MAT_TZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0 + n); - - ctx->ModelProjectWinMatrixUptodate = GL_FALSE; + ctx->NewState |= _NEW_VIEWPORT; if (ctx->Driver.DepthRange) { (*ctx->Driver.DepthRange)( ctx, nearval, farval ); diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 131db1dfdd..4cd73efbf9 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1,4 +1,4 @@ -/* $Id: pixel.c,v 1.16 2000/10/29 18:12:15 brianp Exp $ */ +/* $Id: pixel.c,v 1.17 2000/10/30 13:32:01 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -53,6 +53,7 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) ctx->Pixel.ZoomX = xfactor; ctx->Pixel.ZoomY = yfactor; + ctx->NewState |= _NEW_PIXEL; } @@ -177,6 +178,8 @@ _mesa_PixelStorei( GLenum pname, GLint param ) default: gl_error( ctx, GL_INVALID_ENUM, "glPixelStore" ); } + + ctx->NewState |= _NEW_PACKUNPACK; } @@ -295,6 +298,7 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) default: gl_error( ctx, GL_INVALID_ENUM, "glPixelMapfv(map)" ); } + ctx->NewState |= _NEW_PIXEL; } @@ -629,6 +633,7 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) /* signal to recompute the bitmask */ ctx->ImageTransferState = UPDATE_IMAGE_TRANSFER_STATE; + ctx->NewState |= _NEW_PIXEL; } diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index c23980ff7e..5f42cd0371 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -1,4 +1,4 @@ -/* $Id: points.c,v 1.17 2000/10/28 18:34:48 brianp Exp $ */ +/* $Id: points.c,v 1.18 2000/10/30 13:32:01 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -60,7 +60,7 @@ _mesa_PointSize( GLfloat size ) ctx->TriangleCaps &= ~DD_POINT_SIZE; if (size != 1.0) ctx->TriangleCaps |= DD_POINT_SIZE; - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_POINT; } } @@ -91,7 +91,6 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) if (tmp != ctx->Point.Attenuated) { ctx->Enabled ^= ENABLE_POINT_ATTEN; ctx->TriangleCaps ^= DD_POINT_ATTEN; - ctx->NewState |= NEW_RASTER_OPS; } } break; @@ -121,7 +120,7 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) return; } - ctx->NewState |= NEW_RASTER_OPS; + ctx->NewState |= _NEW_POINT; } diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index c96d3355b3..b4a7172dbd 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -1,4 +1,4 @@ -/* $Id: polygon.c,v 1.13 2000/10/21 00:02:47 brianp Exp $ */ +/* $Id: polygon.c,v 1.14 2000/10/30 13:32:01 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -55,7 +55,7 @@ _mesa_CullFace( GLenum mode ) } ctx->Polygon.CullFaceMode = mode; - ctx->NewState |= NEW_POLYGON; + ctx->NewState |= _NEW_POLYGON; if (ctx->Driver.CullFace) ctx->Driver.CullFace( ctx, mode ); @@ -79,7 +79,7 @@ _mesa_FrontFace( GLenum mode ) ctx->Polygon.FrontFace = mode; ctx->Polygon.FrontBit = (GLboolean) (mode == GL_CW); - ctx->NewState |= NEW_POLYGON; + ctx->NewState |= _NEW_POLYGON; if (ctx->Driver.FrontFace) ctx->Driver.FrontFace( ctx, mode ); @@ -123,7 +123,7 @@ _mesa_PolygonMode( GLenum face, GLenum mode ) ctx->TriangleCaps |= DD_TRI_UNFILLED; } - ctx->NewState |= (NEW_POLYGON | NEW_RASTER_OPS); + ctx->NewState |= _NEW_POLYGON; if (ctx->Driver.PolygonMode) { (*ctx->Driver.PolygonMode)( ctx, face, mode ); @@ -143,9 +143,7 @@ _mesa_PolygonStipple( const GLubyte *pattern ) _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack); - if (ctx->Polygon.StippleFlag) { - ctx->NewState |= NEW_RASTER_OPS; - } + ctx->NewState |= _NEW_POLYGONSTIPPLE; if (ctx->Driver.PolygonStipple) ctx->Driver.PolygonStipple( ctx, (const GLubyte *) ctx->PolygonStipple ); @@ -179,6 +177,7 @@ _mesa_PolygonOffset( GLfloat factor, GLfloat units ) ctx->Polygon.OffsetFactor = factor; ctx->Polygon.OffsetUnits = units; ctx->Polygon.OffsetMRD = units * ctx->Visual.MRD; + ctx->NewState |= _NEW_POLYGON; } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 4338462984..13ed623dcc 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.36 2000/10/29 18:12:15 brianp Exp $ */ +/* $Id: state.c,v 1.37 2000/10/30 13:32:01 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -762,23 +762,36 @@ static void update_rasterflags( GLcontext *ctx ) void gl_print_state( const char *msg, GLuint state ) { fprintf(stderr, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, state, - (state & NEW_LIGHTING) ? "lighting, " : "", - (state & NEW_RASTER_OPS) ? "raster-ops, " : "", - (state & NEW_TEXTURING) ? "texturing, " : "", - (state & NEW_POLYGON) ? "polygon, " : "", - (state & NEW_MODELVIEW) ? "modelview, " : "", - (state & NEW_PROJECTION) ? "projection, " : "", - (state & NEW_TEXTURE_MATRIX) ? "texture-matrix, " : "", - (state & NEW_USER_CLIP) ? "user-clip, " : "", - (state & NEW_TEXTURE_ENV) ? "texture-env, " : "", - (state & NEW_CLIENT_STATE) ? "client-state, " : "", - (state & NEW_FOG) ? "fog, " : "", - (state & NEW_NORMAL_TRANSFORM) ? "normal-transform, " : "", - (state & NEW_VIEWPORT) ? "viewport, " : "", - (state & NEW_TEXTURE_ENABLE) ? "texture-enable, " : ""); + (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", + (state & _NEW_PROJECTION) ? "ctx->Projection, " : "", + (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "", + (state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "", + (state & _NEW_ACCUM) ? "ctx->Accum, " : "", + (state & _NEW_COLOR) ? "ctx->Color, " : "", + (state & _NEW_DEPTH) ? "ctx->Depth, " : "", + (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "", + (state & _NEW_FOG) ? "ctx->Fog, " : "", + (state & _NEW_HINT) ? "ctx->Hint, " : "", + (state & _NEW_IMAGING) ? "ctx->Histogram/MinMax/Convolve/Seperable, ": "", + (state & _NEW_LIGHT) ? "ctx->Light, " : "", + (state & _NEW_LINE) ? "ctx->Line, " : "", + (state & _NEW_FEEDBACK_SELECT) ? "ctx->Feedback/Select, " : "", + (state & _NEW_PIXEL) ? "ctx->Pixel, " : "", + (state & _NEW_POINT) ? "ctx->Point, " : "", + (state & _NEW_POLYGON) ? "ctx->Polygon, " : "", + (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "", + (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "", + (state & _NEW_TEXTURE) ? "ctx->Texture, " : "", + (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "", + (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "", + (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "", + (state & _NEW_ARRAY) ? "ctx->Array, " : "", + (state & _NEW_COLORTABLE) ? "ctx->{*}ColorTable, " : "", + (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "", + (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : ""); } @@ -814,30 +827,10 @@ void gl_update_state( GLcontext *ctx ) if (MESA_VERBOSE & VERBOSE_STATE) gl_print_state("", ctx->NewState); - if (ctx->NewState & NEW_CLIENT_STATE) + if (ctx->NewState & _NEW_ARRAY) gl_update_client_state( ctx ); - if ((ctx->NewState & NEW_TEXTURE_ENABLE) && - (ctx->Enabled & ENABLE_TEX_ANY) != ctx->Texture.ReallyEnabled) - ctx->NewState |= NEW_TEXTURING | NEW_RASTER_OPS; - - if (ctx->NewState & NEW_TEXTURE_ENV) { - if (ctx->Texture.Unit[0].EnvMode == ctx->Texture.Unit[0].LastEnvMode && - ctx->Texture.Unit[1].EnvMode == ctx->Texture.Unit[1].LastEnvMode -#if MAX_TEXTURE_UNITS > 2 - && ctx->Texture.Unit[2].EnvMode == ctx->Texture.Unit[2].LastEnvMode -#endif - ) { - ctx->NewState &= ~NEW_TEXTURE_ENV; - } - ctx->Texture.Unit[0].LastEnvMode = ctx->Texture.Unit[0].EnvMode; - ctx->Texture.Unit[1].LastEnvMode = ctx->Texture.Unit[1].EnvMode; -#if MAX_TEXTURE_UNITS > 2 - ctx->Texture.Unit[2].LastEnvMode = ctx->Texture.Unit[2].EnvMode; -#endif - } - - if (ctx->NewState & NEW_TEXTURE_MATRIX) { + if (ctx->NewState & _NEW_TEXTURE_MATRIX) { ctx->Enabled &= ~(ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | ENABLE_TEXMAT2); for (i=0; i < ctx->Const.MaxTextureUnits; i++) { @@ -852,7 +845,7 @@ void gl_update_state( GLcontext *ctx ) } } - if (ctx->NewState & (NEW_TEXTURING | NEW_TEXTURE_ENABLE)) { + if (ctx->NewState & _NEW_TEXTURE) { ctx->Texture.MultiTextureEnabled = GL_FALSE; ctx->Texture.NeedNormals = GL_FALSE; gl_update_dirty_texobjs(ctx); @@ -892,9 +885,10 @@ void gl_update_state( GLcontext *ctx ) } - if (ctx->NewState & NEW_RASTER_OPS) { + if (ctx->NewState & _SWRAST_NEW_RASTERMASK) update_rasterflags(ctx); - + + if (ctx->NewState & (_NEW_BUFFERS|_NEW_SCISSOR)) { /* update scissor region */ ctx->DrawBuffer->Xmin = 0; ctx->DrawBuffer->Ymin = 0; @@ -916,7 +910,7 @@ void gl_update_state( GLcontext *ctx ) } } - if (ctx->NewState & NEW_LIGHTING) { + if (ctx->NewState & _NEW_LIGHT) { ctx->TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL); if (ctx->Light.Enabled) { if (ctx->Light.Model.TwoSide) @@ -925,11 +919,11 @@ void gl_update_state( GLcontext *ctx ) } } - if (ctx->NewState & (NEW_POLYGON | NEW_LIGHTING)) { + if (ctx->NewState & (_NEW_POLYGON | _NEW_LIGHT)) { ctx->TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK; - if (ctx->NewState & NEW_POLYGON) { + if (ctx->NewState & _NEW_POLYGON) { /* Setup CullBits bitmask */ if (ctx->Polygon.CullFlag) { ctx->backface_sign = 1; @@ -967,16 +961,13 @@ void gl_update_state( GLcontext *ctx ) } } - if (ctx->NewState & ~(NEW_CLIENT_STATE | NEW_USER_CLIP | NEW_POLYGON)) + if (ctx->NewState & (_NEW_LIGHT| + _NEW_TEXTURE| + _NEW_FOG| + _NEW_POLYGON)) gl_update_clipmask(ctx); - if (ctx->NewState & (NEW_LIGHTING| - NEW_RASTER_OPS| - NEW_TEXTURING| - NEW_TEXTURE_ENABLE| - NEW_TEXTURE_ENV| - NEW_POLYGON| - NEW_USER_CLIP)) + if (ctx->NewState & ctx->Driver.UpdateStateNotify) { ctx->IndirectTriangles = ctx->TriangleCaps & ~ctx->Driver.TriangleCaps; ctx->IndirectTriangles |= DD_SW_RASTERIZE; @@ -1027,13 +1018,13 @@ void gl_update_state( GLcontext *ctx ) /* Should only be calc'd when !need_eye_coords and not culling. */ - if (ctx->NewState & (NEW_MODELVIEW|NEW_PROJECTION)) { - if (ctx->NewState & NEW_MODELVIEW) { + if (ctx->NewState & (_NEW_MODELVIEW|_NEW_PROJECTION)) { + if (ctx->NewState & _NEW_MODELVIEW) { gl_matrix_analyze( &ctx->ModelView ); ctx->ProjectionMatrix.flags &= ~MAT_DIRTY_DEPENDENTS; } - if (ctx->NewState & NEW_PROJECTION) { + if (ctx->NewState & _NEW_PROJECTION) { gl_matrix_analyze( &ctx->ProjectionMatrix ); ctx->ProjectionMatrix.flags &= ~MAT_DIRTY_DEPENDENTS; @@ -1043,10 +1034,9 @@ void gl_update_state( GLcontext *ctx ) } gl_calculate_model_project_matrix( ctx ); - ctx->ModelProjectWinMatrixUptodate = 0; } - if (ctx->NewState & NEW_COLOR_MATRIX) { + if (ctx->NewState & _NEW_COLOR_MATRIX) { gl_matrix_analyze( &ctx->ColorMatrix ); } @@ -1055,13 +1045,15 @@ void gl_update_state( GLcontext *ctx ) */ if ((ctx->Enabled & (ENABLE_POINT_ATTEN | ENABLE_LIGHT | ENABLE_FOG | ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | ENABLE_TEXGEN2)) && - (ctx->NewState & (NEW_LIGHTING | - NEW_FOG | - NEW_MODELVIEW | - NEW_PROJECTION | - NEW_TEXTURING | - NEW_RASTER_OPS | - NEW_USER_CLIP))) + (ctx->NewState & (_NEW_LIGHT | + _NEW_TEXTURE | + _NEW_FOG | + _NEW_TRANSFORM | + _NEW_MODELVIEW | + _NEW_PROJECTION | + _NEW_POINT | + _NEW_RENDERMODE | + _NEW_TRANSFORM))) { GLboolean oldcoord, oldnorm; @@ -1069,8 +1061,7 @@ void gl_update_state( GLcontext *ctx ) oldnorm = ctx->NeedEyeNormals; ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals); - ctx->NeedEyeCoords = ((ctx->Fog.Enabled && ctx->Hint.Fog != GL_NICEST) || - ctx->Point.Attenuated); + ctx->NeedEyeCoords = (ctx->Fog.Enabled || ctx->Point.Attenuated); ctx->NeedEyeNormals = GL_FALSE; if (ctx->Light.Enabled) { @@ -1098,8 +1089,8 @@ void gl_update_state( GLcontext *ctx ) if (ctx->Light.Enabled) { gl_update_lighting_function(ctx); - if ( (ctx->NewState & NEW_LIGHTING) || - ((ctx->NewState & (NEW_MODELVIEW| NEW_PROJECTION)) && + if ( (ctx->NewState & _NEW_LIGHT) || + ((ctx->NewState & (_NEW_MODELVIEW|_NEW_PROJECTION)) && !ctx->NeedEyeCoords) || oldcoord != ctx->NeedEyeCoords || oldnorm != ctx->NeedEyeNormals) { diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index a2c8bf4e95..2dcecced56 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -1,4 +1,4 @@ -/* $Id: stencil.c,v 1.20 2000/10/29 18:23:16 brianp Exp $ */ +/* $Id: stencil.c,v 1.21 2000/10/30 13:32:01 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -48,6 +48,7 @@ _mesa_ClearStencil( GLint s ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearStencil"); ctx->Stencil.Clear = (GLstencil) s; + ctx->NewState |= _NEW_STENCIL; if (ctx->Driver.ClearStencil) { (*ctx->Driver.ClearStencil)( ctx, s ); @@ -83,6 +84,7 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) maxref = (1 << STENCIL_BITS) - 1; ctx->Stencil.Ref = (GLstencil) CLAMP( ref, 0, maxref ); ctx->Stencil.ValueMask = (GLstencil) mask; + ctx->NewState |= _NEW_STENCIL; if (ctx->Driver.StencilFunc) { (*ctx->Driver.StencilFunc)( ctx, func, ctx->Stencil.Ref, mask ); @@ -97,6 +99,7 @@ _mesa_StencilMask( GLuint mask ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilMask"); ctx->Stencil.WriteMask = (GLstencil) mask; + ctx->NewState |= _NEW_STENCIL; if (ctx->Driver.StencilMask) { (*ctx->Driver.StencilMask)( ctx, mask ); @@ -121,7 +124,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: - if (ctx->Extensions.HaveStencilWrap) { + if (ctx->Extensions.EXT_stencil_wrap) { ctx->Stencil.FailFunc = fail; break; } @@ -141,7 +144,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: - if (ctx->Extensions.HaveStencilWrap) { + if (ctx->Extensions.EXT_stencil_wrap) { ctx->Stencil.ZFailFunc = zfail; break; } @@ -161,7 +164,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: - if (ctx->Extensions.HaveStencilWrap) { + if (ctx->Extensions.EXT_stencil_wrap) { ctx->Stencil.ZPassFunc = zpass; break; } @@ -171,6 +174,8 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) return; } + ctx->NewState |= _NEW_STENCIL; + if (ctx->Driver.StencilOp) { (*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass); } diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 570ecdc01c..4a6258e89b 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.55 2000/10/29 18:23:16 brianp Exp $ */ +/* $Id: teximage.c,v 1.56 2000/10/30 13:32:01 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -561,10 +561,10 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - return ctx->Extensions.HaveTextureCubeMap + return ctx->Extensions.ARB_texture_cube_map ? texUnit->CurrentCubeMap : NULL; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: - return ctx->Extensions.HaveTextureCubeMap + return ctx->Extensions.ARB_texture_cube_map ? ctx->Texture.ProxyCubeMap : NULL; default: gl_problem(NULL, "bad target in _mesa_select_tex_object()"); @@ -596,37 +596,37 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, case GL_PROXY_TEXTURE_3D: return ctx->Texture.Proxy3D->Image[level]; case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) return texUnit->CurrentCubeMap->Image[level]; else return NULL; case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) return texUnit->CurrentCubeMap->NegX[level]; else return NULL; case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) return texUnit->CurrentCubeMap->PosY[level]; else return NULL; case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) return texUnit->CurrentCubeMap->NegY[level]; else return NULL; case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) return texUnit->CurrentCubeMap->PosZ[level]; else return NULL; case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) return texUnit->CurrentCubeMap->NegZ[level]; else return NULL; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) + if (ctx->Extensions.ARB_texture_cube_map) return ctx->Texture.ProxyCubeMap->Image[level]; else return NULL; @@ -1062,7 +1062,7 @@ texture_error_check( GLcontext *ctx, GLenum target, else if (dimensions == 2) { isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_2D); if (target != GL_TEXTURE_2D && !isProxy && - !(ctx->Extensions.HaveTextureCubeMap && + !(ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { gl_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" ); @@ -1200,7 +1200,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, } } else if (dimensions == 2) { - if (ctx->Extensions.HaveTextureCubeMap) { + if (ctx->Extensions.ARB_texture_cube_map) { if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && target != GL_TEXTURE_2D) { @@ -1315,7 +1315,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, } } else if (dimensions == 2) { - if (ctx->Extensions.HaveTextureCubeMap) { + if (ctx->Extensions.ARB_texture_cube_map) { if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && target != GL_TEXTURE_2D) { @@ -1403,7 +1403,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, } } else if (dimensions == 2) { - if (ctx->Extensions.HaveTextureCubeMap) { + if (ctx->Extensions.ARB_texture_cube_map) { if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && target != GL_TEXTURE_2D) { @@ -1521,7 +1521,7 @@ get_specific_compressed_tex_format(GLcontext *ctx, char message[100]; GLint internalFormat = ifmt; - if (ctx->Extensions.HaveTextureCompression + if (ctx->Extensions.ARB_texture_compression && ctx->Driver.SpecificCompressedTexFormat) { /* * First, ask the driver for the specific format. @@ -1543,7 +1543,7 @@ get_specific_compressed_tex_format(GLcontext *ctx, */ switch (internalFormat) { case GL_COMPRESSED_ALPHA_ARB: - if (ctx && !ctx->Extensions.HaveTextureCompression) { + if (ctx && !ctx->Extensions.ARB_texture_compression) { sprintf(message, "glTexImage%dD(internalFormat)", numDimensions); gl_error(ctx, GL_INVALID_VALUE, message); return -1; @@ -1551,7 +1551,7 @@ get_specific_compressed_tex_format(GLcontext *ctx, internalFormat = GL_ALPHA; break; case GL_COMPRESSED_LUMINANCE_ARB: - if (ctx && !ctx->Extensions.HaveTextureCompression) { + if (ctx && !ctx->Extensions.ARB_texture_compression) { sprintf(message, "glTexImage%dD(internalFormat)", numDimensions); gl_error(ctx, GL_INVALID_VALUE, message); return -1; @@ -1559,7 +1559,7 @@ get_specific_compressed_tex_format(GLcontext *ctx, internalFormat = GL_LUMINANCE; break; case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - if (ctx && !ctx->Extensions.HaveTextureCompression) { + if (ctx && !ctx->Extensions.ARB_texture_compression) { sprintf(message, "glTexImage%dD(internalFormat)", numDimensions); gl_error(ctx, GL_INVALID_VALUE, message); return -1; @@ -1567,7 +1567,7 @@ get_specific_compressed_tex_format(GLcontext *ctx, internalFormat = GL_LUMINANCE_ALPHA; break; case GL_COMPRESSED_INTENSITY_ARB: - if (ctx && !ctx->Extensions.HaveTextureCompression) { + if (ctx && !ctx->Extensions.ARB_texture_compression) { sprintf(message, "glTexImage%dD(internalFormat)", numDimensions); gl_error(ctx, GL_INVALID_VALUE, message); return -1; @@ -1575,7 +1575,7 @@ get_specific_compressed_tex_format(GLcontext *ctx, internalFormat = GL_INTENSITY; break; case GL_COMPRESSED_RGB_ARB: - if (ctx && !ctx->Extensions.HaveTextureCompression) { + if (ctx && !ctx->Extensions.ARB_texture_compression) { sprintf(message, "glTexImage%dD(internalFormat)", numDimensions); gl_error(ctx, GL_INVALID_VALUE, message); return -1; @@ -1583,7 +1583,7 @@ get_specific_compressed_tex_format(GLcontext *ctx, internalFormat = GL_RGB; break; case GL_COMPRESSED_RGBA_ARB: - if (ctx && !ctx->Extensions.HaveTextureCompression) { + if (ctx && !ctx->Extensions.ARB_texture_compression) { sprintf(message, "glTexImage%dD(internalFormat)", numDimensions); gl_error(ctx, GL_INVALID_VALUE, message); return -1; @@ -1702,7 +1702,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, /* state update */ gl_put_texobj_on_dirty_list( ctx, texObj ); - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ @@ -1747,7 +1747,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, adjust_texture_size_for_convolution(ctx, 2, &postConvWidth,&postConvHeight); if (target==GL_TEXTURE_2D || - (ctx->Extensions.HaveTextureCubeMap && + (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { struct gl_texture_unit *texUnit; @@ -1850,7 +1850,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, /* state update */ gl_put_texobj_on_dirty_list( ctx, texObj ); - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_2D) { /* Proxy texture: check for errors and update proxy state */ @@ -1984,7 +1984,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, /* state update */ gl_put_texobj_on_dirty_list( ctx, texObj ); - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ @@ -2977,7 +2977,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, /* state update */ gl_put_texobj_on_dirty_list( ctx, texObj ); - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ @@ -3031,7 +3031,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, } if (target==GL_TEXTURE_2D || - (ctx->Extensions.HaveTextureCubeMap && + (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { struct gl_texture_unit *texUnit; @@ -3112,7 +3112,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, /* state update */ gl_put_texobj_on_dirty_list( ctx, texObj ); - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_2D) { /* Proxy texture: check for errors and update proxy state */ @@ -3241,7 +3241,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, /* state update */ gl_put_texobj_on_dirty_list( ctx, texObj ); - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 62238ff6fd..d873351617 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,4 +1,4 @@ -/* $Id: texobj.c,v 1.30 2000/10/29 18:23:16 brianp Exp $ */ +/* $Id: texobj.c,v 1.31 2000/10/30 13:32:01 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -485,6 +485,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName) ctx->Shared->DefaultD[d]->RefCount++; t->RefCount--; ASSERT( t->RefCount >= 0 ); + ctx->NewState |= _NEW_TEXTURE; } } } @@ -537,7 +538,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) oldTexObj = texUnit->CurrentD[3]; break; case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) { + if (ctx->Extensions.ARB_texture_cube_map) { dim = 6; oldTexObj = texUnit->CurrentCubeMap; break; @@ -598,28 +599,11 @@ _mesa_BindTexture( GLenum target, GLuint texName ) */ texUnit->Current = texUnit->CurrentD[texUnit->CurrentDimension]; - /* Check if we may have to use a new triangle rasterizer */ - if ((ctx->IndirectTriangles & DD_SW_RASTERIZE) && - ( oldTexObj->WrapS != newTexObj->WrapS - || oldTexObj->WrapT != newTexObj->WrapT - || oldTexObj->WrapR != newTexObj->WrapR - || oldTexObj->MinFilter != newTexObj->MinFilter - || oldTexObj->MagFilter != newTexObj->MagFilter - || (oldTexObj->Image[0] && newTexObj->Image[0] && - (oldTexObj->Image[0]->Format!=newTexObj->Image[0]->Format)))) - { - ctx->NewState |= (NEW_RASTER_OPS | NEW_TEXTURING); - } - - if (oldTexObj->Complete != newTexObj->Complete) - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; /* Pass BindTexture call to device driver */ - if (ctx->Driver.BindTexture) { + if (ctx->Driver.BindTexture) (*ctx->Driver.BindTexture)( ctx, target, newTexObj ); - /* Make sure the Driver.UpdateState() function gets called! */ - ctx->NewState |= NEW_TEXTURING; - } if (oldTexObj->Name > 0) { /* never delete default (id=0) texture objects */ @@ -665,6 +649,8 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, } } } + + ctx->NewState |= _NEW_TEXTURE; } diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 309b54fe80..61dd4a2016 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.18 2000/10/28 20:41:14 brianp Exp $ */ +/* $Id: texstate.c,v 1.19 2000/10/30 13:32:01 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -84,19 +84,18 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_ADD: case GL_COMBINE_EXT: if (mode == GL_ADD && - !ctx->Extensions.HaveTextureEnvAdd) { + !ctx->Extensions.EXT_texture_env_add) { gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); return; } if (mode == GL_COMBINE_EXT && - !ctx->Extensions.HaveTextureEnvCombine) { + !ctx->Extensions.EXT_texture_env_combine) { gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); return; } if (texUnit->EnvMode == mode) return; /* no change */ texUnit->EnvMode = mode; - ctx->NewState |= NEW_TEXTURE_ENV; break; default: gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); @@ -111,7 +110,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F ); break; case GL_COMBINE_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { GLenum mode = (GLenum) (GLint) *param; switch (mode) { case GL_REPLACE: @@ -122,7 +121,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) if (texUnit->CombineModeRGB == mode) return; /* no change */ texUnit->CombineModeRGB = mode; - ctx->NewState |= NEW_TEXTURE_ENV; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); @@ -135,7 +133,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } break; case GL_COMBINE_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { GLenum mode = (GLenum) (GLint) *param; switch (mode) { case GL_REPLACE: @@ -146,7 +144,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) if (texUnit->CombineModeA == mode) return; /* no change */ texUnit->CombineModeA = mode; - ctx->NewState |= NEW_TEXTURE_ENV; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); @@ -161,7 +158,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_SOURCE0_RGB_EXT: case GL_SOURCE1_RGB_EXT: case GL_SOURCE2_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { GLenum source = (GLenum) (GLint) *param; GLuint s = pname - GL_SOURCE0_RGB_EXT; switch (source) { @@ -172,7 +169,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) if (texUnit->CombineSourceRGB[s] == source) return; /* no change */ texUnit->CombineSourceRGB[s] = source; - ctx->NewState |= NEW_TEXTURE_ENV; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); @@ -187,7 +183,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_SOURCE0_ALPHA_EXT: case GL_SOURCE1_ALPHA_EXT: case GL_SOURCE2_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { GLenum source = (GLenum) (GLint) *param; GLuint s = pname - GL_SOURCE0_ALPHA_EXT; switch (source) { @@ -197,7 +193,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_PREVIOUS_EXT: if (texUnit->CombineSourceA[s] == source) return; texUnit->CombineSourceA[s] = source; - ctx->NewState |= NEW_TEXTURE_ENV; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); @@ -211,7 +206,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) break; case GL_OPERAND0_RGB_EXT: case GL_OPERAND1_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { GLenum operand = (GLenum) (GLint) *param; GLuint s = pname - GL_OPERAND0_RGB_EXT; switch (operand) { @@ -220,7 +215,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: texUnit->CombineOperandRGB[s] = operand; - ctx->NewState |= NEW_TEXTURE_ENV; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); @@ -234,14 +228,13 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) break; case GL_OPERAND0_ALPHA_EXT: case GL_OPERAND1_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { GLenum operand = (GLenum) (GLint) *param; switch (operand) { case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] = operand; - ctx->NewState |= NEW_TEXTURE_ENV; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); @@ -254,10 +247,9 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } break; case GL_OPERAND2_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { if ((GLenum) (GLint) *param == GL_SRC_ALPHA) { texUnit->CombineOperandRGB[2] = (GLenum) (GLint) *param; - ctx->NewState |= NEW_TEXTURE_ENV; } else { gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); @@ -270,10 +262,9 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } break; case GL_OPERAND2_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { if ((GLenum) (GLint) *param == GL_SRC_ALPHA) { texUnit->CombineOperandA[2] = (GLenum) (GLint) *param; - ctx->NewState |= NEW_TEXTURE_ENV; } else { gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); @@ -286,18 +277,15 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } break; case GL_RGB_SCALE_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { if (*param == 1.0) { texUnit->CombineScaleShiftRGB = 0; - ctx->NewState |= NEW_TEXTURE_ENV; } else if (*param == 2.0) { texUnit->CombineScaleShiftRGB = 1; - ctx->NewState |= NEW_TEXTURE_ENV; } else if (*param == 4.0) { texUnit->CombineScaleShiftRGB = 2; - ctx->NewState |= NEW_TEXTURE_ENV; } else { gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); @@ -310,18 +298,15 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } break; case GL_ALPHA_SCALE: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { if (*param == 1.0) { texUnit->CombineScaleShiftA = 0; - ctx->NewState |= NEW_TEXTURE_ENV; } else if (*param == 2.0) { texUnit->CombineScaleShiftA = 1; - ctx->NewState |= NEW_TEXTURE_ENV; } else if (*param == 4.0) { texUnit->CombineScaleShiftA = 2; - ctx->NewState |= NEW_TEXTURE_ENV; } else { gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); @@ -339,7 +324,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } } else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) { - if (!ctx->Extensions.HaveTextureLodBias) { + if (!ctx->Extensions.EXT_texture_lod_bias) { gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); return; } @@ -368,6 +353,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) (*ctx->Driver.TexEnv)( ctx, target, pname, param ); } + ctx->NewState |= _NEW_TEXTURE; } @@ -422,7 +408,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) COPY_4FV( params, texUnit->EnvColor ); break; case GL_RGB_SCALE_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { if (texUnit->CombineScaleShiftRGB == 0) *params = 1.0; else if (texUnit->CombineScaleShiftRGB == 1) @@ -436,7 +422,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) } break; case GL_ALPHA_SCALE: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { if (texUnit->CombineScaleShiftA == 0) *params = 1.0; else if (texUnit->CombineScaleShiftA == 1) @@ -479,7 +465,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] ); break; case GL_COMBINE_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineModeRGB; } else { @@ -487,7 +473,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_COMBINE_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineModeA; } else { @@ -495,7 +481,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_SOURCE0_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineSourceRGB[0]; } else { @@ -503,7 +489,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_SOURCE1_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineSourceRGB[1]; } else { @@ -511,7 +497,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_SOURCE2_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineSourceRGB[2]; } else { @@ -519,7 +505,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_SOURCE0_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineSourceA[0]; } else { @@ -527,7 +513,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_SOURCE1_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineSourceA[1]; } else { @@ -535,7 +521,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_SOURCE2_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineSourceA[2]; } else { @@ -543,7 +529,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_OPERAND0_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineOperandRGB[0]; } else { @@ -551,7 +537,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_OPERAND1_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineOperandRGB[1]; } else { @@ -559,7 +545,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_OPERAND2_RGB_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineOperandRGB[2]; } else { @@ -567,7 +553,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_OPERAND0_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineOperandA[0]; } else { @@ -575,7 +561,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_OPERAND1_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineOperandA[1]; } else { @@ -583,7 +569,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) } break; case GL_OPERAND2_ALPHA_EXT: - if (ctx->Extensions.HaveTextureEnvCombine) { + if (ctx->Extensions.EXT_texture_env_combine) { *params = (GLint) texUnit->CombineOperandA[2]; } else { @@ -638,7 +624,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) texObj = texUnit->CurrentD[3]; break; case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.HaveTextureCubeMap) { + if (ctx->Extensions.ARB_texture_cube_map) { texObj = texUnit->CurrentCubeMap; break; } @@ -660,7 +646,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) || eparam==GL_NEAREST_MIPMAP_LINEAR || eparam==GL_LINEAR_MIPMAP_LINEAR) { texObj->MinFilter = eparam; - ctx->NewState |= NEW_TEXTURING; } else { gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); @@ -674,7 +659,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) if (eparam==GL_NEAREST || eparam==GL_LINEAR) { texObj->MagFilter = eparam; - ctx->NewState |= NEW_TEXTURING; } else { gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); @@ -687,7 +671,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) if (eparam==GL_CLAMP || eparam==GL_REPEAT || eparam==GL_CLAMP_TO_EDGE) { texObj->WrapS = eparam; - ctx->NewState |= NEW_TEXTURING; } else { gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); @@ -700,7 +683,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) if (eparam==GL_CLAMP || eparam==GL_REPEAT || eparam==GL_CLAMP_TO_EDGE) { texObj->WrapT = eparam; - ctx->NewState |= NEW_TEXTURING; } else { gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); @@ -713,7 +695,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) if (eparam==GL_CLAMP || eparam==GL_REPEAT || eparam==GL_CLAMP_TO_EDGE) { texObj->WrapR = eparam; - ctx->NewState |= NEW_TEXTURING; } else { gl_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); @@ -727,11 +708,9 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) break; case GL_TEXTURE_MIN_LOD: texObj->MinLod = params[0]; - ctx->NewState |= NEW_TEXTURING; break; case GL_TEXTURE_MAX_LOD: texObj->MaxLod = params[0]; - ctx->NewState |= NEW_TEXTURING; break; case GL_TEXTURE_BASE_LEVEL: if (params[0] < 0.0) { @@ -739,7 +718,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) return; } texObj->BaseLevel = (GLint) params[0]; - ctx->NewState |= NEW_TEXTURING; break; case GL_TEXTURE_MAX_LEVEL: if (params[0] < 0.0) { @@ -747,7 +725,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) return; } texObj->MaxLevel = (GLint) params[0]; - ctx->NewState |= NEW_TEXTURING; break; case GL_TEXTURE_PRIORITY: /* (keithh@netcomuk.co.uk) */ @@ -758,6 +735,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) return; } + ctx->NewState |= _NEW_TEXTURE; gl_put_texobj_on_dirty_list( ctx, texObj ); if (ctx->Driver.TexParameter) { @@ -810,7 +788,7 @@ tex_image_dimensions(GLcontext *ctx, GLenum target) return 3; case GL_TEXTURE_CUBE_MAP_ARB: case GL_PROXY_TEXTURE_CUBE_MAP_ARB: - return ctx->Extensions.HaveTextureCubeMap ? 2 : 0; + return ctx->Extensions.ARB_texture_cube_map ? 2 : 0; default: gl_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); return 0; @@ -907,7 +885,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { if (img->IsCompressed && !isProxy) *params = img->CompressedSize; else @@ -919,7 +897,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, } return; case GL_TEXTURE_COMPRESSED_ARB: - if (ctx->Extensions.HaveTextureCompression) { + if (ctx->Extensions.ARB_texture_compression) { *params = (GLint) img->IsCompressed; } else { @@ -1280,7 +1258,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) return; } - ctx->NewState |= NEW_TEXTURING; + ctx->NewState |= _NEW_TEXTURE; } @@ -1608,6 +1586,7 @@ _mesa_ActiveTextureARB( GLenum target ) if (ctx->Driver.ActiveTexture) { (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit ); } + ctx->NewState |= _NEW_TEXTURE; } else { gl_error(ctx, GL_INVALID_OPERATION, "glActiveTextureARB(target)"); @@ -1627,6 +1606,7 @@ _mesa_ClientActiveTextureARB( GLenum target ) if (target >= GL_TEXTURE0_ARB && target < GL_TEXTURE0_ARB + maxUnits) { GLint texUnit = target - GL_TEXTURE0_ARB; ctx->Array.ActiveTexture = texUnit; + ctx->NewState |= _NEW_ARRAY; } else { gl_error(ctx, GL_INVALID_OPERATION, "glActiveTextureARB(target)"); @@ -1694,7 +1674,7 @@ void gl_remove_texobj_from_dirty_list( struct gl_shared_state *shared, /* - * This is called by gl_update_state() if the NEW_TEXTURING bit in + * This is called by gl_update_state() if the _NEW_TEXTURE bit in * ctx->NewState is set. */ void gl_update_dirty_texobjs( GLcontext *ctx ) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index f54d3cfa67..faada66b22 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,4 +1,4 @@ -/* $Id: varray.c,v 1.26 2000/10/27 16:44:41 keithw Exp $ */ +/* $Id: varray.c,v 1.27 2000/10/30 13:32:02 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -98,7 +98,7 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) ctx->Array.VertexFunc = gl_trans_4f_tab[size][TYPE_IDX(type)]; ctx->Array.VertexEltFunc = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_OBJ_ANY; - ctx->NewState |= NEW_CLIENT_STATE; + ctx->NewState |= _NEW_ARRAY; } @@ -148,7 +148,7 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) ctx->Array.NormalFunc = gl_trans_3f_tab[TYPE_IDX(type)]; ctx->Array.NormalEltFunc = gl_trans_elt_3f_tab[TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_NORM; - ctx->NewState |= NEW_CLIENT_STATE; + ctx->NewState |= _NEW_ARRAY; } @@ -211,7 +211,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) ctx->Array.ColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; ctx->Array.ColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_RGBA; - ctx->NewState |= NEW_CLIENT_STATE; + ctx->NewState |= _NEW_ARRAY; } @@ -246,7 +246,7 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) ctx->Array.FogCoordFunc = gl_trans_1f_tab[TYPE_IDX(type)]; ctx->Array.FogCoordEltFunc = gl_trans_elt_1f_tab[TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_FOG_COORD; - ctx->NewState |= NEW_CLIENT_STATE; + ctx->NewState |= _NEW_ARRAY; } @@ -289,7 +289,7 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) ctx->Array.IndexFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; ctx->Array.IndexEltFunc = gl_trans_elt_1ui_tab[TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_INDEX; - ctx->NewState |= NEW_CLIENT_STATE; + ctx->NewState |= _NEW_ARRAY; } @@ -354,7 +354,7 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, ctx->Array.SecondaryColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; ctx->Array.SecondaryColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; ctx->Array.NewArrayState |= VERT_SPEC_RGB; - ctx->NewState |= NEW_CLIENT_STATE; + ctx->NewState |= _NEW_ARRAY; } @@ -411,7 +411,7 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ctx->Array.TexCoordFunc[texUnit] = gl_trans_4f_tab[size][TYPE_IDX(type)]; ctx->Array.TexCoordEltFunc[texUnit] = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; ctx->Array.NewArrayState |= PIPE_TEX(texUnit); - ctx->NewState |= NEW_CLIENT_STATE; + ctx->NewState |= _NEW_ARRAY; } @@ -437,7 +437,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr) } ctx->Array.EdgeFlagEltFunc = gl_trans_elt_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; ctx->Array.NewArrayState |= VERT_EDGE; - ctx->NewState |= NEW_CLIENT_STATE; + ctx->NewState |= _NEW_ARRAY; } |