2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * \file prog_statevars.c
27 * Program state variable management.
38 #include "prog_statevars.h"
39 #include "prog_parameter.h"
40 #include "nvvertparse.h"
44 * Use the list of tokens in the state[] array to find global GL state
45 * and return it in <value>. Usually, four values are returned in <value>
46 * but matrix queries may return as many as 16 values.
47 * This function is used for ARB vertex/fragment programs.
48 * The program parser will produce the state[] values.
51 _mesa_fetch_state(GLcontext
*ctx
, const gl_state_index state
[],
57 /* state[1] is either 0=front or 1=back side */
58 const GLuint face
= (GLuint
) state
[1];
59 const struct gl_material
*mat
= &ctx
->Light
.Material
;
60 ASSERT(face
== 0 || face
== 1);
61 /* we rely on tokens numbered so that _BACK_ == _FRONT_+ 1 */
62 ASSERT(MAT_ATTRIB_FRONT_AMBIENT
+ 1 == MAT_ATTRIB_BACK_AMBIENT
);
63 /* XXX we could get rid of this switch entirely with a little
64 * work in arbprogparse.c's parse_state_single_item().
66 /* state[2] is the material attribute */
69 COPY_4V(value
, mat
->Attrib
[MAT_ATTRIB_FRONT_AMBIENT
+ face
]);
72 COPY_4V(value
, mat
->Attrib
[MAT_ATTRIB_FRONT_DIFFUSE
+ face
]);
75 COPY_4V(value
, mat
->Attrib
[MAT_ATTRIB_FRONT_SPECULAR
+ face
]);
78 COPY_4V(value
, mat
->Attrib
[MAT_ATTRIB_FRONT_EMISSION
+ face
]);
81 value
[0] = mat
->Attrib
[MAT_ATTRIB_FRONT_SHININESS
+ face
][0];
87 _mesa_problem(ctx
, "Invalid material state in fetch_state");
93 /* state[1] is the light number */
94 const GLuint ln
= (GLuint
) state
[1];
95 /* state[2] is the light attribute */
98 COPY_4V(value
, ctx
->Light
.Light
[ln
].Ambient
);
101 COPY_4V(value
, ctx
->Light
.Light
[ln
].Diffuse
);
104 COPY_4V(value
, ctx
->Light
.Light
[ln
].Specular
);
107 COPY_4V(value
, ctx
->Light
.Light
[ln
].EyePosition
);
109 case STATE_ATTENUATION
:
110 value
[0] = ctx
->Light
.Light
[ln
].ConstantAttenuation
;
111 value
[1] = ctx
->Light
.Light
[ln
].LinearAttenuation
;
112 value
[2] = ctx
->Light
.Light
[ln
].QuadraticAttenuation
;
113 value
[3] = ctx
->Light
.Light
[ln
].SpotExponent
;
115 case STATE_SPOT_DIRECTION
:
116 COPY_3V(value
, ctx
->Light
.Light
[ln
].EyeDirection
);
117 value
[3] = ctx
->Light
.Light
[ln
]._CosCutoff
;
119 case STATE_SPOT_CUTOFF
:
120 value
[0] = ctx
->Light
.Light
[ln
].SpotCutoff
;
122 case STATE_HALF_VECTOR
:
124 GLfloat eye_z
[] = {0, 0, 1};
126 /* Compute infinite half angle vector:
127 * half-vector = light_position + (0, 0, 1)
128 * and then normalize. w = 0
130 * light.EyePosition.w should be 0 for infinite lights.
132 ADD_3V(value
, eye_z
, ctx
->Light
.Light
[ln
].EyePosition
);
133 NORMALIZE_3FV(value
);
137 case STATE_POSITION_NORMALIZED
:
138 COPY_4V(value
, ctx
->Light
.Light
[ln
].EyePosition
);
139 NORMALIZE_3FV( value
);
142 _mesa_problem(ctx
, "Invalid light state in fetch_state");
146 case STATE_LIGHTMODEL_AMBIENT
:
147 COPY_4V(value
, ctx
->Light
.Model
.Ambient
);
149 case STATE_LIGHTMODEL_SCENECOLOR
:
153 for (i
= 0; i
< 3; i
++) {
154 value
[i
] = ctx
->Light
.Model
.Ambient
[i
]
155 * ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_FRONT_AMBIENT
][i
]
156 + ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_FRONT_EMISSION
][i
];
158 value
[3] = ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_FRONT_DIFFUSE
][3];
163 for (i
= 0; i
< 3; i
++) {
164 value
[i
] = ctx
->Light
.Model
.Ambient
[i
]
165 * ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_BACK_AMBIENT
][i
]
166 + ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_BACK_EMISSION
][i
];
168 value
[3] = ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_BACK_DIFFUSE
][3];
171 case STATE_LIGHTPROD
:
173 const GLuint ln
= (GLuint
) state
[1];
174 const GLuint face
= (GLuint
) state
[2];
176 ASSERT(face
== 0 || face
== 1);
179 for (i
= 0; i
< 3; i
++) {
180 value
[i
] = ctx
->Light
.Light
[ln
].Ambient
[i
] *
181 ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_FRONT_AMBIENT
+face
][i
];
183 /* [3] = material alpha */
184 value
[3] = ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_FRONT_DIFFUSE
+face
][3];
187 for (i
= 0; i
< 3; i
++) {
188 value
[i
] = ctx
->Light
.Light
[ln
].Diffuse
[i
] *
189 ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_FRONT_DIFFUSE
+face
][i
];
191 /* [3] = material alpha */
192 value
[3] = ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_FRONT_DIFFUSE
+face
][3];
195 for (i
= 0; i
< 3; i
++) {
196 value
[i
] = ctx
->Light
.Light
[ln
].Specular
[i
] *
197 ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_FRONT_SPECULAR
+face
][i
];
199 /* [3] = material alpha */
200 value
[3] = ctx
->Light
.Material
.Attrib
[MAT_ATTRIB_FRONT_DIFFUSE
+face
][3];
203 _mesa_problem(ctx
, "Invalid lightprod state in fetch_state");
209 /* state[1] is the texture unit */
210 const GLuint unit
= (GLuint
) state
[1];
211 /* state[2] is the texgen attribute */
213 case STATE_TEXGEN_EYE_S
:
214 COPY_4V(value
, ctx
->Texture
.Unit
[unit
].EyePlaneS
);
216 case STATE_TEXGEN_EYE_T
:
217 COPY_4V(value
, ctx
->Texture
.Unit
[unit
].EyePlaneT
);
219 case STATE_TEXGEN_EYE_R
:
220 COPY_4V(value
, ctx
->Texture
.Unit
[unit
].EyePlaneR
);
222 case STATE_TEXGEN_EYE_Q
:
223 COPY_4V(value
, ctx
->Texture
.Unit
[unit
].EyePlaneQ
);
225 case STATE_TEXGEN_OBJECT_S
:
226 COPY_4V(value
, ctx
->Texture
.Unit
[unit
].ObjectPlaneS
);
228 case STATE_TEXGEN_OBJECT_T
:
229 COPY_4V(value
, ctx
->Texture
.Unit
[unit
].ObjectPlaneT
);
231 case STATE_TEXGEN_OBJECT_R
:
232 COPY_4V(value
, ctx
->Texture
.Unit
[unit
].ObjectPlaneR
);
234 case STATE_TEXGEN_OBJECT_Q
:
235 COPY_4V(value
, ctx
->Texture
.Unit
[unit
].ObjectPlaneQ
);
238 _mesa_problem(ctx
, "Invalid texgen state in fetch_state");
242 case STATE_TEXENV_COLOR
:
244 /* state[1] is the texture unit */
245 const GLuint unit
= (GLuint
) state
[1];
246 COPY_4V(value
, ctx
->Texture
.Unit
[unit
].EnvColor
);
249 case STATE_FOG_COLOR
:
250 COPY_4V(value
, ctx
->Fog
.Color
);
252 case STATE_FOG_PARAMS
:
253 value
[0] = ctx
->Fog
.Density
;
254 value
[1] = ctx
->Fog
.Start
;
255 value
[2] = ctx
->Fog
.End
;
256 value
[3] = 1.0F
/ (ctx
->Fog
.End
- ctx
->Fog
.Start
);
258 case STATE_CLIPPLANE
:
260 const GLuint plane
= (GLuint
) state
[1];
261 COPY_4V(value
, ctx
->Transform
.EyeUserPlane
[plane
]);
264 case STATE_POINT_SIZE
:
265 value
[0] = ctx
->Point
.Size
;
266 value
[1] = ctx
->Point
.MinSize
;
267 value
[2] = ctx
->Point
.MaxSize
;
268 value
[3] = ctx
->Point
.Threshold
;
270 case STATE_POINT_ATTENUATION
:
271 value
[0] = ctx
->Point
.Params
[0];
272 value
[1] = ctx
->Point
.Params
[1];
273 value
[2] = ctx
->Point
.Params
[2];
276 case STATE_MODELVIEW_MATRIX
:
277 case STATE_PROJECTION_MATRIX
:
278 case STATE_MVP_MATRIX
:
279 case STATE_TEXTURE_MATRIX
:
280 case STATE_PROGRAM_MATRIX
:
281 /*case STATE_MATRIX:*/
283 /* state[1] = modelview, projection, texture, etc. */
284 /* state[2] = which texture matrix or program matrix */
285 /* state[3] = first row to fetch */
286 /* state[4] = last row to fetch */
287 /* state[5] = transpose, inverse or invtrans */
289 const GLmatrix
*matrix
;
290 const gl_state_index mat
= state
[0];
291 const GLuint index
= (GLuint
) state
[1];
292 const GLuint firstRow
= (GLuint
) state
[2];
293 const GLuint lastRow
= (GLuint
) state
[3];
294 const gl_state_index modifier
= state
[4];
297 ASSERT(firstRow
>= 0);
298 ASSERT(firstRow
< 4);
299 ASSERT(lastRow
>= 0);
301 if (mat
== STATE_MODELVIEW_MATRIX
) {
302 matrix
= ctx
->ModelviewMatrixStack
.Top
;
304 else if (mat
== STATE_PROJECTION_MATRIX
) {
305 matrix
= ctx
->ProjectionMatrixStack
.Top
;
307 else if (mat
== STATE_MVP_MATRIX
) {
308 matrix
= &ctx
->_ModelProjectMatrix
;
310 else if (mat
== STATE_TEXTURE_MATRIX
) {
311 matrix
= ctx
->TextureMatrixStack
[index
].Top
;
313 else if (mat
== STATE_PROGRAM_MATRIX
) {
314 matrix
= ctx
->ProgramMatrixStack
[index
].Top
;
317 _mesa_problem(ctx
, "Bad matrix name in _mesa_fetch_state()");
320 if (modifier
== STATE_MATRIX_INVERSE
||
321 modifier
== STATE_MATRIX_INVTRANS
) {
322 /* Be sure inverse is up to date:
324 _math_matrix_alloc_inv( (GLmatrix
*) matrix
);
325 _math_matrix_analyse( (GLmatrix
*) matrix
);
331 if (modifier
== STATE_MATRIX_TRANSPOSE
||
332 modifier
== STATE_MATRIX_INVTRANS
) {
333 for (i
= 0, row
= firstRow
; row
<= lastRow
; row
++) {
334 value
[i
++] = m
[row
* 4 + 0];
335 value
[i
++] = m
[row
* 4 + 1];
336 value
[i
++] = m
[row
* 4 + 2];
337 value
[i
++] = m
[row
* 4 + 3];
341 for (i
= 0, row
= firstRow
; row
<= lastRow
; row
++) {
342 value
[i
++] = m
[row
+ 0];
343 value
[i
++] = m
[row
+ 4];
344 value
[i
++] = m
[row
+ 8];
345 value
[i
++] = m
[row
+ 12];
350 case STATE_DEPTH_RANGE
:
351 value
[0] = ctx
->Viewport
.Near
; /* near */
352 value
[1] = ctx
->Viewport
.Far
; /* far */
353 value
[2] = ctx
->Viewport
.Far
- ctx
->Viewport
.Near
; /* far - near */
356 case STATE_FRAGMENT_PROGRAM
:
358 /* state[1] = {STATE_ENV, STATE_LOCAL} */
359 /* state[2] = parameter index */
360 const int idx
= (int) state
[2];
363 COPY_4V(value
, ctx
->FragmentProgram
.Parameters
[idx
]);
366 COPY_4V(value
, ctx
->FragmentProgram
.Current
->Base
.LocalParams
[idx
]);
369 _mesa_problem(ctx
, "Bad state switch in _mesa_fetch_state()");
375 case STATE_VERTEX_PROGRAM
:
377 /* state[1] = {STATE_ENV, STATE_LOCAL} */
378 /* state[2] = parameter index */
379 const int idx
= (int) state
[2];
382 COPY_4V(value
, ctx
->VertexProgram
.Parameters
[idx
]);
385 COPY_4V(value
, ctx
->VertexProgram
.Current
->Base
.LocalParams
[idx
]);
388 _mesa_problem(ctx
, "Bad state switch in _mesa_fetch_state()");
394 case STATE_NORMAL_SCALE
:
395 ASSIGN_4V(value
, ctx
->_ModelViewInvScale
, 0, 0, 1);
401 case STATE_TEXRECT_SCALE
: {
402 const int unit
= (int) state
[2];
403 const struct gl_texture_object
*texObj
= ctx
->Texture
.Unit
[unit
]._Current
;
405 struct gl_texture_image
*texImage
= texObj
->Image
[0][0];
406 ASSIGN_4V(value
, 1.0 / texImage
->Width
, 1.0 / texImage
->Height
, 0, 1);
411 /* unknown state indexes are silently ignored
412 * should be handled by the driver.
420 _mesa_problem(ctx
, "Invalid state in _mesa_fetch_state");
427 * Return a bitmask of the Mesa state flags (_NEW_* values) which would
428 * indicate that the given context state may have changed.
429 * The bitmask is used during validation to determine if we need to update
430 * vertex/fragment program parameters (like "state.material.color") when
431 * some GL state has changed.
434 _mesa_program_state_flags(const gl_state_index state
[STATE_LENGTH
])
439 case STATE_LIGHTMODEL_AMBIENT
:
440 case STATE_LIGHTMODEL_SCENECOLOR
:
441 case STATE_LIGHTPROD
:
445 case STATE_TEXENV_COLOR
:
448 case STATE_FOG_COLOR
:
449 case STATE_FOG_PARAMS
:
452 case STATE_CLIPPLANE
:
453 return _NEW_TRANSFORM
;
455 case STATE_POINT_SIZE
:
456 case STATE_POINT_ATTENUATION
:
459 case STATE_MODELVIEW_MATRIX
:
460 return _NEW_MODELVIEW
;
461 case STATE_PROJECTION_MATRIX
:
462 return _NEW_PROJECTION
;
463 case STATE_MVP_MATRIX
:
464 return _NEW_MODELVIEW
| _NEW_PROJECTION
;
465 case STATE_TEXTURE_MATRIX
:
466 return _NEW_TEXTURE_MATRIX
;
467 case STATE_PROGRAM_MATRIX
:
468 return _NEW_TRACK_MATRIX
;
470 case STATE_DEPTH_RANGE
:
471 return _NEW_VIEWPORT
;
473 case STATE_FRAGMENT_PROGRAM
:
474 case STATE_VERTEX_PROGRAM
:
477 case STATE_NORMAL_SCALE
:
478 return _NEW_MODELVIEW
;
482 case STATE_TEXRECT_SCALE
:
485 /* unknown state indexes are silently ignored and
486 * no flag set, since it is handled by the driver.
492 _mesa_problem(NULL
, "unexpected state[0] in make_state_flags()");
499 append(char *dst
, const char *src
)
510 append_token(char *dst
, gl_state_index k
)
514 append(dst
, "material");
517 append(dst
, "light");
519 case STATE_LIGHTMODEL_AMBIENT
:
520 append(dst
, "lightmodel.ambient");
522 case STATE_LIGHTMODEL_SCENECOLOR
:
524 case STATE_LIGHTPROD
:
525 append(dst
, "lightprod");
528 append(dst
, "texgen");
530 case STATE_FOG_COLOR
:
531 append(dst
, "fog.color");
533 case STATE_FOG_PARAMS
:
534 append(dst
, "fog.params");
536 case STATE_CLIPPLANE
:
539 case STATE_POINT_SIZE
:
540 append(dst
, "point.size");
542 case STATE_POINT_ATTENUATION
:
543 append(dst
, "point.attenuation");
545 case STATE_MODELVIEW_MATRIX
:
546 append(dst
, "matrix.modelview");
548 case STATE_PROJECTION_MATRIX
:
549 append(dst
, "matrix.projection");
551 case STATE_MVP_MATRIX
:
552 append(dst
, "matrix.mvp");
554 case STATE_TEXTURE_MATRIX
:
555 append(dst
, "matrix.texture");
557 case STATE_PROGRAM_MATRIX
:
558 append(dst
, "matrix.program");
560 case STATE_MATRIX_INVERSE
:
561 append(dst
, ".inverse");
563 case STATE_MATRIX_TRANSPOSE
:
564 append(dst
, ".transpose");
566 case STATE_MATRIX_INVTRANS
:
567 append(dst
, ".invtrans");
570 append(dst
, ".ambient");
573 append(dst
, ".diffuse");
576 append(dst
, ".specular");
579 append(dst
, ".emission");
581 case STATE_SHININESS
:
582 append(dst
, "lshininess");
584 case STATE_HALF_VECTOR
:
585 append(dst
, ".half");
588 append(dst
, ".position");
590 case STATE_ATTENUATION
:
591 append(dst
, ".attenuation");
593 case STATE_SPOT_DIRECTION
:
594 append(dst
, ".spot.direction");
596 case STATE_SPOT_CUTOFF
:
597 append(dst
, ".spot.cutoff");
599 case STATE_TEXGEN_EYE_S
:
600 append(dst
, "eye.s");
602 case STATE_TEXGEN_EYE_T
:
603 append(dst
, "eye.t");
605 case STATE_TEXGEN_EYE_R
:
606 append(dst
, "eye.r");
608 case STATE_TEXGEN_EYE_Q
:
609 append(dst
, "eye.q");
611 case STATE_TEXGEN_OBJECT_S
:
612 append(dst
, "object.s");
614 case STATE_TEXGEN_OBJECT_T
:
615 append(dst
, "object.t");
617 case STATE_TEXGEN_OBJECT_R
:
618 append(dst
, "object.r");
620 case STATE_TEXGEN_OBJECT_Q
:
621 append(dst
, "object.q");
623 case STATE_TEXENV_COLOR
:
624 append(dst
, "texenv");
626 case STATE_DEPTH_RANGE
:
627 append(dst
, "depth.range");
629 case STATE_VERTEX_PROGRAM
:
630 case STATE_FRAGMENT_PROGRAM
:
636 append(dst
, "local");
638 case STATE_NORMAL_SCALE
:
639 append(dst
, "normalScale");
642 case STATE_POSITION_NORMALIZED
:
643 append(dst
, "(internal)");
651 append_face(char *dst
, GLint face
)
654 append(dst
, "front.");
656 append(dst
, "back.");
660 append_index(char *dst
, GLint index
)
663 _mesa_sprintf(s
, "[%d]", index
);
668 * Make a string from the given state vector.
669 * For example, return "state.matrix.texture[2].inverse".
670 * Use _mesa_free() to deallocate the string.
673 _mesa_program_state_string(const gl_state_index state
[STATE_LENGTH
])
678 append(str
, "state.");
679 append_token(str
, (gl_state_index
) state
[0]);
683 append_face(str
, state
[1]);
684 append_token(str
, (gl_state_index
) state
[2]);
687 append_index(str
, state
[1]); /* light number [i]. */
688 append_token(str
, (gl_state_index
) state
[2]); /* coefficients */
690 case STATE_LIGHTMODEL_AMBIENT
:
691 append(str
, "lightmodel.ambient");
693 case STATE_LIGHTMODEL_SCENECOLOR
:
695 append(str
, "lightmodel.front.scenecolor");
698 append(str
, "lightmodel.back.scenecolor");
701 case STATE_LIGHTPROD
:
702 append_index(str
, state
[1]); /* light number [i]. */
703 append_face(str
, state
[2]);
704 append_token(str
, (gl_state_index
) state
[3]);
707 append_index(str
, state
[1]); /* tex unit [i] */
708 append_token(str
, (gl_state_index
) state
[2]); /* plane coef */
710 case STATE_TEXENV_COLOR
:
711 append_index(str
, state
[1]); /* tex unit [i] */
712 append(str
, "color");
714 case STATE_CLIPPLANE
:
715 append_index(str
, state
[1]); /* plane [i] */
716 append(str
, ".plane");
718 case STATE_MODELVIEW_MATRIX
:
719 case STATE_PROJECTION_MATRIX
:
720 case STATE_MVP_MATRIX
:
721 case STATE_TEXTURE_MATRIX
:
722 case STATE_PROGRAM_MATRIX
:
724 /* state[0] = modelview, projection, texture, etc. */
725 /* state[1] = which texture matrix or program matrix */
726 /* state[2] = first row to fetch */
727 /* state[3] = last row to fetch */
728 /* state[4] = transpose, inverse or invtrans */
729 const gl_state_index mat
= (gl_state_index
) state
[0];
730 const GLuint index
= (GLuint
) state
[1];
731 const GLuint firstRow
= (GLuint
) state
[2];
732 const GLuint lastRow
= (GLuint
) state
[3];
733 const gl_state_index modifier
= (gl_state_index
) state
[4];
735 mat
== STATE_TEXTURE_MATRIX
||
736 mat
== STATE_PROGRAM_MATRIX
)
737 append_index(str
, index
);
739 append_token(str
, modifier
);
740 if (firstRow
== lastRow
)
741 _mesa_sprintf(tmp
, ".row[%d]", firstRow
);
743 _mesa_sprintf(tmp
, ".row[%d..%d]", firstRow
, lastRow
);
747 case STATE_DEPTH_RANGE
:
749 case STATE_FRAGMENT_PROGRAM
:
750 case STATE_VERTEX_PROGRAM
:
751 /* state[1] = {STATE_ENV, STATE_LOCAL} */
752 /* state[2] = parameter index */
753 append_token(str
, (gl_state_index
) state
[1]);
754 append_index(str
, state
[2]);
759 _mesa_problem(NULL
, "Invalid state in _mesa_program_state_string");
763 return _mesa_strdup(str
);
768 * Loop over all the parameters in a parameter list. If the parameter
769 * is a GL state reference, look up the current value of that state
770 * variable and put it into the parameter's Value[4] array.
771 * This would be called at glBegin time when using a fragment program.
774 _mesa_load_state_parameters(GLcontext
*ctx
,
775 struct gl_program_parameter_list
*paramList
)
782 for (i
= 0; i
< paramList
->NumParameters
; i
++) {
783 if (paramList
->Parameters
[i
].Type
== PROGRAM_STATE_VAR
) {
784 _mesa_fetch_state(ctx
,
785 (gl_state_index
*) paramList
->Parameters
[i
].StateIndexes
,
786 paramList
->ParameterValues
[i
]);