e26ded9e0cf828931279ac40bf9e438a101f949b
[mesa.git] / src / mesa / program / prog_statevars.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.1
4 *
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
6 *
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:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
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 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 #ifndef PROG_STATEVARS_H
27 #define PROG_STATEVARS_H
28
29
30 #include "main/glheader.h"
31
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37
38 struct gl_context;
39 struct gl_program_parameter_list;
40
41 /**
42 * Number of STATE_* values we need to address any GL state.
43 * Used to dimension arrays.
44 */
45 #define STATE_LENGTH 5
46
47
48 /**
49 * Used for describing GL state referenced from inside ARB vertex and
50 * fragment programs.
51 * A string such as "state.light[0].ambient" gets translated into a
52 * sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ].
53 *
54 * For state that's an array, like STATE_CLIPPLANE, the 2nd token [1] should
55 * always be the array index.
56 */
57 typedef enum gl_state_index_ {
58 STATE_MATERIAL = 100, /* start at 100 so small ints are seen as ints */
59
60 STATE_LIGHT,
61 STATE_LIGHTMODEL_AMBIENT,
62 STATE_LIGHTMODEL_SCENECOLOR,
63 STATE_LIGHTPROD,
64
65 STATE_TEXGEN,
66
67 STATE_FOG_COLOR,
68 STATE_FOG_PARAMS,
69
70 STATE_CLIPPLANE,
71
72 STATE_POINT_SIZE,
73 STATE_POINT_ATTENUATION,
74
75 STATE_MODELVIEW_MATRIX,
76 STATE_PROJECTION_MATRIX,
77 STATE_MVP_MATRIX,
78 STATE_TEXTURE_MATRIX,
79 STATE_PROGRAM_MATRIX,
80 STATE_MATRIX_INVERSE,
81 STATE_MATRIX_TRANSPOSE,
82 STATE_MATRIX_INVTRANS,
83
84 STATE_AMBIENT,
85 STATE_DIFFUSE,
86 STATE_SPECULAR,
87 STATE_EMISSION,
88 STATE_SHININESS,
89 STATE_HALF_VECTOR,
90
91 STATE_POSITION, /**< xyzw = position */
92 STATE_ATTENUATION, /**< xyz = attenuation, w = spot exponent */
93 STATE_SPOT_DIRECTION, /**< xyz = direction, w = cos(cutoff) */
94 STATE_SPOT_CUTOFF, /**< x = cutoff, yzw = undefined */
95
96 STATE_TEXGEN_EYE_S,
97 STATE_TEXGEN_EYE_T,
98 STATE_TEXGEN_EYE_R,
99 STATE_TEXGEN_EYE_Q,
100 STATE_TEXGEN_OBJECT_S,
101 STATE_TEXGEN_OBJECT_T,
102 STATE_TEXGEN_OBJECT_R,
103 STATE_TEXGEN_OBJECT_Q,
104
105 STATE_TEXENV_COLOR,
106
107 STATE_DEPTH_RANGE,
108
109 STATE_VERTEX_PROGRAM,
110 STATE_FRAGMENT_PROGRAM,
111
112 STATE_ENV,
113 STATE_LOCAL,
114
115 STATE_INTERNAL, /* Mesa additions */
116 STATE_CURRENT_ATTRIB, /* ctx->Current vertex attrib value */
117 STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED, /* ctx->Current vertex attrib value after passthrough vertex processing */
118 STATE_NORMAL_SCALE,
119 STATE_TEXRECT_SCALE,
120 STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */
121 STATE_POINT_SIZE_CLAMPED, /* includes implementation dependent size clamp */
122 STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */
123 STATE_LIGHT_POSITION, /* object vs eye space */
124 STATE_LIGHT_POSITION_NORMALIZED, /* object vs eye space */
125 STATE_LIGHT_HALF_VECTOR, /* object vs eye space */
126 STATE_PT_SCALE, /**< Pixel transfer RGBA scale */
127 STATE_PT_BIAS, /**< Pixel transfer RGBA bias */
128 STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */
129 STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */
130 STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */
131 STATE_ROT_MATRIX_1, /**< ATI_envmap_bumpmap, rot matrix row 1 */
132 STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */
133 } gl_state_index;
134
135
136
137 extern void
138 _mesa_load_state_parameters(struct gl_context *ctx,
139 struct gl_program_parameter_list *paramList);
140
141
142 extern GLbitfield
143 _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]);
144
145
146 extern char *
147 _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]);
148
149
150
151 #ifdef __cplusplus
152 }
153 #endif
154
155 #endif /* PROG_STATEVARS_H */