1848b8605Smrg/* 2848b8605Smrg * Mesa 3-D graphics library 3848b8605Smrg * 4848b8605Smrg * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the "Software"), 8848b8605Smrg * to deal in the Software without restriction, including without limitation 9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 11848b8605Smrg * Software is furnished to do so, subject to the following conditions: 12848b8605Smrg * 13848b8605Smrg * The above copyright notice and this permission notice shall be included 14848b8605Smrg * in all copies or substantial portions of the Software. 15848b8605Smrg * 16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE. 23848b8605Smrg */ 24848b8605Smrg 25848b8605Smrg#ifndef PROG_STATEVARS_H 26848b8605Smrg#define PROG_STATEVARS_H 27848b8605Smrg 28848b8605Smrg 29848b8605Smrg#include "main/glheader.h" 30b8e80941Smrg#include "compiler/shader_enums.h" 31848b8605Smrg 32848b8605Smrg 33848b8605Smrg#ifdef __cplusplus 34848b8605Smrgextern "C" { 35848b8605Smrg#endif 36848b8605Smrg 37848b8605Smrg 38848b8605Smrgstruct gl_context; 39848b8605Smrgstruct gl_program_parameter_list; 40848b8605Smrg 41848b8605Smrg 42848b8605Smrg/** 43848b8605Smrg * Used for describing GL state referenced from inside ARB vertex and 44848b8605Smrg * fragment programs. 45848b8605Smrg * A string such as "state.light[0].ambient" gets translated into a 46848b8605Smrg * sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ]. 47848b8605Smrg * 48848b8605Smrg * For state that's an array, like STATE_CLIPPLANE, the 2nd token [1] should 49848b8605Smrg * always be the array index. 50848b8605Smrg */ 51848b8605Smrgtypedef enum gl_state_index_ { 52848b8605Smrg STATE_MATERIAL = 100, /* start at 100 so small ints are seen as ints */ 53848b8605Smrg 54848b8605Smrg STATE_LIGHT, 55848b8605Smrg STATE_LIGHTMODEL_AMBIENT, 56848b8605Smrg STATE_LIGHTMODEL_SCENECOLOR, 57848b8605Smrg STATE_LIGHTPROD, 58848b8605Smrg 59848b8605Smrg STATE_TEXGEN, 60848b8605Smrg 61848b8605Smrg STATE_FOG_COLOR, 62848b8605Smrg STATE_FOG_PARAMS, 63848b8605Smrg 64848b8605Smrg STATE_CLIPPLANE, 65848b8605Smrg 66848b8605Smrg STATE_POINT_SIZE, 67848b8605Smrg STATE_POINT_ATTENUATION, 68848b8605Smrg 69848b8605Smrg STATE_MODELVIEW_MATRIX, 70848b8605Smrg STATE_PROJECTION_MATRIX, 71848b8605Smrg STATE_MVP_MATRIX, 72848b8605Smrg STATE_TEXTURE_MATRIX, 73848b8605Smrg STATE_PROGRAM_MATRIX, 74848b8605Smrg STATE_MATRIX_INVERSE, 75848b8605Smrg STATE_MATRIX_TRANSPOSE, 76848b8605Smrg STATE_MATRIX_INVTRANS, 77848b8605Smrg 78848b8605Smrg STATE_AMBIENT, 79848b8605Smrg STATE_DIFFUSE, 80848b8605Smrg STATE_SPECULAR, 81848b8605Smrg STATE_EMISSION, 82848b8605Smrg STATE_SHININESS, 83848b8605Smrg STATE_HALF_VECTOR, 84848b8605Smrg 85848b8605Smrg STATE_POSITION, /**< xyzw = position */ 86848b8605Smrg STATE_ATTENUATION, /**< xyz = attenuation, w = spot exponent */ 87848b8605Smrg STATE_SPOT_DIRECTION, /**< xyz = direction, w = cos(cutoff) */ 88848b8605Smrg STATE_SPOT_CUTOFF, /**< x = cutoff, yzw = undefined */ 89848b8605Smrg 90848b8605Smrg STATE_TEXGEN_EYE_S, 91848b8605Smrg STATE_TEXGEN_EYE_T, 92848b8605Smrg STATE_TEXGEN_EYE_R, 93848b8605Smrg STATE_TEXGEN_EYE_Q, 94848b8605Smrg STATE_TEXGEN_OBJECT_S, 95848b8605Smrg STATE_TEXGEN_OBJECT_T, 96848b8605Smrg STATE_TEXGEN_OBJECT_R, 97848b8605Smrg STATE_TEXGEN_OBJECT_Q, 98848b8605Smrg 99848b8605Smrg STATE_TEXENV_COLOR, 100848b8605Smrg 101848b8605Smrg STATE_NUM_SAMPLES, /* An integer, not a float like the other state vars */ 102848b8605Smrg 103848b8605Smrg STATE_DEPTH_RANGE, 104848b8605Smrg 105848b8605Smrg STATE_VERTEX_PROGRAM, 106848b8605Smrg STATE_FRAGMENT_PROGRAM, 107848b8605Smrg 108848b8605Smrg STATE_ENV, 109848b8605Smrg STATE_LOCAL, 110848b8605Smrg 111848b8605Smrg STATE_INTERNAL, /* Mesa additions */ 112848b8605Smrg STATE_CURRENT_ATTRIB, /* ctx->Current vertex attrib value */ 113848b8605Smrg STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED, /* ctx->Current vertex attrib value after passthrough vertex processing */ 114848b8605Smrg STATE_NORMAL_SCALE, 115848b8605Smrg STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */ 116848b8605Smrg STATE_POINT_SIZE_CLAMPED, /* includes implementation dependent size clamp */ 117848b8605Smrg STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */ 118848b8605Smrg STATE_LIGHT_POSITION, /* object vs eye space */ 119848b8605Smrg STATE_LIGHT_POSITION_NORMALIZED, /* object vs eye space */ 120848b8605Smrg STATE_LIGHT_HALF_VECTOR, /* object vs eye space */ 121848b8605Smrg STATE_PT_SCALE, /**< Pixel transfer RGBA scale */ 122848b8605Smrg STATE_PT_BIAS, /**< Pixel transfer RGBA bias */ 123848b8605Smrg STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */ 124848b8605Smrg STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */ 125b8e80941Smrg STATE_TCS_PATCH_VERTICES_IN, /**< gl_PatchVerticesIn for TCS (integer) */ 126b8e80941Smrg STATE_TES_PATCH_VERTICES_IN, /**< gl_PatchVerticesIn for TES (integer) */ 127b8e80941Smrg /** 128b8e80941Smrg * A single enum gl_blend_support_qualifier value representing the 129b8e80941Smrg * currently active advanced blending equation, or zero if disabled. 130b8e80941Smrg */ 131b8e80941Smrg STATE_ADVANCED_BLENDING_MODE, 132848b8605Smrg STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */ 133848b8605Smrg} gl_state_index; 134848b8605Smrg 135848b8605Smrg 136848b8605Smrgextern void 137848b8605Smrg_mesa_load_state_parameters(struct gl_context *ctx, 138848b8605Smrg struct gl_program_parameter_list *paramList); 139848b8605Smrg 140848b8605Smrg 141848b8605Smrgextern GLbitfield 142b8e80941Smrg_mesa_program_state_flags(const gl_state_index16 state[STATE_LENGTH]); 143848b8605Smrg 144848b8605Smrg 145848b8605Smrgextern char * 146b8e80941Smrg_mesa_program_state_string(const gl_state_index16 state[STATE_LENGTH]); 147848b8605Smrg 148848b8605Smrg 149848b8605Smrg 150848b8605Smrg#ifdef __cplusplus 151848b8605Smrg} 152848b8605Smrg#endif 153848b8605Smrg 154848b8605Smrg#endif /* PROG_STATEVARS_H */ 155