diff options
author | Nicolai Haehnle <[email protected]> | 2008-07-27 21:31:49 +0200 |
---|---|---|
committer | Nicolai Haehnle <[email protected]> | 2008-07-27 21:31:49 +0200 |
commit | c117d0efd28887069607f405be99fbc09fcb4cab (patch) | |
tree | dd49a5be33daa2cb5bfbab1280680714949c5d05 /src/mesa/shader | |
parent | e88be7d375032fbddb34a77debe6604fa029492c (diff) |
r300: Implement ARB_shadow_ambient; add STATE_SHADOW_AMBIENT
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/prog_statevars.c | 28 | ||||
-rw-r--r-- | src/mesa/shader/prog_statevars.h | 5 |
2 files changed, 26 insertions, 7 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]); } diff --git a/src/mesa/shader/prog_statevars.h b/src/mesa/shader/prog_statevars.h index 64820a5b681..da75ca77a14 100644 --- a/src/mesa/shader/prog_statevars.h +++ b/src/mesa/shader/prog_statevars.h @@ -77,7 +77,7 @@ typedef enum gl_state_index_ { STATE_SPECULAR, STATE_EMISSION, STATE_SHININESS, - STATE_HALF_VECTOR, + STATE_HALF_VECTOR, STATE_POSITION, STATE_ATTENUATION, @@ -94,7 +94,7 @@ typedef enum gl_state_index_ { STATE_TEXGEN_OBJECT_Q, STATE_TEXENV_COLOR, - + STATE_DEPTH_RANGE, STATE_VERTEX_PROGRAM, @@ -113,6 +113,7 @@ typedef enum gl_state_index_ { STATE_PT_BIAS, /**< Pixel transfer RGBA bias */ STATE_PCM_SCALE, /**< Post color matrix RGBA scale */ STATE_PCM_BIAS, /**< Post color matrix RGBA bias */ + STATE_SHADOW_AMBIENT, /**< ARB_shadow_ambient fail value; token[2] is texture unit index */ STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */ } gl_state_index; |