1 /* 2 * Mesa 3-D graphics library 3 * 4 * Copyright (C) 2010 VMware, Inc. All Rights Reserved. 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 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. 23 */ 24 25 26 #ifndef UNIFORMS_H 27 #define UNIFORMS_H 28 29 #include "main/glheader.h" 30 #include "compiler/glsl_types.h" 31 #include "compiler/glsl/ir_uniform.h" 32 #include "program/prog_parameter.h" 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 39 struct gl_program; 40 struct _glapi_table; 41 42 void GLAPIENTRY 43 _mesa_Uniform1f(GLint, GLfloat); 44 void GLAPIENTRY 45 _mesa_Uniform2f(GLint, GLfloat, GLfloat); 46 void GLAPIENTRY 47 _mesa_Uniform3f(GLint, GLfloat, GLfloat, GLfloat); 48 void GLAPIENTRY 49 _mesa_Uniform4f(GLint, GLfloat, GLfloat, GLfloat, GLfloat); 50 void GLAPIENTRY 51 _mesa_Uniform1i(GLint, GLint); 52 void GLAPIENTRY 53 _mesa_Uniform2i(GLint, GLint, GLint); 54 void GLAPIENTRY 55 _mesa_Uniform3i(GLint, GLint, GLint, GLint); 56 void GLAPIENTRY 57 _mesa_Uniform4i(GLint, GLint, GLint, GLint, GLint); 58 void GLAPIENTRY 59 _mesa_Uniform1fv(GLint, GLsizei, const GLfloat *); 60 void GLAPIENTRY 61 _mesa_Uniform2fv(GLint, GLsizei, const GLfloat *); 62 void GLAPIENTRY 63 _mesa_Uniform3fv(GLint, GLsizei, const GLfloat *); 64 void GLAPIENTRY 65 _mesa_Uniform4fv(GLint, GLsizei, const GLfloat *); 66 void GLAPIENTRY 67 _mesa_Uniform1iv(GLint, GLsizei, const GLint *); 68 void GLAPIENTRY 69 _mesa_Uniform2iv(GLint, GLsizei, const GLint *); 70 void GLAPIENTRY 71 _mesa_Uniform3iv(GLint, GLsizei, const GLint *); 72 void GLAPIENTRY 73 _mesa_Uniform4iv(GLint, GLsizei, const GLint *); 74 void GLAPIENTRY 75 _mesa_Uniform1ui(GLint location, GLuint v0); 76 void GLAPIENTRY 77 _mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1); 78 void GLAPIENTRY 79 _mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2); 80 void GLAPIENTRY 81 _mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); 82 void GLAPIENTRY 83 _mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value); 84 void GLAPIENTRY 85 _mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value); 86 void GLAPIENTRY 87 _mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value); 88 void GLAPIENTRY 89 _mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value); 90 void GLAPIENTRY 91 _mesa_UniformMatrix2fv(GLint, GLsizei, GLboolean, const GLfloat *); 92 void GLAPIENTRY 93 _mesa_UniformMatrix3fv(GLint, GLsizei, GLboolean, const GLfloat *); 94 void GLAPIENTRY 95 _mesa_UniformMatrix4fv(GLint, GLsizei, GLboolean, const GLfloat *); 96 void GLAPIENTRY 97 _mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, 98 const GLfloat *value); 99 void GLAPIENTRY 100 _mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, 101 const GLfloat *value); 102 void GLAPIENTRY 103 _mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, 104 const GLfloat *value); 105 void GLAPIENTRY 106 _mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, 107 const GLfloat *value); 108 void GLAPIENTRY 109 _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, 110 const GLfloat *value); 111 void GLAPIENTRY 112 _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, 113 const GLfloat *value); 114 115 void GLAPIENTRY 116 _mesa_ProgramUniform1f(GLuint program, GLint, GLfloat); 117 void GLAPIENTRY 118 _mesa_ProgramUniform2f(GLuint program, GLint, GLfloat, GLfloat); 119 void GLAPIENTRY 120 _mesa_ProgramUniform3f(GLuint program, GLint, GLfloat, GLfloat, GLfloat); 121 void GLAPIENTRY 122 _mesa_ProgramUniform4f(GLuint program, GLint, GLfloat, GLfloat, GLfloat, GLfloat); 123 void GLAPIENTRY 124 _mesa_ProgramUniform1i(GLuint program, GLint, GLint); 125 void GLAPIENTRY 126 _mesa_ProgramUniform2i(GLuint program, GLint, GLint, GLint); 127 void GLAPIENTRY 128 _mesa_ProgramUniform3i(GLuint program, GLint, GLint, GLint, GLint); 129 void GLAPIENTRY 130 _mesa_ProgramUniform4i(GLuint program, GLint, GLint, GLint, GLint, GLint); 131 void GLAPIENTRY 132 _mesa_ProgramUniform1fv(GLuint program, GLint, GLsizei, const GLfloat *); 133 void GLAPIENTRY 134 _mesa_ProgramUniform2fv(GLuint program, GLint, GLsizei, const GLfloat *); 135 void GLAPIENTRY 136 _mesa_ProgramUniform3fv(GLuint program, GLint, GLsizei, const GLfloat *); 137 void GLAPIENTRY 138 _mesa_ProgramUniform4fv(GLuint program, GLint, GLsizei, const GLfloat *); 139 void GLAPIENTRY 140 _mesa_ProgramUniform1iv(GLuint program, GLint, GLsizei, const GLint *); 141 void GLAPIENTRY 142 _mesa_ProgramUniform2iv(GLuint program, GLint, GLsizei, const GLint *); 143 void GLAPIENTRY 144 _mesa_ProgramUniform3iv(GLuint program, GLint, GLsizei, const GLint *); 145 void GLAPIENTRY 146 _mesa_ProgramUniform4iv(GLuint program, GLint, GLsizei, const GLint *); 147 void GLAPIENTRY 148 _mesa_ProgramUniform1ui(GLuint program, GLint location, GLuint v0); 149 void GLAPIENTRY 150 _mesa_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1); 151 void GLAPIENTRY 152 _mesa_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, 153 GLuint v2); 154 void GLAPIENTRY 155 _mesa_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, 156 GLuint v2, GLuint v3); 157 void GLAPIENTRY 158 _mesa_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count, 159 const GLuint *value); 160 void GLAPIENTRY 161 _mesa_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count, 162 const GLuint *value); 163 void GLAPIENTRY 164 _mesa_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count, 165 const GLuint *value); 166 void GLAPIENTRY 167 _mesa_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count, 168 const GLuint *value); 169 void GLAPIENTRY 170 _mesa_ProgramUniformMatrix2fv(GLuint program, GLint, GLsizei, GLboolean, 171 const GLfloat *); 172 void GLAPIENTRY 173 _mesa_ProgramUniformMatrix3fv(GLuint program, GLint, GLsizei, GLboolean, 174 const GLfloat *); 175 void GLAPIENTRY 176 _mesa_ProgramUniformMatrix4fv(GLuint program, GLint, GLsizei, GLboolean, 177 const GLfloat *); 178 void GLAPIENTRY 179 _mesa_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, 180 GLboolean transpose, const GLfloat *value); 181 void GLAPIENTRY 182 _mesa_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, 183 GLboolean transpose, const GLfloat *value); 184 void GLAPIENTRY 185 _mesa_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, 186 GLboolean transpose, const GLfloat *value); 187 void GLAPIENTRY 188 _mesa_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, 189 GLboolean transpose, const GLfloat *value); 190 void GLAPIENTRY 191 _mesa_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, 192 GLboolean transpose, const GLfloat *value); 193 void GLAPIENTRY 194 _mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, 195 GLboolean transpose, const GLfloat *value); 196 197 void GLAPIENTRY 198 _mesa_GetnUniformfvARB(GLuint, GLint, GLsizei, GLfloat *); 199 void GLAPIENTRY 200 _mesa_GetUniformfv(GLuint, GLint, GLfloat *); 201 void GLAPIENTRY 202 _mesa_GetnUniformivARB(GLuint, GLint, GLsizei, GLint *); 203 void GLAPIENTRY 204 _mesa_GetUniformuiv(GLuint, GLint, GLuint *); 205 void GLAPIENTRY 206 _mesa_GetnUniformuivARB(GLuint, GLint, GLsizei, GLuint *); 207 void GLAPIENTRY 208 _mesa_GetUniformuiv(GLuint program, GLint location, GLuint *params); 209 void GLAPIENTRY 210 _mesa_GetnUniformdvARB(GLuint, GLint, GLsizei, GLdouble *); 211 void GLAPIENTRY 212 _mesa_GetUniformdv(GLuint, GLint, GLdouble *); 213 GLint GLAPIENTRY 214 _mesa_GetUniformLocation(GLuint, const GLcharARB *); 215 GLuint GLAPIENTRY 216 _mesa_GetUniformBlockIndex(GLuint program, 217 const GLchar *uniformBlockName); 218 void GLAPIENTRY 219 _mesa_GetUniformIndices(GLuint program, 220 GLsizei uniformCount, 221 const GLchar * const *uniformNames, 222 GLuint *uniformIndices); 223 void GLAPIENTRY 224 _mesa_UniformBlockBinding(GLuint program, 225 GLuint uniformBlockIndex, 226 GLuint uniformBlockBinding); 227 void GLAPIENTRY 228 _mesa_ShaderStorageBlockBinding(GLuint program, 229 GLuint shaderStorageBlockIndex, 230 GLuint shaderStorageBlockBinding); 231 void GLAPIENTRY 232 _mesa_GetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, 233 GLenum pname, GLint *params); 234 void GLAPIENTRY 235 _mesa_GetActiveUniformBlockiv(GLuint program, 236 GLuint uniformBlockIndex, 237 GLenum pname, 238 GLint *params); 239 void GLAPIENTRY 240 _mesa_GetActiveUniformBlockName(GLuint program, 241 GLuint uniformBlockIndex, 242 GLsizei bufSize, 243 GLsizei *length, 244 GLchar *uniformBlockName); 245 void GLAPIENTRY 246 _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex, 247 GLsizei bufSize, GLsizei *length, 248 GLchar *uniformName); 249 void GLAPIENTRY 250 _mesa_GetActiveUniform(GLuint, GLuint, GLsizei, GLsizei *, 251 GLint *, GLenum *, GLcharARB *); 252 void GLAPIENTRY 253 _mesa_GetActiveUniformsiv(GLuint program, 254 GLsizei uniformCount, 255 const GLuint *uniformIndices, 256 GLenum pname, 257 GLint *params); 258 void GLAPIENTRY 259 _mesa_GetUniformiv(GLuint, GLint, GLint *); 260 261 void GLAPIENTRY 262 _mesa_Uniform1d(GLint, GLdouble); 263 void GLAPIENTRY 264 _mesa_Uniform2d(GLint, GLdouble, GLdouble); 265 void GLAPIENTRY 266 _mesa_Uniform3d(GLint, GLdouble, GLdouble, GLdouble); 267 void GLAPIENTRY 268 _mesa_Uniform4d(GLint, GLdouble, GLdouble, GLdouble, GLdouble); 269 270 void GLAPIENTRY 271 _mesa_Uniform1dv(GLint, GLsizei, const GLdouble *); 272 void GLAPIENTRY 273 _mesa_Uniform2dv(GLint, GLsizei, const GLdouble *); 274 void GLAPIENTRY 275 _mesa_Uniform3dv(GLint, GLsizei, const GLdouble *); 276 void GLAPIENTRY 277 _mesa_Uniform4dv(GLint, GLsizei, const GLdouble *); 278 279 void GLAPIENTRY 280 _mesa_UniformMatrix2dv(GLint, GLsizei, GLboolean, const GLdouble *); 281 void GLAPIENTRY 282 _mesa_UniformMatrix3dv(GLint, GLsizei, GLboolean, const GLdouble *); 283 void GLAPIENTRY 284 _mesa_UniformMatrix4dv(GLint, GLsizei, GLboolean, const GLdouble *); 285 void GLAPIENTRY 286 _mesa_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, 287 const GLdouble *value); 288 void GLAPIENTRY 289 _mesa_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, 290 const GLdouble *value); 291 void GLAPIENTRY 292 _mesa_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, 293 const GLdouble *value); 294 void GLAPIENTRY 295 _mesa_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, 296 const GLdouble *value); 297 void GLAPIENTRY 298 _mesa_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, 299 const GLdouble *value); 300 void GLAPIENTRY 301 _mesa_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, 302 const GLdouble *value); 303 304 void GLAPIENTRY 305 _mesa_ProgramUniform1d(GLuint program, GLint, GLdouble); 306 void GLAPIENTRY 307 _mesa_ProgramUniform2d(GLuint program, GLint, GLdouble, GLdouble); 308 void GLAPIENTRY 309 _mesa_ProgramUniform3d(GLuint program, GLint, GLdouble, GLdouble, GLdouble); 310 void GLAPIENTRY 311 _mesa_ProgramUniform4d(GLuint program, GLint, GLdouble, GLdouble, GLdouble, GLdouble); 312 313 void GLAPIENTRY 314 _mesa_ProgramUniform1dv(GLuint program, GLint, GLsizei, const GLdouble *); 315 void GLAPIENTRY 316 _mesa_ProgramUniform2dv(GLuint program, GLint, GLsizei, const GLdouble *); 317 void GLAPIENTRY 318 _mesa_ProgramUniform3dv(GLuint program, GLint, GLsizei, const GLdouble *); 319 void GLAPIENTRY 320 _mesa_ProgramUniform4dv(GLuint program, GLint, GLsizei, const GLdouble *); 321 322 void GLAPIENTRY 323 _mesa_ProgramUniformMatrix2dv(GLuint program, GLint, GLsizei, GLboolean, 324 const GLdouble *); 325 void GLAPIENTRY 326 _mesa_ProgramUniformMatrix3dv(GLuint program, GLint, GLsizei, GLboolean, 327 const GLdouble *); 328 void GLAPIENTRY 329 _mesa_ProgramUniformMatrix4dv(GLuint program, GLint, GLsizei, GLboolean, 330 const GLdouble *); 331 void GLAPIENTRY 332 _mesa_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, 333 GLboolean transpose, const GLdouble *value); 334 void GLAPIENTRY 335 _mesa_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, 336 GLboolean transpose, const GLdouble *value); 337 void GLAPIENTRY 338 _mesa_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, 339 GLboolean transpose, const GLdouble *value); 340 void GLAPIENTRY 341 _mesa_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, 342 GLboolean transpose, const GLdouble *value); 343 void GLAPIENTRY 344 _mesa_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, 345 GLboolean transpose, const GLdouble *value); 346 void GLAPIENTRY 347 _mesa_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, 348 GLboolean transpose, const GLdouble *value); 349 350 void 351 _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program, 352 GLint location, GLsizei count, 353 const GLvoid *values, 354 enum glsl_base_type basicType, 355 unsigned src_components); 356 357 void 358 _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, 359 GLuint cols, GLuint rows, 360 GLint location, GLsizei count, 361 GLboolean transpose, 362 const GLvoid *values, enum glsl_base_type basicType); 363 364 void 365 _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location, 366 GLsizei bufSize, enum glsl_base_type returnType, 367 GLvoid *paramsOut); 368 369 extern void 370 _mesa_uniform_attach_driver_storage(struct gl_uniform_storage *, 371 unsigned element_stride, 372 unsigned vector_stride, 373 enum gl_uniform_driver_format format, 374 void *data); 375 376 extern void 377 _mesa_uniform_detach_all_driver_storage(struct gl_uniform_storage *uni); 378 379 extern void 380 _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni, 381 unsigned array_index, 382 unsigned count); 383 384 extern void 385 _mesa_update_shader_textures_used(struct gl_shader_program *shProg, 386 struct gl_program *prog); 387 388 extern bool 389 _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg, 390 char *errMsg, size_t errMsgLength); 391 extern bool 392 _mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *); 393 394 extern const struct gl_program_parameter * 395 get_uniform_parameter(struct gl_shader_program *shProg, GLint index); 396 397 struct gl_builtin_uniform_element { 398 const char *field; 399 int tokens[STATE_LENGTH]; 400 int swizzle; 401 }; 402 403 struct gl_builtin_uniform_desc { 404 const char *name; 405 const struct gl_builtin_uniform_element *elements; 406 unsigned int num_elements; 407 }; 408 409 #ifdef __cplusplus 410 } 411 #endif 412 413 414 #endif /* UNIFORMS_H */ 415