summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_context.c
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2006-12-13 15:05:23 -0700
committerBrian <brian@yutani.localnet.net>2006-12-13 15:05:23 -0700
commit12ef1fbefcee964b715783d3ade6b69b2c699ed8 (patch)
tree4daf73a2c8aec72103b064c48b98c34a249771a6 /src/mesa/swrast/s_context.c
parenta328e469d328f8b6fd5afdfc21d576fa1a2c43fc (diff)
Checkpoint for GLSL compiler changes.
In brief: Check for enabled fragment program by looking at ctx->FragmentProgram._Current. New code for varying variables.
Diffstat (limited to 'src/mesa/swrast/s_context.c')
-rw-r--r--src/mesa/swrast/s_context.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 52d560ffdb..e304789154 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -98,7 +98,7 @@ _swrast_update_rasterflags( GLcontext *ctx )
rasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */
}
- if (ctx->FragmentProgram._Enabled) {
+ if (ctx->FragmentProgram._Current) {
rasterMask |= FRAGPROG_BIT;
}
@@ -165,7 +165,7 @@ _swrast_update_fog_hint( GLcontext *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
swrast->_PreferPixelFog = (!swrast->AllowVertexFog ||
- ctx->FragmentProgram._Enabled || /* not _Active! */
+ ctx->FragmentProgram._Current ||
(ctx->Hint.Fog == GL_NICEST &&
swrast->AllowPixelFog));
}
@@ -198,17 +198,14 @@ static void
_swrast_update_fog_state( GLcontext *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
/* determine if fog is needed, and if so, which fog mode */
swrast->_FogEnabled = GL_FALSE;
- if (ctx->FragmentProgram._Enabled) {
- if (ctx->FragmentProgram._Current->Base.Target==GL_FRAGMENT_PROGRAM_ARB) {
- const struct gl_fragment_program *fp
- = ctx->FragmentProgram._Current;
- if (fp->FogOption != GL_NONE) {
- swrast->_FogEnabled = GL_TRUE;
- swrast->_FogMode = fp->FogOption;
- }
+ if (fp && fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
+ if (fp->FogOption != GL_NONE) {
+ swrast->_FogEnabled = GL_TRUE;
+ swrast->_FogMode = fp->FogOption;
}
}
else if (ctx->Fog.Enabled) {
@@ -225,8 +222,8 @@ _swrast_update_fog_state( GLcontext *ctx )
static void
_swrast_update_fragment_program(GLcontext *ctx, GLbitfield newState)
{
- if (ctx->FragmentProgram._Enabled) {
- const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+ const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+ if (fp) {
#if 0
/* XXX Need a way to trigger the initial loading of parameters
* even when there's no recent state changes.
@@ -301,7 +298,7 @@ _swrast_validate_triangle( GLcontext *ctx,
if (ctx->Texture._EnabledUnits == 0
&& NEED_SECONDARY_COLOR(ctx)
- && !ctx->FragmentProgram._Enabled) {
+ && !ctx->FragmentProgram._Current) {
/* separate specular color, but no texture */
swrast->SpecTriangle = swrast->Triangle;
swrast->Triangle = _swrast_add_spec_terms_triangle;
@@ -325,7 +322,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._Current) {
swrast->SpecLine = swrast->Line;
swrast->Line = _swrast_add_spec_terms_line;
}
@@ -348,7 +345,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 )
if (ctx->Texture._EnabledUnits == 0
&& NEED_SECONDARY_COLOR(ctx)
- && !ctx->FragmentProgram._Enabled) {
+ && !ctx->FragmentProgram._Current) {
swrast->SpecPoint = swrast->Point;
swrast->Point = _swrast_add_spec_terms_point;
}