Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian | a7e1b44 | 2007-11-28 15:19:46 -0700 | [diff] [blame] | 3 | * Version: 7.1 |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 4 | * |
Brian | a7e1b44 | 2007-11-28 15:19:46 -0700 | [diff] [blame] | 5 | * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 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 | * 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. |
| 23 | */ |
| 24 | |
| 25 | #ifndef PROG_STATEVARS_H |
| 26 | #define PROG_STATEVARS_H |
| 27 | |
José Fonseca | 101d1a6 | 2008-07-23 21:06:01 +0900 | [diff] [blame] | 28 | #include "main/mtypes.h" |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 29 | |
| 30 | |
| 31 | /** |
Brian | b7978af | 2007-01-09 19:17:17 -0700 | [diff] [blame] | 32 | * Number of STATE_* values we need to address any GL state. |
| 33 | * Used to dimension arrays. |
| 34 | */ |
Brian | 776bc9c | 2007-02-22 09:29:46 -0700 | [diff] [blame] | 35 | #define STATE_LENGTH 5 |
Brian | b7978af | 2007-01-09 19:17:17 -0700 | [diff] [blame] | 36 | |
| 37 | |
| 38 | /** |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 39 | * Used for describing GL state referenced from inside ARB vertex and |
| 40 | * fragment programs. |
| 41 | * A string such as "state.light[0].ambient" gets translated into a |
| 42 | * sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ]. |
Brian | 6531952 | 2007-02-21 11:08:21 -0700 | [diff] [blame] | 43 | * |
| 44 | * For state that's an array, like STATE_CLIPPLANE, the 2nd token [1] should |
| 45 | * always be the array index. |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 46 | */ |
| 47 | typedef enum gl_state_index_ { |
| 48 | STATE_MATERIAL = 100, /* start at 100 so small ints are seen as ints */ |
| 49 | |
| 50 | STATE_LIGHT, |
| 51 | STATE_LIGHTMODEL_AMBIENT, |
| 52 | STATE_LIGHTMODEL_SCENECOLOR, |
| 53 | STATE_LIGHTPROD, |
| 54 | |
| 55 | STATE_TEXGEN, |
| 56 | |
| 57 | STATE_FOG_COLOR, |
| 58 | STATE_FOG_PARAMS, |
| 59 | |
| 60 | STATE_CLIPPLANE, |
| 61 | |
| 62 | STATE_POINT_SIZE, |
| 63 | STATE_POINT_ATTENUATION, |
| 64 | |
Brian | 6531952 | 2007-02-21 11:08:21 -0700 | [diff] [blame] | 65 | STATE_MODELVIEW_MATRIX, |
| 66 | STATE_PROJECTION_MATRIX, |
| 67 | STATE_MVP_MATRIX, |
| 68 | STATE_TEXTURE_MATRIX, |
| 69 | STATE_PROGRAM_MATRIX, |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 70 | STATE_MATRIX_INVERSE, |
| 71 | STATE_MATRIX_TRANSPOSE, |
| 72 | STATE_MATRIX_INVTRANS, |
| 73 | |
| 74 | STATE_AMBIENT, |
| 75 | STATE_DIFFUSE, |
| 76 | STATE_SPECULAR, |
| 77 | STATE_EMISSION, |
| 78 | STATE_SHININESS, |
Nicolai Haehnle | c117d0e | 2008-07-27 21:31:49 +0200 | [diff] [blame] | 79 | STATE_HALF_VECTOR, |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 80 | |
Brian Paul | 6f346ec | 2008-12-30 17:00:36 -0700 | [diff] [blame] | 81 | STATE_POSITION, /**< xyzw = position */ |
| 82 | STATE_ATTENUATION, /**< xyz = attenuation, w = spot exponent */ |
| 83 | STATE_SPOT_DIRECTION, /**< xyz = direction, w = cos(cutoff) */ |
| 84 | STATE_SPOT_CUTOFF, /**< x = cutoff, yzw = undefined */ |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 85 | |
| 86 | STATE_TEXGEN_EYE_S, |
| 87 | STATE_TEXGEN_EYE_T, |
| 88 | STATE_TEXGEN_EYE_R, |
| 89 | STATE_TEXGEN_EYE_Q, |
| 90 | STATE_TEXGEN_OBJECT_S, |
| 91 | STATE_TEXGEN_OBJECT_T, |
| 92 | STATE_TEXGEN_OBJECT_R, |
| 93 | STATE_TEXGEN_OBJECT_Q, |
| 94 | |
| 95 | STATE_TEXENV_COLOR, |
Nicolai Haehnle | c117d0e | 2008-07-27 21:31:49 +0200 | [diff] [blame] | 96 | |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 97 | STATE_DEPTH_RANGE, |
| 98 | |
| 99 | STATE_VERTEX_PROGRAM, |
| 100 | STATE_FRAGMENT_PROGRAM, |
| 101 | |
| 102 | STATE_ENV, |
| 103 | STATE_LOCAL, |
| 104 | |
| 105 | STATE_INTERNAL, /* Mesa additions */ |
Keith Whitwell | fa1b533 | 2008-10-03 13:55:40 +0100 | [diff] [blame] | 106 | STATE_CURRENT_ATTRIB, /* ctx->Current vertex attrib value */ |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 107 | STATE_NORMAL_SCALE, |
| 108 | STATE_TEXRECT_SCALE, |
Brian | 96abc6b | 2007-02-22 09:08:53 -0700 | [diff] [blame] | 109 | STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */ |
Roland Scheidegger | 2c326e7 | 2010-02-04 19:23:09 +0100 | [diff] [blame] | 110 | STATE_POINT_SIZE_CLAMPED, /* includes implementation dependent size clamp */ |
| 111 | STATE_POINT_SIZE_IMPL_CLAMP, /* for implementation clamp only in vs */ |
Keith Whitwell | adc1f88 | 2008-05-23 09:10:59 +0100 | [diff] [blame] | 112 | STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */ |
| 113 | STATE_LIGHT_POSITION, /* object vs eye space */ |
| 114 | STATE_LIGHT_POSITION_NORMALIZED, /* object vs eye space */ |
| 115 | STATE_LIGHT_HALF_VECTOR, /* object vs eye space */ |
Brian Paul | 2f8fc32 | 2008-05-18 15:50:20 -0600 | [diff] [blame] | 116 | STATE_PT_SCALE, /**< Pixel transfer RGBA scale */ |
| 117 | STATE_PT_BIAS, /**< Pixel transfer RGBA bias */ |
Nicolai Haehnle | c117d0e | 2008-07-27 21:31:49 +0200 | [diff] [blame] | 118 | STATE_SHADOW_AMBIENT, /**< ARB_shadow_ambient fail value; token[2] is texture unit index */ |
Brian Paul | 1f45ae0 | 2009-03-20 20:15:58 -0600 | [diff] [blame] | 119 | STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */ |
Roland Scheidegger | 114152e | 2009-03-12 15:01:16 +0100 | [diff] [blame] | 120 | STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */ |
| 121 | STATE_ROT_MATRIX_1, /**< ATI_envmap_bumpmap, rot matrix row 1 */ |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 122 | STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */ |
| 123 | } gl_state_index; |
| 124 | |
| 125 | |
| 126 | |
| 127 | extern void |
Kristian Høgsberg | f9995b3 | 2010-10-12 12:26:10 -0400 | [diff] [blame^] | 128 | _mesa_load_state_parameters(struct gl_context *ctx, |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 129 | struct gl_program_parameter_list *paramList); |
| 130 | |
| 131 | |
| 132 | extern GLbitfield |
Brian | aa9d22a | 2007-02-23 11:21:03 -0700 | [diff] [blame] | 133 | _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]); |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 134 | |
| 135 | |
Michal Krol | ce3cf63 | 2008-09-05 12:25:50 +0200 | [diff] [blame] | 136 | extern char * |
Brian | aa9d22a | 2007-02-23 11:21:03 -0700 | [diff] [blame] | 137 | _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]); |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 138 | |
| 139 | |
Brian | a7e1b44 | 2007-11-28 15:19:46 -0700 | [diff] [blame] | 140 | extern void |
Kristian Høgsberg | f9995b3 | 2010-10-12 12:26:10 -0400 | [diff] [blame^] | 141 | _mesa_load_tracked_matrices(struct gl_context *ctx); |
Brian | a7e1b44 | 2007-11-28 15:19:46 -0700 | [diff] [blame] | 142 | |
| 143 | |
Brian | 00cdc0a | 2006-12-14 15:01:06 -0700 | [diff] [blame] | 144 | #endif /* PROG_STATEVARS_H */ |