summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/shader/prog_statevars.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 592a63651c..539057b438 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -425,8 +425,9 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
* exp: 2^-(density/ln(2) * fogcoord)
* exp2: 2^-((density/(ln(2)^2) * fogcoord)^2)
*/
- value[0] = -1.0F / (ctx->Fog.End - ctx->Fog.Start);
- value[1] = ctx->Fog.End / (ctx->Fog.End - ctx->Fog.Start);
+ value[0] = (ctx->Fog.End == ctx->Fog.Start)
+ ? 1.0 : -1.0F / (ctx->Fog.End - ctx->Fog.Start);
+ value[1] = ctx->Fog.End * -value[0];
value[2] = ctx->Fog.Density * ONE_DIV_LN2;
value[3] = ctx->Fog.Density * ONE_DIV_SQRT_LN2;
return;
@@ -515,6 +516,8 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
return _NEW_TEXTURE_MATRIX;
case STATE_PROGRAM_MATRIX:
return _NEW_TRACK_MATRIX;
+ case STATE_COLOR_MATRIX:
+ return _NEW_COLOR_MATRIX;
case STATE_DEPTH_RANGE:
return _NEW_VIEWPORT;
@@ -608,6 +611,9 @@ append_token(char *dst, gl_state_index k)
case STATE_PROGRAM_MATRIX:
append(dst, "matrix.program");
break;
+ case STATE_COLOR_MATRIX:
+ append(dst, "matrix.color");
+ break;
case STATE_MATRIX_INVERSE:
append(dst, ".inverse");
break;
@@ -783,6 +789,7 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
case STATE_MVP_MATRIX:
case STATE_TEXTURE_MATRIX:
case STATE_PROGRAM_MATRIX:
+ case STATE_COLOR_MATRIX:
{
/* state[0] = modelview, projection, texture, etc. */
/* state[1] = which texture matrix or program matrix */
@@ -850,10 +857,12 @@ _mesa_load_state_parameters(GLcontext *ctx,
if (!paramList)
return;
+ /*assert(ctx->Driver.NeedFlush == 0);*/
+
for (i = 0; i < paramList->NumParameters; i++) {
if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) {
_mesa_fetch_state(ctx,
- paramList->Parameters[i].StateIndexes,
+ (gl_state_index *) paramList->Parameters[i].StateIndexes,
paramList->ParameterValues[i]);
}
}