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;
/* 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++;
}
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:
{
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:
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:
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");
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:
* Number of STATE_* values we need to address any GL state.
* Used to dimension arrays.
*/
-#define STATE_LENGTH 6
+#define STATE_LENGTH 5
/**
STATE_TEXGEN,
- STATE_FOG,
STATE_FOG_COLOR,
STATE_FOG_PARAMS,
STATE_CLIPPLANE,
- STATE_POINT,
STATE_POINT_SIZE,
STATE_POINT_ATTENUATION,
* 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] */
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;
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;
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 {
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);