summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/prog_statevars.c
diff options
context:
space:
mode:
authorNicolai Haehnle <[email protected]>2008-07-27 21:31:49 +0200
committerNicolai Haehnle <[email protected]>2008-07-27 21:31:49 +0200
commitc117d0efd28887069607f405be99fbc09fcb4cab (patch)
treedd49a5be33daa2cb5bfbab1280680714949c5d05 /src/mesa/shader/prog_statevars.c
parente88be7d375032fbddb34a77debe6604fa029492c (diff)
r300: Implement ARB_shadow_ambient; add STATE_SHADOW_AMBIENT
Diffstat (limited to 'src/mesa/shader/prog_statevars.c')
-rw-r--r--src/mesa/shader/prog_statevars.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 539057b4382..e446e1c4197 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -132,7 +132,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
ADD_3V(value, p, eye_z);
NORMALIZE_3FV(value);
value[3] = 1.0;
- }
+ }
return;
case STATE_POSITION_NORMALIZED:
COPY_4V(value, ctx->Light.Light[ln].EyePosition);
@@ -240,11 +240,11 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
}
}
case STATE_TEXENV_COLOR:
- {
+ {
/* state[1] is the texture unit */
const GLuint unit = (GLuint) state[1];
COPY_4V(value, ctx->Texture.Unit[unit].EnvColor);
- }
+ }
return;
case STATE_FOG_COLOR:
COPY_4V(value, ctx->Fog.Color);
@@ -374,7 +374,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
}
}
return;
-
+
case STATE_VERTEX_PROGRAM:
{
/* state[1] = {STATE_ENV, STATE_LOCAL} */
@@ -458,6 +458,20 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
case STATE_PCM_BIAS:
COPY_4V(value, ctx->Pixel.PostColorMatrixBias);
break;
+ case STATE_SHADOW_AMBIENT:
+ {
+ const int unit = (int) state[2];
+ const struct gl_texture_object *texObj
+ = ctx->Texture.Unit[unit]._Current;
+ if (texObj) {
+ value[0] = texObj->ShadowAmbient;
+ value[1] = texObj->ShadowAmbient;
+ value[2] = texObj->ShadowAmbient;
+ value[3] = texObj->ShadowAmbient;
+ }
+ }
+ return;
+
default:
/* unknown state indexes are silently ignored
* should be handled by the driver.
@@ -532,6 +546,7 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
case STATE_INTERNAL:
switch (state[1]) {
case STATE_TEXRECT_SCALE:
+ case STATE_SHADOW_AMBIENT:
return _NEW_TEXTURE;
case STATE_FOG_PARAMS_OPTIMIZED:
return _NEW_FOG;
@@ -711,6 +726,9 @@ append_token(char *dst, gl_state_index k)
case STATE_PCM_BIAS:
append(dst, "PCMbias");
break;
+ case STATE_SHADOW_AMBIENT:
+ append(dst, "ShadowAmbient");
+ break;
default:
;
}
@@ -861,7 +879,7 @@ _mesa_load_state_parameters(GLcontext *ctx,
for (i = 0; i < paramList->NumParameters; i++) {
if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) {
- _mesa_fetch_state(ctx,
+ _mesa_fetch_state(ctx,
(gl_state_index *) paramList->Parameters[i].StateIndexes,
paramList->ParameterValues[i]);
}