2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
27 * Vertex and fragment program support functions.
38 /* for GL_ARB_v_p and GL_ARB_f_p SWZ instruction */
39 #define SWIZZLE_ZERO 100
40 #define SWIZZLE_ONE 101
48 _mesa_init_program(GLcontext
*ctx
);
51 _mesa_set_program_error(GLcontext
*ctx
, GLint pos
, const char *string
);
53 extern const GLubyte
*
54 _mesa_find_line_column(const GLubyte
*string
, const GLubyte
*pos
,
55 GLint
*line
, GLint
*col
);
57 extern struct program
*
58 _mesa_alloc_program(GLcontext
*ctx
, GLenum target
, GLuint id
);
61 _mesa_delete_program(GLcontext
*ctx
, struct program
*prog
);
66 * Used for describing GL state referenced from inside ARB vertex and
68 * A string such as "state.light[0].ambient" gets translated into a
69 * sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ].
75 STATE_LIGHTMODEL_AMBIENT
,
76 STATE_LIGHTMODEL_SCENECOLOR
,
87 STATE_POINT_ATTENUATION
,
96 STATE_MATRIX_TRANSPOSE
,
97 STATE_MATRIX_INVTRANS
,
107 STATE_SPOT_DIRECTION
,
113 STATE_TEXGEN_OBJECT_S
,
114 STATE_TEXGEN_OBJECT_T
,
115 STATE_TEXGEN_OBJECT_R
,
116 STATE_TEXGEN_OBJECT_Q
122 * Named program parameters
123 * Used for NV_fragment_program "DEFINE"d constants and "DECLARE"d parameters,
124 * and ARB_fragment_program global state references. For the later, Name
125 * might be "state.light[0].diffuse", for example.
136 struct program_parameter
138 const char *Name
; /* Null-terminated */
139 enum parameter_type Type
;
140 enum state_index StateIndexes
[5]; /* Global state reference */
145 struct program_parameter_list
147 GLuint NumParameters
;
148 struct program_parameter
*Parameters
;
153 * Program parameter functions
156 extern struct program_parameter_list
*
157 _mesa_new_parameter_list(void);
160 _mesa_free_parameter_list(struct program_parameter_list
*paramList
);
163 _mesa_free_parameters(struct program_parameter_list
*paramList
);
166 _mesa_add_named_parameter(struct program_parameter_list
*paramList
,
167 const char *name
, const GLfloat values
[4]);
170 _mesa_add_named_constant(struct program_parameter_list
*paramList
,
171 const char *name
, const GLfloat values
[4]);
174 _mesa_add_unnamed_constant(struct program_parameter_list
*paramList
,
175 const GLfloat values
[4]);
178 _mesa_add_state_reference(struct program_parameter_list
*paramList
,
179 const char *stateString
);
182 _mesa_lookup_parameter_value(struct program_parameter_list
*paramList
,
183 GLsizei nameLen
, const char *name
);
186 _mesa_lookup_parameter_index(struct program_parameter_list
*paramList
,
187 GLsizei nameLen
, const char *name
);
190 _mesa_load_state_parameters(GLcontext
*ctx
,
191 struct program_parameter_list
*paramList
);
199 _mesa_BindProgram(GLenum target
, GLuint id
);
202 _mesa_DeletePrograms(GLsizei n
, const GLuint
*ids
);
205 _mesa_GenPrograms(GLsizei n
, GLuint
*ids
);
208 _mesa_IsProgram(GLuint id
);
211 #endif /* PROGRAM_H */