2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef PROG_STATEVARS_H
26 #define PROG_STATEVARS_H
29 #include "main/glheader.h"
38 struct gl_program_parameter_list;
41 * Number of STATE_* values we need to address any GL state.
42 * Used to dimension arrays.
44 #define STATE_LENGTH 5
48 * Used for describing GL state referenced from inside ARB vertex and
50 * A string such as "state.light[0].ambient" gets translated into a
51 * sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ].
53 * For state that's an array, like STATE_CLIPPLANE, the 2nd token [1] should
54 * always be the array index.
56 typedef enum gl_state_index_ {
57 STATE_MATERIAL = 100, /* start at 100 so small ints are seen as ints */
60 STATE_LIGHTMODEL_AMBIENT,
61 STATE_LIGHTMODEL_SCENECOLOR,
72 STATE_POINT_ATTENUATION,
74 STATE_MODELVIEW_MATRIX,
75 STATE_PROJECTION_MATRIX,
80 STATE_MATRIX_TRANSPOSE,
81 STATE_MATRIX_INVTRANS,
90 STATE_POSITION, /**< xyzw = position */
91 STATE_ATTENUATION, /**< xyz = attenuation, w = spot exponent */
92 STATE_SPOT_DIRECTION, /**< xyz = direction, w = cos(cutoff) */
93 STATE_SPOT_CUTOFF, /**< x = cutoff, yzw = undefined */
99 STATE_TEXGEN_OBJECT_S,
100 STATE_TEXGEN_OBJECT_T,
101 STATE_TEXGEN_OBJECT_R,
102 STATE_TEXGEN_OBJECT_Q,
108 STATE_VERTEX_PROGRAM,
109 STATE_FRAGMENT_PROGRAM,
114 STATE_INTERNAL, /* Mesa additions */
115 STATE_CURRENT_ATTRIB, /* ctx->Current vertex attrib value */
116 STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED, /* ctx->Current vertex attrib value after passthrough vertex processing */
119 STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */
120 STATE_POINT_SIZE_CLAMPED, /* includes implementation dependent size clamp */
121 STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */
122 STATE_LIGHT_POSITION, /* object vs eye space */
123 STATE_LIGHT_POSITION_NORMALIZED, /* object vs eye space */
124 STATE_LIGHT_HALF_VECTOR, /* object vs eye space */
125 STATE_PT_SCALE, /**< Pixel transfer RGBA scale */
126 STATE_PT_BIAS, /**< Pixel transfer RGBA bias */
127 STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */
128 STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */
129 STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */
130 STATE_ROT_MATRIX_1, /**< ATI_envmap_bumpmap, rot matrix row 1 */
131 STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */
137 _mesa_load_state_parameters(struct gl_context *ctx,
138 struct gl_program_parameter_list *paramList);
142 _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]);
146 _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]);
154 #endif /* PROG_STATEVARS_H */