prog_statevars.h revision 3464ebd5
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 * 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 28#include "main/glheader.h" 29 30struct gl_context; 31struct gl_program_parameter_list; 32 33/** 34 * Number of STATE_* values we need to address any GL state. 35 * Used to dimension arrays. 36 */ 37#define STATE_LENGTH 5 38 39 40/** 41 * Used for describing GL state referenced from inside ARB vertex and 42 * fragment programs. 43 * A string such as "state.light[0].ambient" gets translated into a 44 * sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ]. 45 * 46 * For state that's an array, like STATE_CLIPPLANE, the 2nd token [1] should 47 * always be the array index. 48 */ 49typedef enum gl_state_index_ { 50 STATE_MATERIAL = 100, /* start at 100 so small ints are seen as ints */ 51 52 STATE_LIGHT, 53 STATE_LIGHTMODEL_AMBIENT, 54 STATE_LIGHTMODEL_SCENECOLOR, 55 STATE_LIGHTPROD, 56 57 STATE_TEXGEN, 58 59 STATE_FOG_COLOR, 60 STATE_FOG_PARAMS, 61 62 STATE_CLIPPLANE, 63 64 STATE_POINT_SIZE, 65 STATE_POINT_ATTENUATION, 66 67 STATE_MODELVIEW_MATRIX, 68 STATE_PROJECTION_MATRIX, 69 STATE_MVP_MATRIX, 70 STATE_TEXTURE_MATRIX, 71 STATE_PROGRAM_MATRIX, 72 STATE_MATRIX_INVERSE, 73 STATE_MATRIX_TRANSPOSE, 74 STATE_MATRIX_INVTRANS, 75 76 STATE_AMBIENT, 77 STATE_DIFFUSE, 78 STATE_SPECULAR, 79 STATE_EMISSION, 80 STATE_SHININESS, 81 STATE_HALF_VECTOR, 82 83 STATE_POSITION, /**< xyzw = position */ 84 STATE_ATTENUATION, /**< xyz = attenuation, w = spot exponent */ 85 STATE_SPOT_DIRECTION, /**< xyz = direction, w = cos(cutoff) */ 86 STATE_SPOT_CUTOFF, /**< x = cutoff, yzw = undefined */ 87 88 STATE_TEXGEN_EYE_S, 89 STATE_TEXGEN_EYE_T, 90 STATE_TEXGEN_EYE_R, 91 STATE_TEXGEN_EYE_Q, 92 STATE_TEXGEN_OBJECT_S, 93 STATE_TEXGEN_OBJECT_T, 94 STATE_TEXGEN_OBJECT_R, 95 STATE_TEXGEN_OBJECT_Q, 96 97 STATE_TEXENV_COLOR, 98 99 STATE_DEPTH_RANGE, 100 101 STATE_VERTEX_PROGRAM, 102 STATE_FRAGMENT_PROGRAM, 103 104 STATE_ENV, 105 STATE_LOCAL, 106 107 STATE_INTERNAL, /* Mesa additions */ 108 STATE_CURRENT_ATTRIB, /* ctx->Current vertex attrib value */ 109 STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED, /* ctx->Current vertex attrib value after passthrough vertex processing */ 110 STATE_NORMAL_SCALE, 111 STATE_TEXRECT_SCALE, 112 STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */ 113 STATE_POINT_SIZE_CLAMPED, /* includes implementation dependent size clamp */ 114 STATE_POINT_SIZE_IMPL_CLAMP, /* for implementation clamp only in vs */ 115 STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */ 116 STATE_LIGHT_POSITION, /* object vs eye space */ 117 STATE_LIGHT_POSITION_NORMALIZED, /* object vs eye space */ 118 STATE_LIGHT_HALF_VECTOR, /* object vs eye space */ 119 STATE_PT_SCALE, /**< Pixel transfer RGBA scale */ 120 STATE_PT_BIAS, /**< Pixel transfer RGBA bias */ 121 STATE_SHADOW_AMBIENT, /**< ARB_shadow_ambient fail value; token[2] is texture unit index */ 122 STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */ 123 STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */ 124 STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */ 125 STATE_ROT_MATRIX_1, /**< ATI_envmap_bumpmap, rot matrix row 1 */ 126 STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */ 127} gl_state_index; 128 129 130 131extern void 132_mesa_load_state_parameters(struct gl_context *ctx, 133 struct gl_program_parameter_list *paramList); 134 135 136extern GLbitfield 137_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]); 138 139 140extern char * 141_mesa_program_state_string(const gl_state_index state[STATE_LENGTH]); 142 143 144extern void 145_mesa_load_tracked_matrices(struct gl_context *ctx); 146 147 148#endif /* PROG_STATEVARS_H */ 149