Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 3 | * |
Brian | a7e1b44 | 2007-11-28 15:19:46 -0700 | [diff] [blame] | 4 | * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 5 | * |
| 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: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 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 |
Kenneth Graunke | 3d8d5b2 | 2013-04-21 13:46:48 -0700 | [diff] [blame] | 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. |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 23 | */ |
| 24 | |
| 25 | #ifndef PROG_STATEVARS_H |
| 26 | #define PROG_STATEVARS_H |
| 27 | |
José Fonseca | 63e7a4c | 2011-11-09 10:20:51 +0000 | [diff] [blame] | 28 | |
Vinson Lee | 488e994 | 2010-12-18 01:16:53 -0800 | [diff] [blame] | 29 | #include "main/glheader.h" |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 30 | |
José Fonseca | 63e7a4c | 2011-11-09 10:20:51 +0000 | [diff] [blame] | 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | |
| 36 | |
Vinson Lee | 488e994 | 2010-12-18 01:16:53 -0800 | [diff] [blame] | 37 | struct gl_context; |
| 38 | struct gl_program_parameter_list; |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 39 | |
| 40 | /** |
Brian | b7978af | 2007-01-09 19:17:17 -0700 | [diff] [blame] | 41 | * Number of STATE_* values we need to address any GL state. |
| 42 | * Used to dimension arrays. |
| 43 | */ |
Brian | 776bc9c | 2007-02-22 09:29:46 -0700 | [diff] [blame] | 44 | #define STATE_LENGTH 5 |
Brian | b7978af | 2007-01-09 19:17:17 -0700 | [diff] [blame] | 45 | |
| 46 | |
| 47 | /** |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 48 | * Used for describing GL state referenced from inside ARB vertex and |
| 49 | * fragment programs. |
| 50 | * A string such as "state.light[0].ambient" gets translated into a |
| 51 | * sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ]. |
Brian | 6531952 | 2007-02-21 11:08:21 -0700 | [diff] [blame] | 52 | * |
| 53 | * For state that's an array, like STATE_CLIPPLANE, the 2nd token [1] should |
| 54 | * always be the array index. |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 55 | */ |
| 56 | typedef enum gl_state_index_ { |
| 57 | STATE_MATERIAL = 100, /* start at 100 so small ints are seen as ints */ |
| 58 | |
| 59 | STATE_LIGHT, |
| 60 | STATE_LIGHTMODEL_AMBIENT, |
| 61 | STATE_LIGHTMODEL_SCENECOLOR, |
| 62 | STATE_LIGHTPROD, |
| 63 | |
| 64 | STATE_TEXGEN, |
| 65 | |
| 66 | STATE_FOG_COLOR, |
| 67 | STATE_FOG_PARAMS, |
| 68 | |
| 69 | STATE_CLIPPLANE, |
| 70 | |
| 71 | STATE_POINT_SIZE, |
| 72 | STATE_POINT_ATTENUATION, |
| 73 | |
Brian | 6531952 | 2007-02-21 11:08:21 -0700 | [diff] [blame] | 74 | STATE_MODELVIEW_MATRIX, |
| 75 | STATE_PROJECTION_MATRIX, |
| 76 | STATE_MVP_MATRIX, |
| 77 | STATE_TEXTURE_MATRIX, |
| 78 | STATE_PROGRAM_MATRIX, |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 79 | STATE_MATRIX_INVERSE, |
| 80 | STATE_MATRIX_TRANSPOSE, |
| 81 | STATE_MATRIX_INVTRANS, |
| 82 | |
| 83 | STATE_AMBIENT, |
| 84 | STATE_DIFFUSE, |
| 85 | STATE_SPECULAR, |
| 86 | STATE_EMISSION, |
| 87 | STATE_SHININESS, |
Nicolai Haehnle | c117d0e | 2008-07-27 21:31:49 +0200 | [diff] [blame] | 88 | STATE_HALF_VECTOR, |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 89 | |
Brian Paul | 6f346ec | 2008-12-30 17:00:36 -0700 | [diff] [blame] | 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 */ |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 94 | |
| 95 | STATE_TEXGEN_EYE_S, |
| 96 | STATE_TEXGEN_EYE_T, |
| 97 | STATE_TEXGEN_EYE_R, |
| 98 | STATE_TEXGEN_EYE_Q, |
| 99 | STATE_TEXGEN_OBJECT_S, |
| 100 | STATE_TEXGEN_OBJECT_T, |
| 101 | STATE_TEXGEN_OBJECT_R, |
| 102 | STATE_TEXGEN_OBJECT_Q, |
| 103 | |
| 104 | STATE_TEXENV_COLOR, |
Nicolai Haehnle | c117d0e | 2008-07-27 21:31:49 +0200 | [diff] [blame] | 105 | |
Anuj Phogat | 0d69e8c | 2013-10-02 18:02:20 -0700 | [diff] [blame^] | 106 | STATE_NUM_SAMPLES, /* An integer, not a float like the other state vars */ |
| 107 | |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 108 | STATE_DEPTH_RANGE, |
| 109 | |
| 110 | STATE_VERTEX_PROGRAM, |
| 111 | STATE_FRAGMENT_PROGRAM, |
| 112 | |
| 113 | STATE_ENV, |
| 114 | STATE_LOCAL, |
| 115 | |
| 116 | STATE_INTERNAL, /* Mesa additions */ |
Keith Whitwell | fa1b533 | 2008-10-03 13:55:40 +0100 | [diff] [blame] | 117 | STATE_CURRENT_ATTRIB, /* ctx->Current vertex attrib value */ |
Marek Olšák | e5c6a92 | 2011-02-15 23:30:23 +0100 | [diff] [blame] | 118 | STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED, /* ctx->Current vertex attrib value after passthrough vertex processing */ |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 119 | STATE_NORMAL_SCALE, |
| 120 | STATE_TEXRECT_SCALE, |
Brian | 96abc6b | 2007-02-22 09:08:53 -0700 | [diff] [blame] | 121 | STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */ |
Roland Scheidegger | 2c326e7 | 2010-02-04 19:23:09 +0100 | [diff] [blame] | 122 | STATE_POINT_SIZE_CLAMPED, /* includes implementation dependent size clamp */ |
Keith Whitwell | adc1f88 | 2008-05-23 09:10:59 +0100 | [diff] [blame] | 123 | STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */ |
| 124 | STATE_LIGHT_POSITION, /* object vs eye space */ |
| 125 | STATE_LIGHT_POSITION_NORMALIZED, /* object vs eye space */ |
| 126 | STATE_LIGHT_HALF_VECTOR, /* object vs eye space */ |
Brian Paul | 2f8fc32 | 2008-05-18 15:50:20 -0600 | [diff] [blame] | 127 | STATE_PT_SCALE, /**< Pixel transfer RGBA scale */ |
| 128 | STATE_PT_BIAS, /**< Pixel transfer RGBA bias */ |
Brian Paul | 1f45ae0 | 2009-03-20 20:15:58 -0600 | [diff] [blame] | 129 | STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */ |
Christoph Bumiller | f986a65 | 2011-05-03 00:00:55 +0200 | [diff] [blame] | 130 | STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */ |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 131 | STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */ |
| 132 | STATE_ROT_MATRIX_1, /**< ATI_envmap_bumpmap, rot matrix row 1 */ |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 133 | STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */ |
| 134 | } gl_state_index; |
| 135 | |
| 136 | |
| 137 | |
| 138 | extern void |
Kristian Høgsberg | f9995b3 | 2010-10-12 12:26:10 -0400 | [diff] [blame] | 139 | _mesa_load_state_parameters(struct gl_context *ctx, |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 140 | struct gl_program_parameter_list *paramList); |
| 141 | |
| 142 | |
| 143 | extern GLbitfield |
Brian | aa9d22a | 2007-02-23 11:21:03 -0700 | [diff] [blame] | 144 | _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]); |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 145 | |
| 146 | |
Michal Krol | ce3cf63 | 2008-09-05 12:25:50 +0200 | [diff] [blame] | 147 | extern char * |
Brian | aa9d22a | 2007-02-23 11:21:03 -0700 | [diff] [blame] | 148 | _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]); |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 149 | |
| 150 | |
Brian | a7e1b44 | 2007-11-28 15:19:46 -0700 | [diff] [blame] | 151 | |
José Fonseca | 63e7a4c | 2011-11-09 10:20:51 +0000 | [diff] [blame] | 152 | #ifdef __cplusplus |
| 153 | } |
| 154 | #endif |
| 155 | |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 156 | #endif /* PROG_STATEVARS_H */ |