summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-02-22 09:29:46 -0700
committerBrian <brian@yutani.localnet.net>2007-02-22 09:29:46 -0700
commit776bc9cf55b116e17dddde4d097985b51879c83f (patch)
tree7f2b21fffc33807b0bd8d23636a1fd024f90d822
parent3f4826a358cab8b6d638fc8eb46aef668a7bcf46 (diff)
Undo some STATE_POINT/FOG changes. Max length of state token array is now 5.
-rw-r--r--src/mesa/shader/arbprogparse.c6
-rw-r--r--src/mesa/shader/prog_parameter.c2
-rw-r--r--src/mesa/shader/prog_statevars.c71
-rw-r--r--src/mesa/shader/prog_statevars.h4
-rw-r--r--src/mesa/shader/programopt.c9
-rw-r--r--src/mesa/shader/slang/slang_builtin.c18
-rw-r--r--src/mesa/tnl/t_vp_build.c4
7 files changed, 48 insertions, 66 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 480fdf512c..9dbcb60a17 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -1276,13 +1276,11 @@ parse_state_single_item (GLcontext * ctx, const GLubyte ** inst,
case STATE_POINT:
switch (*(*inst++)) {
case POINT_SIZE:
- state_tokens[0] = STATE_POINT;
- state_tokens[1] = STATE_POINT_SIZE;
+ state_tokens[0] = STATE_POINT_SIZE;
break;
case POINT_ATTENUATION:
- state_tokens[0] = STATE_POINT;
- state_tokens[1] = STATE_POINT_ATTENUATION;
+ state_tokens[0] = STATE_POINT_ATTENUATION;
break;
}
break;
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index 3ebd559119..505c5016ac 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -379,7 +379,7 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
/* Check if the state reference is already in the list */
for (index = 0; index < (GLint) paramList->NumParameters; index++) {
GLuint i, match = 0;
- for (i = 0; i < 6; i++) {
+ for (i = 0; i < STATE_LENGTH; i++) {
if (paramList->Parameters[index].StateIndexes[i] == stateTokens[i]) {
match++;
}
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 53778183c5..0d70af3b27 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -246,17 +246,14 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
COPY_4V(value, ctx->Texture.Unit[unit].EnvColor);
}
return;
- case STATE_FOG:
- if (state[1] == STATE_FOG_COLOR) {
- COPY_4V(value, ctx->Fog.Color);
- }
- else {
- ASSERT(state[1] == STATE_FOG_PARAMS);
- value[0] = ctx->Fog.Density;
- value[1] = ctx->Fog.Start;
- value[2] = ctx->Fog.End;
- value[3] = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
- }
+ case STATE_FOG_COLOR:
+ COPY_4V(value, ctx->Fog.Color);
+ return;
+ case STATE_FOG_PARAMS:
+ value[0] = ctx->Fog.Density;
+ value[1] = ctx->Fog.Start;
+ value[2] = ctx->Fog.End;
+ value[3] = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
return;
case STATE_CLIPPLANE:
{
@@ -264,20 +261,17 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
COPY_4V(value, ctx->Transform.EyeUserPlane[plane]);
}
return;
- case STATE_POINT:
- if (state[1] == STATE_POINT_SIZE) {
- value[0] = ctx->Point.Size;
- value[1] = ctx->Point.MinSize;
- value[2] = ctx->Point.MaxSize;
- value[3] = ctx->Point.Threshold;
- }
- else {
- ASSERT(state[1] == STATE_POINT_ATTENUATION);
- value[0] = ctx->Point.Params[0];
- value[1] = ctx->Point.Params[1];
- value[2] = ctx->Point.Params[2];
- value[3] = 1.0F;
- }
+ case STATE_POINT_SIZE:
+ value[0] = ctx->Point.Size;
+ value[1] = ctx->Point.MinSize;
+ value[2] = ctx->Point.MaxSize;
+ value[3] = ctx->Point.Threshold;
+ return;
+ case STATE_POINT_ATTENUATION:
+ value[0] = ctx->Point.Params[0];
+ value[1] = ctx->Point.Params[1];
+ value[2] = ctx->Point.Params[2];
+ value[3] = 1.0F;
return;
case STATE_MODELVIEW_MATRIX:
case STATE_PROJECTION_MATRIX:
@@ -459,17 +453,15 @@ _mesa_program_state_flags(const GLint state[STATE_LENGTH])
case STATE_TEXENV_COLOR:
return _NEW_TEXTURE;
- case STATE_FOG:
-#if 0
case STATE_FOG_COLOR:
case STATE_FOG_PARAMS:
-#endif
return _NEW_FOG;
case STATE_CLIPPLANE:
return _NEW_TRANSFORM;
- case STATE_POINT:
+ case STATE_POINT_SIZE:
+ case STATE_POINT_ATTENUATION:
return _NEW_POINT;
case STATE_MODELVIEW_MATRIX:
@@ -543,26 +535,20 @@ append_token(char *dst, gl_state_index k)
case STATE_TEXGEN:
append(dst, "texgen");
break;
- case STATE_FOG:
- append(dst, "fog");
- break;
case STATE_FOG_COLOR:
- append(dst, ".color");
+ append(dst, "fog.color");
break;
case STATE_FOG_PARAMS:
- append(dst, ".params");
+ append(dst, "fog.params");
break;
case STATE_CLIPPLANE:
append(dst, "clip");
break;
- case STATE_POINT:
- append(dst, "point");
- break;
case STATE_POINT_SIZE:
- append(dst, "size");
+ append(dst, "point.size");
break;
case STATE_POINT_ATTENUATION:
- append(dst, "attenuation");
+ append(dst, "point.attenuation");
break;
case STATE_MODELVIEW_MATRIX:
append(dst, "matrix.modelview");
@@ -733,17 +719,10 @@ _mesa_program_state_string(const GLint state[STATE_LENGTH])
append_index(str, state[1]); /* tex unit [i] */
append(str, "color");
break;
- case STATE_FOG:
- append(str, "fog");
- append_token(str, (gl_state_index) state[1]); /* color or params */
- break;
case STATE_CLIPPLANE:
append_index(str, state[1]); /* plane [i] */
append(str, ".plane");
break;
- case STATE_POINT:
- append_token(str, state[1]);
- break;
case STATE_MODELVIEW_MATRIX:
case STATE_PROJECTION_MATRIX:
case STATE_MVP_MATRIX:
diff --git a/src/mesa/shader/prog_statevars.h b/src/mesa/shader/prog_statevars.h
index 91713f3d1d..82169342cd 100644
--- a/src/mesa/shader/prog_statevars.h
+++ b/src/mesa/shader/prog_statevars.h
@@ -32,7 +32,7 @@
* Number of STATE_* values we need to address any GL state.
* Used to dimension arrays.
*/
-#define STATE_LENGTH 6
+#define STATE_LENGTH 5
/**
@@ -54,13 +54,11 @@ typedef enum gl_state_index_ {
STATE_TEXGEN,
- STATE_FOG,
STATE_FOG_COLOR,
STATE_FOG_PARAMS,
STATE_CLIPPLANE,
- STATE_POINT,
STATE_POINT_SIZE,
STATE_POINT_ATTENUATION,
diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c
index 05a05cd369..18da39c2d3 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/shader/programopt.c
@@ -56,7 +56,7 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog)
* Setup state references for the modelview/projection matrix.
* XXX we should check if these state vars are already declared.
*/
- static const GLint mvpState[4][5] = {
+ static const GLint mvpState[4][STATE_LENGTH] = {
{ STATE_MVP_MATRIX, 0, 0, 0, 0 }, /* state.matrix.mvp.row[0] */
{ STATE_MVP_MATRIX, 0, 1, 1, 0 }, /* state.matrix.mvp.row[1] */
{ STATE_MVP_MATRIX, 0, 2, 2, 0 }, /* state.matrix.mvp.row[2] */
@@ -125,9 +125,10 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog)
void
_mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
{
- static const GLint fogPStateOpt[] = { STATE_INTERNAL,
- STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 };
- static const GLint fogColorState[] = { STATE_FOG, STATE_FOG_COLOR, 0, 0, 0};
+ static const GLint fogPStateOpt[STATE_LENGTH]
+ = { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 };
+ static const GLint fogColorState[STATE_LENGTH]
+ = { STATE_FOG_COLOR, 0, 0, 0, 0};
struct prog_instruction *newInst, *inst;
const GLuint origLen = fprog->Base.NumInstructions;
const GLuint newLen = origLen + 5;
diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
index 47e6bcbcc4..7f4290b91f 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -99,6 +99,13 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
tokens[0] = STATE_CLIPPLANE;
tokens[1] = index1;
}
+ else if (strcmp(var, "gl_Point") == 0) {
+ if (strcmp(field, "size") == 0) {
+ tokens[0] = STATE_POINT_SIZE;
+ *swizzleOut = SWIZZLE_XXXX;
+ }
+ /* XXX finish */
+ }
else if (strcmp(var, "gl_FrontMaterial") == 0 ||
strcmp(var, "gl_BackMaterial") == 0) {
tokens[0] = STATE_MATERIAL;
@@ -269,24 +276,23 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
tokens[2] = STATE_TEXGEN_OBJECT_Q;
}
else if (strcmp(var, "gl_Fog") == 0) {
- tokens[0] = STATE_FOG;
if (strcmp(field, "color") == 0) {
- tokens[1] = STATE_FOG_COLOR;
+ tokens[0] = STATE_FOG_COLOR;
}
else if (strcmp(field, "density") == 0) {
- tokens[1] = STATE_FOG_PARAMS;
+ tokens[0] = STATE_FOG_PARAMS;
*swizzleOut = SWIZZLE_XXXX;
}
else if (strcmp(field, "start") == 0) {
- tokens[1] = STATE_FOG_PARAMS;
+ tokens[0] = STATE_FOG_PARAMS;
*swizzleOut = SWIZZLE_YYYY;
}
else if (strcmp(field, "end") == 0) {
- tokens[1] = STATE_FOG_PARAMS;
+ tokens[0] = STATE_FOG_PARAMS;
*swizzleOut = SWIZZLE_ZZZZ;
}
else if (strcmp(field, "scale") == 0) {
- tokens[1] = STATE_FOG_PARAMS;
+ tokens[0] = STATE_FOG_PARAMS;
*swizzleOut = SWIZZLE_WWWW;
}
else {
diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
index 283782588a..17f115f4a2 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -1323,8 +1323,8 @@ static void build_texture_transform( struct tnl_program *p )
static void build_pointsize( struct tnl_program *p )
{
struct ureg eye = get_eye_position(p);
- struct ureg state_size = register_param2(p, STATE_POINT, STATE_POINT_SIZE);
- struct ureg state_attenuation = register_param2(p, STATE_POINT, STATE_POINT_ATTENUATION);
+ struct ureg state_size = register_param1(p, STATE_POINT_SIZE);
+ struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION);
struct ureg out = register_output(p, VERT_RESULT_PSIZ);
struct ureg ut = get_temp(p);