diff options
Diffstat (limited to 'src')
27 files changed, 130 insertions, 111 deletions
diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c index 7ec1d00..f135e47 100644 --- a/src/mesa/array_cache/ac_import.c +++ b/src/mesa/array_cache/ac_import.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -72,7 +72,7 @@ static void reset_vertex( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); ASSERT(ctx->Array.Vertex.Enabled - || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)); + || (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled)); ac->Raw.Vertex = ctx->Array.Vertex; STRIDE_ARRAY(ac->Raw.Vertex, ac->start); ac->IsCached.Vertex = GL_FALSE; diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index e7f185a..2f38526 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -704,7 +704,7 @@ void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) */ if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3 && - !(ctx->VertexProgram.Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS])) + !(ctx->VertexProgram._Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS])) return; du = ctx->Eval.MapGrid1du; @@ -739,7 +739,7 @@ void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, */ if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3 && - !(ctx->VertexProgram.Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS])) + !(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS])) return; du = ctx->Eval.MapGrid2du; diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 4e09c28..d1c8f42 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -1,7 +1,6 @@ - /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * @@ -62,7 +61,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, /* Always need vertex positions */ if (!ctx->Array.Vertex.Enabled - && !(ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) + && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled)) return GL_FALSE; /* Vertex buffer object tests */ @@ -168,7 +167,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, /* Always need vertex positions */ if (!ctx->Array.Vertex.Enabled - && !(ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) + && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled)) return GL_FALSE; if (ctx->Const.CheckArrayBounds) { diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index e55b383..c59a8b2 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -21,9 +21,9 @@ /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 6.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -375,9 +375,9 @@ do { \ (((CTX)->Light.Enabled && \ (CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \ || (CTX)->Fog.ColorSumEnabled \ - || ((CTX)->VertexProgram.Enabled && \ + || ((CTX)->VertexProgram._Enabled && \ ((CTX)->VertexProgram.Current->InputsRead & VERT_BIT_COLOR1)) \ - || ((CTX)->FragmentProgram.Enabled && \ + || ((CTX)->FragmentProgram._Enabled && \ ((CTX)->FragmentProgram.Current->InputsRead & FRAG_BIT_COL1)) \ ) diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index fc7dd32..6f7cae9 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -45,8 +45,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->FragmentProgram.Enabled - && !ctx->FragmentProgram.Current->Instructions) { + if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels (invalid fragment program)"); return; @@ -103,8 +102,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, desty; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->FragmentProgram.Enabled - && !ctx->FragmentProgram.Current->Instructions) { + if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyPixels (invalid fragment program)"); return; @@ -184,8 +182,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->FragmentProgram.Enabled - && !ctx->FragmentProgram.Current->Instructions) { + if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap (invalid fragment program)"); return; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4d78264..d021ffc 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1628,10 +1628,11 @@ struct program_state { */ struct vertex_program_state { - GLboolean Enabled; /**< GL_VERTEX_PROGRAM_NV */ - GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - struct vertex_program *Current; /**< ptr to currently bound program */ + GLboolean Enabled; /**< GL_VERTEX_PROGRAM_NV */ + GLboolean _Enabled; /**< Really enabled? */ + GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + struct vertex_program *Current; /**< ptr to currently bound program */ GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; @@ -1658,6 +1659,7 @@ struct vertex_program_state struct fragment_program_state { GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */ + GLboolean _Enabled; /* Really enabled? */ struct fragment_program *Current; /* ptr to currently bound program */ struct fp_machine Machine; /* machine state */ GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */ diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index a73781e..b6c3d90 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -418,7 +418,7 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) if (ctx->NewState) _mesa_update_state( ctx ); - if (ctx->VertexProgram.Enabled) { + if (ctx->VertexProgram._Enabled) { /* XXX implement this */ _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos"); return; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index b8a67d0..c894241 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,11 +1,3 @@ -/** - * \file state.c - * State management. - * - * This file manages recalculation of derived values in the __GLcontextRec. - * Also, this is where we initialize the API dispatch table. - */ - /* * Mesa 3-D graphics library * Version: 6.1 @@ -31,6 +23,14 @@ */ +/** + * \file state.c + * State management. + * + * This file manages recalculation of derived values in the __GLcontextRec. + * Also, this is where we initialize the API dispatch table. + */ + #include "glheader.h" #include "accum.h" #include "api_loopback.h" @@ -762,7 +762,7 @@ update_arrays( GLcontext *ctx ) /* find min of _MaxElement values for all enabled arrays */ /* 0 */ - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) { min = ctx->Array.VertexAttrib[VERT_ATTRIB_POS]._MaxElement; } @@ -775,14 +775,14 @@ update_arrays( GLcontext *ctx ) } /* 1 */ - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement); } /* no conventional vertex weight array */ /* 2 */ - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement); } @@ -791,7 +791,7 @@ update_arrays( GLcontext *ctx ) } /* 3 */ - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement); } @@ -800,7 +800,7 @@ update_arrays( GLcontext *ctx ) } /* 4 */ - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement); } @@ -809,7 +809,7 @@ update_arrays( GLcontext *ctx ) } /* 5 */ - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_FOG]._MaxElement); } @@ -818,20 +818,20 @@ update_arrays( GLcontext *ctx ) } /* 6 */ - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_SIX].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SIX]._MaxElement); } /* 7 */ - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN]._MaxElement); } /* 8..15 */ for (i = VERT_ATTRIB_TEX0; i < VERT_ATTRIB_MAX; i++) { - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[i].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement); } @@ -854,6 +854,22 @@ update_arrays( GLcontext *ctx ) } +/** + * Update derived vertex/fragment program state. + */ +static void +update_program(GLcontext *ctx) +{ + /* For now, just set the _Enabled (really enabled) flags. + * In the future we may have to check other state to be sure we really + * have a runable program or shader. + */ + ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled + && ctx->VertexProgram.Current->Instructions; + ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled + && ctx->FragmentProgram.Current->Instructions; +} + /* * If __GLcontextRec::NewState is non-zero then this function \b must be called @@ -875,6 +891,9 @@ void _mesa_update_state( GLcontext *ctx ) if (MESA_VERBOSE & VERBOSE_STATE) _mesa_print_state("_mesa_update_state", new_state); + if (new_state & _NEW_PROGRAM) + update_program( ctx ); + if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) _mesa_update_modelview_project( ctx, new_state ); diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 38dd444..54835c9 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -2935,7 +2935,7 @@ update_texture_state( GLcontext *ctx ) texUnit->_GenFlags = 0; /* Get the bitmask of texture enables */ - if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) { + if (ctx->FragmentProgram._Enabled) { enableBits = ctx->FragmentProgram.Current->TexturesUsed[unit]; } else { @@ -3099,7 +3099,7 @@ update_texture_state( GLcontext *ctx ) /* Fragment programs may need texture coordinates but not the * corresponding texture images. */ - if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) { + if (ctx->FragmentProgram._Enabled) { ctx->Texture._EnabledCoordUnits |= (ctx->FragmentProgram.Current->InputsRead >> FRAG_ATTRIB_TEX0); } diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 6c1e362..63fc865 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.0 + * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -1142,7 +1142,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target, "glGetProgramRegisterfvMESA(target)"); return; } - if (!ctx->VertexProgram.Enabled) { + if (!ctx->VertexProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); return; @@ -1194,7 +1194,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target, "glGetProgramRegisterfvMESA(target)"); return; } - if (!ctx->FragmentProgram.Enabled) { + if (!ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); return; @@ -1207,7 +1207,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target, "glGetProgramRegisterfvMESA(target)"); return; } - if (!ctx->FragmentProgram.Enabled) { + if (!ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); return; diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 94b57e4..972de03 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -102,7 +102,7 @@ _swrast_update_rasterflags( GLcontext *ctx ) RasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */ } - if (ctx->FragmentProgram.Enabled) { + if (ctx->FragmentProgram._Enabled) { RasterMask |= FRAGPROG_BIT; } @@ -145,7 +145,7 @@ _swrast_update_fog_hint( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); swrast->_PreferPixelFog = (!swrast->AllowVertexFog || - ctx->FragmentProgram.Enabled || + ctx->FragmentProgram._Enabled || (ctx->Hint.Fog == GL_NICEST && swrast->AllowPixelFog)); } @@ -189,7 +189,7 @@ _swrast_update_fog_state( GLcontext *ctx ) if (ctx->Fog.Enabled) { swrast->_FogEnabled = GL_TRUE; } - else if (ctx->FragmentProgram.Enabled && + else if (ctx->FragmentProgram._Enabled && ctx->FragmentProgram.Current->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { const struct fragment_program *p; p = (struct fragment_program *) ctx->FragmentProgram.Current; @@ -203,7 +203,7 @@ _swrast_update_fog_state( GLcontext *ctx ) static void _swrast_update_fragment_program( GLcontext *ctx ) { - if (ctx->FragmentProgram.Enabled) { + if (ctx->FragmentProgram._Enabled) { struct fragment_program *program = ctx->FragmentProgram.Current; _mesa_load_state_parameters(ctx, program->Parameters); } @@ -271,7 +271,7 @@ _swrast_validate_triangle( GLcontext *ctx, if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram.Enabled) { + && !ctx->FragmentProgram._Enabled) { /* separate specular color, but no texture */ swrast->SpecTriangle = swrast->Triangle; swrast->Triangle = _swrast_add_spec_terms_triangle; @@ -290,7 +290,7 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram.Enabled) { + && !ctx->FragmentProgram._Enabled) { swrast->SpecLine = swrast->Line; swrast->Line = _swrast_add_spec_terms_line; } @@ -309,7 +309,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) - && !ctx->FragmentProgram.Enabled) { + && !ctx->FragmentProgram._Enabled) { swrast->SpecPoint = swrast->Point; swrast->Point = _swrast_add_spec_terms_point; } diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 871e474..41db42e 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -379,7 +379,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) if (obj) { const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) - || ctx->FragmentProgram.Enabled; + || ctx->FragmentProgram._Enabled; texW = img->WidthScale; texH = img->HeightScale; } @@ -404,7 +404,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat r = span->tex[u][2]; GLfloat q = span->tex[u][3]; GLuint i; - if (ctx->FragmentProgram.Enabled) { + if (ctx->FragmentProgram._Enabled) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; @@ -455,7 +455,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat r = span->tex[u][2]; GLfloat q = span->tex[u][3]; GLuint i; - if (ctx->FragmentProgram.Enabled) { + if (ctx->FragmentProgram._Enabled) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; @@ -513,7 +513,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) if (obj) { const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) - || ctx->FragmentProgram.Enabled; + || ctx->FragmentProgram._Enabled; texW = (GLfloat) img->WidthScale; texH = (GLfloat) img->HeightScale; } @@ -538,7 +538,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat r = span->tex[0][2]; GLfloat q = span->tex[0][3]; GLuint i; - if (ctx->FragmentProgram.Enabled) { + if (ctx->FragmentProgram._Enabled) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; @@ -589,7 +589,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat r = span->tex[0][2]; GLfloat q = span->tex[0][3]; GLuint i; - if (ctx->FragmentProgram.Enabled) { + if (ctx->FragmentProgram._Enabled) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; @@ -1104,7 +1104,7 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) } /* Fragment program */ - if (ctx->FragmentProgram.Enabled) { + if (ctx->FragmentProgram._Enabled) { /* Now we may need to interpolate the colors and texcoords */ if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) { @@ -1326,7 +1326,7 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span) span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); ASSERT(span->end <= MAX_WIDTH); ASSERT((span->interpMask & span->arrayMask) == 0); - ASSERT(ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram.Enabled); + ASSERT(ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Enabled); /* printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask); @@ -1386,7 +1386,7 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span) /* Texturing without alpha is done after depth-testing which * gives a potential speed-up. */ - if (ctx->FragmentProgram.Enabled) + if (ctx->FragmentProgram._Enabled) _swrast_exec_fragment_program( ctx, span ); else _swrast_texture_span( ctx, span ); @@ -1453,7 +1453,7 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span) interpolate_specular(ctx, span); } - if (ctx->FragmentProgram.Enabled) + if (ctx->FragmentProgram._Enabled) _swrast_exec_fragment_program( ctx, span ); else _swrast_texture_span( ctx, span ); diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index ab262be..00c1a0a 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1057,7 +1057,7 @@ _swrast_choose_triangle( GLcontext *ctx ) } } - if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram.Enabled) { + if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Enabled) { /* Ugh, we do a _lot_ of tests to pick the best textured tri func */ const struct gl_texture_object *texObj2D; const struct gl_texture_image *texImg; @@ -1072,7 +1072,7 @@ _swrast_choose_triangle( GLcontext *ctx ) /* First see if we can use an optimized 2-D texture function */ if (ctx->Texture._EnabledCoordUnits == 1 - && !ctx->FragmentProgram.Enabled + && !ctx->FragmentProgram._Enabled && ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT && texObj2D->WrapS==GL_REPEAT && texObj2D->WrapT==GL_REPEAT diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c index 88ae07f..00876fe6 100644 --- a/src/mesa/swrast_setup/ss_triangle.c +++ b/src/mesa/swrast_setup/ss_triangle.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.0.1 + * Version: 6.1 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -291,7 +291,7 @@ void _swsetup_choose_trifuncs( GLcontext *ctx ) ind |= SS_OFFSET_BIT; if ((ctx->Light.Enabled && ctx->Light.Model.TwoSide) || - (ctx->VertexProgram.Enabled && ctx->VertexProgram.TwoSideEnabled)) + (ctx->VertexProgram._Enabled && ctx->VertexProgram.TwoSideEnabled)) ind |= SS_TWOSIDE_BIT; /* We piggyback the two-sided stencil front/back determination on the diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 7baeefe..0e50c6f 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.0 + * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -260,7 +260,7 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) /* When vertex program mode is enabled, the generic vertex attribute * arrays have priority over the conventional vertex arrays. */ - if (ctx->VertexProgram.Enabled + if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[index].Enabled) { /* Use generic attribute array */ _tnl_import_attrib( ctx, index, GL_FALSE, GL_TRUE ); diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index 1f8c4d40..14a7d60 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -192,7 +192,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) tnl->render_inputs |= _TNL_BIT_TEX0; if (ctx->Point._Attenuated || - (ctx->VertexProgram.Enabled && ctx->VertexProgram.PointSizeEnabled)) + (ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled)) tnl->render_inputs |= _TNL_BIT_POINTSIZE; } diff --git a/src/mesa/tnl/t_save_playback.c b/src/mesa/tnl/t_save_playback.c index 264748e..dc9ffa8 100644 --- a/src/mesa/tnl/t_save_playback.c +++ b/src/mesa/tnl/t_save_playback.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.0 + * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -199,6 +199,13 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data ) if (ctx->NewState) _mesa_update_state( ctx ); + if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) || + (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBegin (invalid vertex/fragment program)"); + return; + } + if (tnl->pipeline.build_state_changes) _tnl_validate_pipeline( ctx ); diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c index cb71e67..13a2cbb 100644 --- a/src/mesa/tnl/t_vb_fog.c +++ b/src/mesa/tnl/t_vb_fog.c @@ -216,7 +216,7 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) static void check_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) { - stage->active = ctx->Fog.Enabled && !ctx->VertexProgram.Enabled; + stage->active = ctx->Fog.Enabled && !ctx->VertexProgram._Enabled; if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) stage->inputs = _TNL_BIT_POS; diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index 1d260fa..cd5792e 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -315,7 +314,7 @@ static GLboolean run_init_lighting( GLcontext *ctx, */ static void check_lighting( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { - stage->active = ctx->Light.Enabled && !ctx->VertexProgram.Enabled; + stage->active = ctx->Light.Enabled && !ctx->VertexProgram._Enabled; if (stage->active) { if (stage->privatePtr) stage->run = run_validate_lighting; diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c index 2247313..732e7c6 100644 --- a/src/mesa/tnl/t_vb_normals.c +++ b/src/mesa/tnl/t_vb_normals.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -137,7 +136,7 @@ static GLboolean run_validate_normal_stage( GLcontext *ctx, static void check_normal_transform( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { - stage->active = !ctx->VertexProgram.Enabled && + stage->active = !ctx->VertexProgram._Enabled && (ctx->Light.Enabled || (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS)); /* Don't clobber the initialize function: diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c index 1990886..746ea8b 100644 --- a/src/mesa/tnl/t_vb_points.c +++ b/src/mesa/tnl/t_vb_points.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -76,7 +75,7 @@ static GLboolean run_point_stage( GLcontext *ctx, */ static void check_point_size( GLcontext *ctx, struct tnl_pipeline_stage *d ) { - d->active = ctx->Point._Attenuated && !ctx->VertexProgram.Enabled; + d->active = ctx->Point._Attenuated && !ctx->VertexProgram._Enabled; } static GLboolean alloc_point_data( GLcontext *ctx, diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index a6c9bc8..38b04b4 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -315,7 +315,7 @@ static GLboolean run_init_vp( GLcontext *ctx, */ static void check_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { - stage->active = ctx->VertexProgram.Enabled; + stage->active = ctx->VertexProgram._Enabled; if (stage->active) { /* Set stage->inputs equal to the bitmask of vertex attributes diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index 64d569a..e9719b3 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.0 + * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -593,7 +593,7 @@ static void check_texgen( GLcontext *ctx, struct tnl_pipeline_stage *stage ) GLuint i; stage->active = 0; - if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram.Enabled) { + if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram._Enabled) { GLuint inputs = 0; GLuint outputs = 0; diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c index 221dd58..8f6ca89 100644 --- a/src/mesa/tnl/t_vb_texmat.c +++ b/src/mesa/tnl/t_vb_texmat.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -57,7 +57,7 @@ static void check_texmat( GLcontext *ctx, struct tnl_pipeline_stage *stage ) GLuint i; stage->active = 0; - if (ctx->Texture._TexMatEnabled && !ctx->VertexProgram.Enabled) { + if (ctx->Texture._TexMatEnabled && !ctx->VertexProgram._Enabled) { GLuint flags = 0; for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index 63dc653..b483a95 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 5.0 + * Version: 6.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -135,7 +134,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx, TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; - ASSERT(!ctx->VertexProgram.Enabled); + ASSERT(!ctx->VertexProgram._Enabled); if (stage->changed_inputs) { @@ -234,7 +233,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx, static void check_vertex( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { - stage->active = !ctx->VertexProgram.Enabled; + stage->active = !ctx->VertexProgram._Enabled; } static GLboolean init_vertex_stage( GLcontext *ctx, diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index 7eccacc..1bc84ee 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -724,21 +724,20 @@ static void GLAPIENTRY _tnl_Begin( GLenum mode ) { GET_CURRENT_CONTEXT( ctx ); - if ((ctx->VertexProgram.Enabled - && !ctx->VertexProgram.Current->Instructions) || - (ctx->FragmentProgram.Enabled - && !ctx->FragmentProgram.Current->Instructions)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBegin (invalid vertex/fragment program)"); - return; - } - if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { TNLcontext *tnl = TNL_CONTEXT(ctx); int i; if (ctx->NewState) { _mesa_update_state( ctx ); + + if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) || + (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBegin (invalid vertex/fragment program)"); + return; + } + if (!(tnl->Driver.NotifyBegin && tnl->Driver.NotifyBegin( ctx, mode ))) ctx->Exec->Begin(mode); diff --git a/src/mesa/tnl/t_vtx_eval.c b/src/mesa/tnl/t_vtx_eval.c index 0878827..ea9da13 100644 --- a/src/mesa/tnl/t_vtx_eval.c +++ b/src/mesa/tnl/t_vtx_eval.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -73,7 +73,7 @@ void _tnl_update_eval( GLcontext *ctx ) clear_active_eval2( tnl, attr ); } - if (ctx->VertexProgram.Enabled) { + if (ctx->VertexProgram._Enabled) { for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { if (ctx->Eval.Map1Attrib[attr]) set_active_eval1( tnl, attr, 4, &ctx->EvalMap.Map1Attrib[attr] ); |