Undo some STATE_POINT/FOG changes. Max length of state token array is now 5.
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 480fdf5..9dbcb60 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -1276,13 +1276,11 @@
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 3ebd559..505c501 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -379,7 +379,7 @@
/* 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 5377818..0d70af3 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -246,17 +246,14 @@
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 @@
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 @@
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 @@
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 @@
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 91713f3..8216934 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 @@
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 05a05cd..18da39c 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/shader/programopt.c
@@ -56,7 +56,7 @@
* 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 @@
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 47e6bcb..7f4290b 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -99,6 +99,13 @@
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 @@
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 2837825..17f115f 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -1323,8 +1323,8 @@
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);