From 6d460af6af77a0d5a5b568bcd6094b98e249ba93 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Apr 2004 14:16:46 +0000 Subject: Added ctx->Vertex/FragmentProgram._Enable flags. Set when vertex/fragment program is enabled AND the currently bound program is valid. Check _Enable instead of Enable to prevent things from blowing up when someone calls glEnable(GL_VERTEX_PROGRAM_ARB) without actually defining a program. --- src/mesa/swrast/s_context.c | 14 +++++++------- src/mesa/swrast/s_span.c | 20 ++++++++++---------- src/mesa/swrast/s_triangle.c | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 94b57e4bbf..972de03b14 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 871e474005..41db42e2b8 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 ab262beabc..00c1a0ace2 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 -- cgit v1.2.3