2 * Mesa 3-D graphics library
4 * Copyright (C) 2004-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009-2010 VMware, Inc. All Rights Reserved.
6 * Copyright © 2010 Intel Corporation
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
29 * Functions related to GLSL uniform variables.
35 * 1. Check that the right error code is generated for all _mesa_error() calls.
36 * 2. Insert FLUSH_VERTICES calls in various places
39 #include "main/glheader.h"
40 #include "main/context.h"
41 #include "main/dispatch.h"
42 #include "main/shaderapi.h"
43 #include "main/shaderobj.h"
44 #include "main/uniforms.h"
45 #include "main/enums.h"
46 #include "ir_uniform.h"
47 #include "glsl_types.h"
48 #include "program/program.h"
51 * Update the vertex/fragment program's TexturesUsed array.
53 * This needs to be called after glUniform(set sampler var) is called.
54 * A call to glUniform(samplerVar, value) causes a sampler to point to a
55 * particular texture unit. We know the sampler's texture target
56 * (1D/2D/3D/etc) from compile time but the sampler's texture unit is
57 * set by glUniform() calls.
59 * So, scan the program->SamplerUnits[] and program->SamplerTargets[]
60 * information to update the prog->TexturesUsed[] values.
61 * Each value of TexturesUsed[unit] is one of zero, TEXTURE_1D_INDEX,
62 * TEXTURE_2D_INDEX, TEXTURE_3D_INDEX, etc.
63 * We'll use that info for state validation before rendering.
66 _mesa_update_shader_textures_used(struct gl_shader_program
*shProg
,
67 struct gl_program
*prog
)
70 struct gl_shader
*shader
=
71 shProg
->_LinkedShaders
[_mesa_program_enum_to_shader_stage(prog
->Target
)];
75 memcpy(prog
->SamplerUnits
, shader
->SamplerUnits
, sizeof(prog
->SamplerUnits
));
76 memset(prog
->TexturesUsed
, 0, sizeof(prog
->TexturesUsed
));
78 shProg
->SamplersValidated
= GL_TRUE
;
80 for (s
= 0; s
< MAX_SAMPLERS
; s
++) {
81 if (prog
->SamplersUsed
& (1 << s
)) {
82 GLuint unit
= shader
->SamplerUnits
[s
];
83 GLuint tgt
= shader
->SamplerTargets
[s
];
84 assert(unit
< ARRAY_SIZE(prog
->TexturesUsed
));
85 assert(tgt
< NUM_TEXTURE_TARGETS
);
87 /* The types of the samplers associated with a particular texture
88 * unit must be an exact match. Page 74 (page 89 of the PDF) of the
89 * OpenGL 3.3 core spec says:
91 * "It is not allowed to have variables of different sampler
92 * types pointing to the same texture image unit within a program
95 if (prog
->TexturesUsed
[unit
] & ~(1 << tgt
))
96 shProg
->SamplersValidated
= GL_FALSE
;
98 prog
->TexturesUsed
[unit
] |= (1 << tgt
);
104 * Connect a piece of driver storage with a part of a uniform
106 * \param uni The uniform with which the storage will be associated
107 * \param element_stride Byte-stride between array elements.
108 * \sa gl_uniform_driver_storage::element_stride.
109 * \param vector_stride Byte-stride between vectors (in a matrix).
110 * \sa gl_uniform_driver_storage::vector_stride.
111 * \param format Conversion from native format to driver format
112 * required by the driver.
113 * \param data Location to dump the data.
116 _mesa_uniform_attach_driver_storage(struct gl_uniform_storage
*uni
,
117 unsigned element_stride
,
118 unsigned vector_stride
,
119 enum gl_uniform_driver_format format
,
122 uni
->driver_storage
=
123 realloc(uni
->driver_storage
,
124 sizeof(struct gl_uniform_driver_storage
)
125 * (uni
->num_driver_storage
+ 1));
127 uni
->driver_storage
[uni
->num_driver_storage
].element_stride
= element_stride
;
128 uni
->driver_storage
[uni
->num_driver_storage
].vector_stride
= vector_stride
;
129 uni
->driver_storage
[uni
->num_driver_storage
].format
= format
;
130 uni
->driver_storage
[uni
->num_driver_storage
].data
= data
;
132 uni
->num_driver_storage
++;
136 * Sever all connections with all pieces of driver storage for all uniforms
139 * This function does \b not release any of the \c data pointers
140 * previously passed in to \c _mesa_uniform_attach_driver_stoarge.
143 _mesa_uniform_detach_all_driver_storage(struct gl_uniform_storage
*uni
)
145 free(uni
->driver_storage
);
146 uni
->driver_storage
= NULL
;
147 uni
->num_driver_storage
= 0;
151 _mesa_Uniform1f(GLint location
, GLfloat v0
)
153 GET_CURRENT_CONTEXT(ctx
);
154 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, &v0
, GLSL_TYPE_FLOAT
, 1);
158 _mesa_Uniform2f(GLint location
, GLfloat v0
, GLfloat v1
)
160 GET_CURRENT_CONTEXT(ctx
);
164 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_FLOAT
, 2);
168 _mesa_Uniform3f(GLint location
, GLfloat v0
, GLfloat v1
, GLfloat v2
)
170 GET_CURRENT_CONTEXT(ctx
);
175 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_FLOAT
, 3);
179 _mesa_Uniform4f(GLint location
, GLfloat v0
, GLfloat v1
, GLfloat v2
,
182 GET_CURRENT_CONTEXT(ctx
);
188 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_FLOAT
, 4);
192 _mesa_Uniform1i(GLint location
, GLint v0
)
194 GET_CURRENT_CONTEXT(ctx
);
195 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, &v0
, GLSL_TYPE_INT
, 1);
199 _mesa_Uniform2i(GLint location
, GLint v0
, GLint v1
)
201 GET_CURRENT_CONTEXT(ctx
);
205 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_INT
, 2);
209 _mesa_Uniform3i(GLint location
, GLint v0
, GLint v1
, GLint v2
)
211 GET_CURRENT_CONTEXT(ctx
);
216 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_INT
, 3);
220 _mesa_Uniform4i(GLint location
, GLint v0
, GLint v1
, GLint v2
, GLint v3
)
222 GET_CURRENT_CONTEXT(ctx
);
228 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_INT
, 4);
232 _mesa_Uniform1fv(GLint location
, GLsizei count
, const GLfloat
* value
)
234 GET_CURRENT_CONTEXT(ctx
);
235 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_FLOAT
, 1);
239 _mesa_Uniform2fv(GLint location
, GLsizei count
, const GLfloat
* value
)
241 GET_CURRENT_CONTEXT(ctx
);
242 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_FLOAT
, 2);
246 _mesa_Uniform3fv(GLint location
, GLsizei count
, const GLfloat
* value
)
248 GET_CURRENT_CONTEXT(ctx
);
249 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_FLOAT
, 3);
253 _mesa_Uniform4fv(GLint location
, GLsizei count
, const GLfloat
* value
)
255 GET_CURRENT_CONTEXT(ctx
);
256 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_FLOAT
, 4);
260 _mesa_Uniform1iv(GLint location
, GLsizei count
, const GLint
* value
)
262 GET_CURRENT_CONTEXT(ctx
);
263 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_INT
, 1);
267 _mesa_Uniform2iv(GLint location
, GLsizei count
, const GLint
* value
)
269 GET_CURRENT_CONTEXT(ctx
);
270 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_INT
, 2);
274 _mesa_Uniform3iv(GLint location
, GLsizei count
, const GLint
* value
)
276 GET_CURRENT_CONTEXT(ctx
);
277 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_INT
, 3);
281 _mesa_Uniform4iv(GLint location
, GLsizei count
, const GLint
* value
)
283 GET_CURRENT_CONTEXT(ctx
);
284 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_INT
, 4);
287 /** Same as above with direct state access **/
289 _mesa_ProgramUniform1f(GLuint program
, GLint location
, GLfloat v0
)
291 GET_CURRENT_CONTEXT(ctx
);
292 struct gl_shader_program
*shProg
=
293 _mesa_lookup_shader_program_err(ctx
, program
,
294 "glProgramUniform1f");
295 _mesa_uniform(ctx
, shProg
, location
, 1, &v0
, GLSL_TYPE_FLOAT
, 1);
299 _mesa_ProgramUniform2f(GLuint program
, GLint location
, GLfloat v0
, GLfloat v1
)
301 GET_CURRENT_CONTEXT(ctx
);
303 struct gl_shader_program
*shProg
;
306 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform2f");
307 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_FLOAT
, 2);
311 _mesa_ProgramUniform3f(GLuint program
, GLint location
, GLfloat v0
, GLfloat v1
,
314 GET_CURRENT_CONTEXT(ctx
);
316 struct gl_shader_program
*shProg
;
320 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform3f");
321 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_FLOAT
, 3);
325 _mesa_ProgramUniform4f(GLuint program
, GLint location
, GLfloat v0
, GLfloat v1
,
326 GLfloat v2
, GLfloat v3
)
328 GET_CURRENT_CONTEXT(ctx
);
330 struct gl_shader_program
*shProg
;
335 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform4f");
336 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_FLOAT
, 4);
340 _mesa_ProgramUniform1i(GLuint program
, GLint location
, GLint v0
)
342 GET_CURRENT_CONTEXT(ctx
);
343 struct gl_shader_program
*shProg
=
344 _mesa_lookup_shader_program_err(ctx
, program
,
345 "glProgramUniform1i");
346 _mesa_uniform(ctx
, shProg
, location
, 1, &v0
, GLSL_TYPE_INT
, 1);
350 _mesa_ProgramUniform2i(GLuint program
, GLint location
, GLint v0
, GLint v1
)
352 GET_CURRENT_CONTEXT(ctx
);
354 struct gl_shader_program
*shProg
;
357 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform2i");
358 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_INT
, 2);
362 _mesa_ProgramUniform3i(GLuint program
, GLint location
, GLint v0
, GLint v1
,
365 GET_CURRENT_CONTEXT(ctx
);
367 struct gl_shader_program
*shProg
;
371 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform3i");
372 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_INT
, 3);
376 _mesa_ProgramUniform4i(GLuint program
, GLint location
, GLint v0
, GLint v1
,
379 GET_CURRENT_CONTEXT(ctx
);
381 struct gl_shader_program
*shProg
;
386 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform4i");
387 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_INT
, 4);
391 _mesa_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
392 const GLfloat
* value
)
394 GET_CURRENT_CONTEXT(ctx
);
395 struct gl_shader_program
*shProg
=
396 _mesa_lookup_shader_program_err(ctx
, program
,
397 "glProgramUniform1fv");
398 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_FLOAT
, 1);
402 _mesa_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
403 const GLfloat
* value
)
405 GET_CURRENT_CONTEXT(ctx
);
406 struct gl_shader_program
*shProg
=
407 _mesa_lookup_shader_program_err(ctx
, program
,
408 "glProgramUniform2fv");
409 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_FLOAT
, 2);
413 _mesa_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
414 const GLfloat
* value
)
416 GET_CURRENT_CONTEXT(ctx
);
417 struct gl_shader_program
*shProg
=
418 _mesa_lookup_shader_program_err(ctx
, program
,
419 "glProgramUniform3fv");
420 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_FLOAT
, 3);
424 _mesa_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
425 const GLfloat
* value
)
427 GET_CURRENT_CONTEXT(ctx
);
428 struct gl_shader_program
*shProg
=
429 _mesa_lookup_shader_program_err(ctx
, program
,
430 "glProgramUniform4fv");
431 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_FLOAT
, 4);
435 _mesa_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
438 GET_CURRENT_CONTEXT(ctx
);
439 struct gl_shader_program
*shProg
=
440 _mesa_lookup_shader_program_err(ctx
, program
,
441 "glProgramUniform1iv");
442 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_INT
, 1);
446 _mesa_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
449 GET_CURRENT_CONTEXT(ctx
);
450 struct gl_shader_program
*shProg
=
451 _mesa_lookup_shader_program_err(ctx
, program
,
452 "glProgramUniform2iv");
453 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_INT
, 2);
457 _mesa_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
460 GET_CURRENT_CONTEXT(ctx
);
461 struct gl_shader_program
*shProg
=
462 _mesa_lookup_shader_program_err(ctx
, program
,
463 "glProgramUniform3iv");
464 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_INT
, 3);
468 _mesa_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
471 GET_CURRENT_CONTEXT(ctx
);
472 struct gl_shader_program
*shProg
=
473 _mesa_lookup_shader_program_err(ctx
, program
,
474 "glProgramUniform4iv");
475 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_INT
, 4);
479 /** OpenGL 3.0 GLuint-valued functions **/
481 _mesa_Uniform1ui(GLint location
, GLuint v0
)
483 GET_CURRENT_CONTEXT(ctx
);
484 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, &v0
, GLSL_TYPE_UINT
, 1);
488 _mesa_Uniform2ui(GLint location
, GLuint v0
, GLuint v1
)
490 GET_CURRENT_CONTEXT(ctx
);
494 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_UINT
, 2);
498 _mesa_Uniform3ui(GLint location
, GLuint v0
, GLuint v1
, GLuint v2
)
500 GET_CURRENT_CONTEXT(ctx
);
505 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_UINT
, 3);
509 _mesa_Uniform4ui(GLint location
, GLuint v0
, GLuint v1
, GLuint v2
, GLuint v3
)
511 GET_CURRENT_CONTEXT(ctx
);
517 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_UINT
, 4);
521 _mesa_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*value
)
523 GET_CURRENT_CONTEXT(ctx
);
524 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_UINT
, 1);
528 _mesa_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*value
)
530 GET_CURRENT_CONTEXT(ctx
);
531 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_UINT
, 2);
535 _mesa_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*value
)
537 GET_CURRENT_CONTEXT(ctx
);
538 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_UINT
, 3);
542 _mesa_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*value
)
544 GET_CURRENT_CONTEXT(ctx
);
545 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_UINT
, 4);
551 _mesa_UniformMatrix2fv(GLint location
, GLsizei count
, GLboolean transpose
,
552 const GLfloat
* value
)
554 GET_CURRENT_CONTEXT(ctx
);
555 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
556 2, 2, location
, count
, transpose
, value
, GL_FLOAT
);
560 _mesa_UniformMatrix3fv(GLint location
, GLsizei count
, GLboolean transpose
,
561 const GLfloat
* value
)
563 GET_CURRENT_CONTEXT(ctx
);
564 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
565 3, 3, location
, count
, transpose
, value
, GL_FLOAT
);
569 _mesa_UniformMatrix4fv(GLint location
, GLsizei count
, GLboolean transpose
,
570 const GLfloat
* value
)
572 GET_CURRENT_CONTEXT(ctx
);
573 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
574 4, 4, location
, count
, transpose
, value
, GL_FLOAT
);
577 /** Same as above with direct state access **/
580 _mesa_ProgramUniform1ui(GLuint program
, GLint location
, GLuint v0
)
582 GET_CURRENT_CONTEXT(ctx
);
583 struct gl_shader_program
*shProg
=
584 _mesa_lookup_shader_program_err(ctx
, program
,
585 "glProgramUniform1ui");
586 _mesa_uniform(ctx
, shProg
, location
, 1, &v0
, GLSL_TYPE_UINT
, 1);
590 _mesa_ProgramUniform2ui(GLuint program
, GLint location
, GLuint v0
, GLuint v1
)
592 GET_CURRENT_CONTEXT(ctx
);
594 struct gl_shader_program
*shProg
;
597 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
598 "glProgramUniform2ui");
599 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_UINT
, 2);
603 _mesa_ProgramUniform3ui(GLuint program
, GLint location
, GLuint v0
, GLuint v1
,
606 GET_CURRENT_CONTEXT(ctx
);
608 struct gl_shader_program
*shProg
;
612 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
613 "glProgramUniform3ui");
614 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_UINT
, 3);
618 _mesa_ProgramUniform4ui(GLuint program
, GLint location
, GLuint v0
, GLuint v1
,
619 GLuint v2
, GLuint v3
)
621 GET_CURRENT_CONTEXT(ctx
);
623 struct gl_shader_program
*shProg
;
628 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform4ui");
629 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_UINT
, 4);
633 _mesa_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
636 GET_CURRENT_CONTEXT(ctx
);
637 struct gl_shader_program
*shProg
=
638 _mesa_lookup_shader_program_err(ctx
, program
,
639 "glProgramUniform1uiv");
640 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_UINT
, 1);
644 _mesa_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
647 GET_CURRENT_CONTEXT(ctx
);
648 struct gl_shader_program
*shProg
=
649 _mesa_lookup_shader_program_err(ctx
, program
,
650 "glProgramUniform2uiv");
651 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_UINT
, 2);
655 _mesa_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
658 GET_CURRENT_CONTEXT(ctx
);
659 struct gl_shader_program
*shProg
=
660 _mesa_lookup_shader_program_err(ctx
, program
,
661 "glProgramUniform3uiv");
662 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_UINT
, 3);
666 _mesa_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
669 GET_CURRENT_CONTEXT(ctx
);
670 struct gl_shader_program
*shProg
=
671 _mesa_lookup_shader_program_err(ctx
, program
,
672 "glProgramUniform4uiv");
673 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_UINT
, 4);
679 _mesa_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
680 GLboolean transpose
, const GLfloat
* value
)
682 GET_CURRENT_CONTEXT(ctx
);
683 struct gl_shader_program
*shProg
=
684 _mesa_lookup_shader_program_err(ctx
, program
,
685 "glProgramUniformMatrix2fv");
686 _mesa_uniform_matrix(ctx
, shProg
, 2, 2, location
, count
, transpose
, value
, GL_FLOAT
);
690 _mesa_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
691 GLboolean transpose
, const GLfloat
* value
)
693 GET_CURRENT_CONTEXT(ctx
);
694 struct gl_shader_program
*shProg
=
695 _mesa_lookup_shader_program_err(ctx
, program
,
696 "glProgramUniformMatrix3fv");
697 _mesa_uniform_matrix(ctx
, shProg
, 3, 3, location
, count
, transpose
, value
, GL_FLOAT
);
701 _mesa_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
702 GLboolean transpose
, const GLfloat
* value
)
704 GET_CURRENT_CONTEXT(ctx
);
705 struct gl_shader_program
*shProg
=
706 _mesa_lookup_shader_program_err(ctx
, program
,
707 "glProgramUniformMatrix4fv");
708 _mesa_uniform_matrix(ctx
, shProg
, 4, 4, location
, count
, transpose
, value
, GL_FLOAT
);
713 * Non-square UniformMatrix are OpenGL 2.1
716 _mesa_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
717 const GLfloat
*value
)
719 GET_CURRENT_CONTEXT(ctx
);
720 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
721 2, 3, location
, count
, transpose
, value
, GL_FLOAT
);
725 _mesa_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
726 const GLfloat
*value
)
728 GET_CURRENT_CONTEXT(ctx
);
729 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
730 3, 2, location
, count
, transpose
, value
, GL_FLOAT
);
734 _mesa_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
735 const GLfloat
*value
)
737 GET_CURRENT_CONTEXT(ctx
);
738 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
739 2, 4, location
, count
, transpose
, value
, GL_FLOAT
);
743 _mesa_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
744 const GLfloat
*value
)
746 GET_CURRENT_CONTEXT(ctx
);
747 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
748 4, 2, location
, count
, transpose
, value
, GL_FLOAT
);
752 _mesa_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
753 const GLfloat
*value
)
755 GET_CURRENT_CONTEXT(ctx
);
756 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
757 3, 4, location
, count
, transpose
, value
, GL_FLOAT
);
761 _mesa_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
762 const GLfloat
*value
)
764 GET_CURRENT_CONTEXT(ctx
);
765 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
766 4, 3, location
, count
, transpose
, value
, GL_FLOAT
);
769 /** Same as above with direct state access **/
772 _mesa_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
773 GLboolean transpose
, const GLfloat
* value
)
775 GET_CURRENT_CONTEXT(ctx
);
776 struct gl_shader_program
*shProg
=
777 _mesa_lookup_shader_program_err(ctx
, program
,
778 "glProgramUniformMatrix2x3fv");
779 _mesa_uniform_matrix(ctx
, shProg
, 2, 3, location
, count
, transpose
, value
, GL_FLOAT
);
783 _mesa_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
784 GLboolean transpose
, const GLfloat
* value
)
786 GET_CURRENT_CONTEXT(ctx
);
787 struct gl_shader_program
*shProg
=
788 _mesa_lookup_shader_program_err(ctx
, program
,
789 "glProgramUniformMatrix3x2fv");
790 _mesa_uniform_matrix(ctx
, shProg
, 3, 2, location
, count
, transpose
, value
, GL_FLOAT
);
794 _mesa_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
795 GLboolean transpose
, const GLfloat
* value
)
797 GET_CURRENT_CONTEXT(ctx
);
798 struct gl_shader_program
*shProg
=
799 _mesa_lookup_shader_program_err(ctx
, program
,
800 "glProgramUniformMatrix2x4fv");
801 _mesa_uniform_matrix(ctx
, shProg
, 2, 4, location
, count
, transpose
, value
, GL_FLOAT
);
805 _mesa_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
806 GLboolean transpose
, const GLfloat
* value
)
808 GET_CURRENT_CONTEXT(ctx
);
809 struct gl_shader_program
*shProg
=
810 _mesa_lookup_shader_program_err(ctx
, program
,
811 "glProgramUniformMatrix4x2fv");
812 _mesa_uniform_matrix(ctx
, shProg
, 4, 2, location
, count
, transpose
, value
, GL_FLOAT
);
816 _mesa_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
817 GLboolean transpose
, const GLfloat
* value
)
819 GET_CURRENT_CONTEXT(ctx
);
820 struct gl_shader_program
*shProg
=
821 _mesa_lookup_shader_program_err(ctx
, program
,
822 "glProgramUniformMatrix3x4fv");
823 _mesa_uniform_matrix(ctx
, shProg
, 3, 4, location
, count
, transpose
, value
, GL_FLOAT
);
827 _mesa_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
828 GLboolean transpose
, const GLfloat
* value
)
830 GET_CURRENT_CONTEXT(ctx
);
831 struct gl_shader_program
*shProg
=
832 _mesa_lookup_shader_program_err(ctx
, program
,
833 "glProgramUniformMatrix4x3fv");
834 _mesa_uniform_matrix(ctx
, shProg
, 4, 3, location
, count
, transpose
, value
, GL_FLOAT
);
839 _mesa_GetnUniformfvARB(GLuint program
, GLint location
,
840 GLsizei bufSize
, GLfloat
*params
)
842 GET_CURRENT_CONTEXT(ctx
);
843 _mesa_get_uniform(ctx
, program
, location
, bufSize
, GLSL_TYPE_FLOAT
, params
);
847 _mesa_GetUniformfv(GLuint program
, GLint location
, GLfloat
*params
)
849 _mesa_GetnUniformfvARB(program
, location
, INT_MAX
, params
);
854 _mesa_GetnUniformivARB(GLuint program
, GLint location
,
855 GLsizei bufSize
, GLint
*params
)
857 GET_CURRENT_CONTEXT(ctx
);
858 _mesa_get_uniform(ctx
, program
, location
, bufSize
, GLSL_TYPE_INT
, params
);
862 _mesa_GetUniformiv(GLuint program
, GLint location
, GLint
*params
)
864 _mesa_GetnUniformivARB(program
, location
, INT_MAX
, params
);
870 _mesa_GetnUniformuivARB(GLuint program
, GLint location
,
871 GLsizei bufSize
, GLuint
*params
)
873 GET_CURRENT_CONTEXT(ctx
);
874 _mesa_get_uniform(ctx
, program
, location
, bufSize
, GLSL_TYPE_UINT
, params
);
878 _mesa_GetUniformuiv(GLuint program
, GLint location
, GLuint
*params
)
880 _mesa_GetnUniformuivARB(program
, location
, INT_MAX
, params
);
886 _mesa_GetnUniformdvARB(GLuint program
, GLint location
,
887 GLsizei bufSize
, GLdouble
*params
)
889 GET_CURRENT_CONTEXT(ctx
);
897 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_DOUBLE, params);
899 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetUniformdvARB"
900 "(GL_ARB_gpu_shader_fp64 not implemented)");
904 _mesa_GetUniformdv(GLuint program
, GLint location
, GLdouble
*params
)
906 _mesa_GetnUniformdvARB(program
, location
, INT_MAX
, params
);
911 _mesa_GetUniformLocation(GLuint programObj
, const GLcharARB
*name
)
913 struct gl_shader_program
*shProg
;
914 GLuint index
, offset
;
916 GET_CURRENT_CONTEXT(ctx
);
918 shProg
= _mesa_lookup_shader_program_err(ctx
, programObj
,
919 "glGetUniformLocation");
923 /* Page 80 (page 94 of the PDF) of the OpenGL 2.1 spec says:
925 * "If program has not been successfully linked, the error
926 * INVALID_OPERATION is generated."
928 if (shProg
->LinkStatus
== GL_FALSE
) {
929 _mesa_error(ctx
, GL_INVALID_OPERATION
,
930 "glGetUniformLocation(program not linked)");
934 index
= _mesa_get_uniform_location(shProg
, name
, &offset
);
935 if (index
== GL_INVALID_INDEX
)
938 /* From the GL_ARB_uniform_buffer_object spec:
940 * "The value -1 will be returned if <name> does not correspond to an
941 * active uniform variable name in <program>, if <name> is associated
942 * with a named uniform block, or if <name> starts with the reserved
945 if (shProg
->UniformStorage
[index
].block_index
!= -1 ||
946 shProg
->UniformStorage
[index
].atomic_buffer_index
!= -1)
949 /* location in remap table + array element offset */
950 return shProg
->UniformStorage
[index
].remap_location
+ offset
;
954 _mesa_GetUniformBlockIndex(GLuint program
,
955 const GLchar
*uniformBlockName
)
957 GET_CURRENT_CONTEXT(ctx
);
959 struct gl_shader_program
*shProg
;
961 if (!ctx
->Extensions
.ARB_uniform_buffer_object
) {
962 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetUniformBlockIndex");
963 return GL_INVALID_INDEX
;
966 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
967 "glGetUniformBlockIndex");
969 return GL_INVALID_INDEX
;
971 for (i
= 0; i
< shProg
->NumUniformBlocks
; i
++) {
972 if (!strcmp(shProg
->UniformBlocks
[i
].Name
, uniformBlockName
))
976 return GL_INVALID_INDEX
;
980 _mesa_GetUniformIndices(GLuint program
,
981 GLsizei uniformCount
,
982 const GLchar
* const *uniformNames
,
983 GLuint
*uniformIndices
)
985 GET_CURRENT_CONTEXT(ctx
);
987 struct gl_shader_program
*shProg
;
989 if (!ctx
->Extensions
.ARB_uniform_buffer_object
) {
990 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetUniformIndices");
994 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
995 "glGetUniformIndices");
999 if (uniformCount
< 0) {
1000 _mesa_error(ctx
, GL_INVALID_VALUE
,
1001 "glGetUniformIndices(uniformCount < 0)");
1005 for (i
= 0; i
< uniformCount
; i
++) {
1007 uniformIndices
[i
] = _mesa_get_uniform_location(shProg
,
1008 uniformNames
[i
], &offset
);
1013 _mesa_UniformBlockBinding(GLuint program
,
1014 GLuint uniformBlockIndex
,
1015 GLuint uniformBlockBinding
)
1017 GET_CURRENT_CONTEXT(ctx
);
1018 struct gl_shader_program
*shProg
;
1020 if (!ctx
->Extensions
.ARB_uniform_buffer_object
) {
1021 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glUniformBlockBinding");
1025 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
1026 "glUniformBlockBinding");
1030 if (uniformBlockIndex
>= shProg
->NumUniformBlocks
) {
1031 _mesa_error(ctx
, GL_INVALID_VALUE
,
1032 "glUniformBlockBinding(block index %u >= %u)",
1033 uniformBlockIndex
, shProg
->NumUniformBlocks
);
1037 if (uniformBlockBinding
>= ctx
->Const
.MaxUniformBufferBindings
) {
1038 _mesa_error(ctx
, GL_INVALID_VALUE
,
1039 "glUniformBlockBinding(block binding %u >= %u)",
1040 uniformBlockBinding
, ctx
->Const
.MaxUniformBufferBindings
);
1044 if (shProg
->UniformBlocks
[uniformBlockIndex
].Binding
!=
1045 uniformBlockBinding
) {
1048 FLUSH_VERTICES(ctx
, 0);
1049 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewUniformBuffer
;
1051 shProg
->UniformBlocks
[uniformBlockIndex
].Binding
= uniformBlockBinding
;
1053 for (i
= 0; i
< MESA_SHADER_STAGES
; i
++) {
1054 int stage_index
= shProg
->UniformBlockStageIndex
[i
][uniformBlockIndex
];
1056 if (stage_index
!= -1) {
1057 struct gl_shader
*sh
= shProg
->_LinkedShaders
[i
];
1058 sh
->UniformBlocks
[stage_index
].Binding
= uniformBlockBinding
;
1065 _mesa_GetActiveUniformBlockiv(GLuint program
,
1066 GLuint uniformBlockIndex
,
1070 GET_CURRENT_CONTEXT(ctx
);
1071 struct gl_shader_program
*shProg
;
1072 struct gl_uniform_block
*block
;
1075 if (!ctx
->Extensions
.ARB_uniform_buffer_object
) {
1076 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetActiveUniformBlockiv");
1080 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
1081 "glGetActiveUniformBlockiv");
1085 if (uniformBlockIndex
>= shProg
->NumUniformBlocks
) {
1086 _mesa_error(ctx
, GL_INVALID_VALUE
,
1087 "glGetActiveUniformBlockiv(block index %u >= %u)",
1088 uniformBlockIndex
, shProg
->NumUniformBlocks
);
1092 block
= &shProg
->UniformBlocks
[uniformBlockIndex
];
1095 case GL_UNIFORM_BLOCK_BINDING
:
1096 params
[0] = block
->Binding
;
1099 case GL_UNIFORM_BLOCK_DATA_SIZE
:
1100 params
[0] = block
->UniformBufferSize
;
1103 case GL_UNIFORM_BLOCK_NAME_LENGTH
:
1104 params
[0] = strlen(block
->Name
) + 1;
1107 case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS
: {
1110 for (i
= 0; i
< block
->NumUniforms
; i
++) {
1113 _mesa_get_uniform_location(shProg
,
1114 block
->Uniforms
[i
].IndexName
,
1124 case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES
: {
1127 for (i
= 0; i
< block
->NumUniforms
; i
++) {
1130 _mesa_get_uniform_location(shProg
,
1131 block
->Uniforms
[i
].IndexName
,
1135 params
[count
++] = idx
;
1140 case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER
:
1141 params
[0] = shProg
->UniformBlockStageIndex
[MESA_SHADER_VERTEX
][uniformBlockIndex
] != -1;
1144 case GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER
:
1145 if (!_mesa_has_geometry_shaders(ctx
))
1147 params
[0] = shProg
->UniformBlockStageIndex
[MESA_SHADER_GEOMETRY
][uniformBlockIndex
] != -1;
1150 case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER
:
1151 params
[0] = shProg
->UniformBlockStageIndex
[MESA_SHADER_FRAGMENT
][uniformBlockIndex
] != -1;
1155 _mesa_error(ctx
, GL_INVALID_ENUM
,
1156 "glGetActiveUniformBlockiv(pname 0x%x (%s))",
1157 pname
, _mesa_lookup_enum_by_nr(pname
));
1163 _mesa_GetActiveUniformBlockName(GLuint program
,
1164 GLuint uniformBlockIndex
,
1167 GLchar
*uniformBlockName
)
1169 GET_CURRENT_CONTEXT(ctx
);
1170 struct gl_shader_program
*shProg
;
1171 struct gl_uniform_block
*block
;
1173 if (!ctx
->Extensions
.ARB_uniform_buffer_object
) {
1174 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetActiveUniformBlockiv");
1179 _mesa_error(ctx
, GL_INVALID_VALUE
,
1180 "glGetActiveUniformBlockName(bufSize %d < 0)",
1185 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
1186 "glGetActiveUniformBlockiv");
1190 if (uniformBlockIndex
>= shProg
->NumUniformBlocks
) {
1191 _mesa_error(ctx
, GL_INVALID_VALUE
,
1192 "glGetActiveUniformBlockiv(block index %u >= %u)",
1193 uniformBlockIndex
, shProg
->NumUniformBlocks
);
1197 block
= &shProg
->UniformBlocks
[uniformBlockIndex
];
1199 if (uniformBlockName
) {
1200 _mesa_copy_string(uniformBlockName
, bufSize
, length
, block
->Name
);
1205 _mesa_GetActiveUniformName(GLuint program
, GLuint uniformIndex
,
1206 GLsizei bufSize
, GLsizei
*length
,
1207 GLchar
*uniformName
)
1209 GET_CURRENT_CONTEXT(ctx
);
1210 struct gl_shader_program
*shProg
;
1212 if (!ctx
->Extensions
.ARB_uniform_buffer_object
) {
1213 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetActiveUniformName");
1218 _mesa_error(ctx
, GL_INVALID_VALUE
,
1219 "glGetActiveUniformName(bufSize %d < 0)",
1224 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glGetActiveUniformName");
1229 if (uniformIndex
>= shProg
->NumUserUniformStorage
) {
1230 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGetActiveUniform(index)");
1235 _mesa_get_uniform_name(& shProg
->UniformStorage
[uniformIndex
],
1236 bufSize
, length
, uniformName
);
1241 _mesa_get_uniform_name(const struct gl_uniform_storage
*uni
,
1242 GLsizei maxLength
, GLsizei
*length
,
1245 GLsizei localLength
;
1248 length
= &localLength
;
1250 _mesa_copy_string(nameOut
, maxLength
, length
, uni
->name
);
1252 /* Page 61 (page 73 of the PDF) in section 2.11 of the OpenGL ES 3.0
1255 * "If the active uniform is an array, the uniform name returned in
1256 * name will always be the name of the uniform array appended with
1259 * The same text also appears in the OpenGL 4.2 spec. It does not,
1260 * however, appear in any previous spec. Previous specifications are
1261 * ambiguous in this regard. However, either name can later be passed
1262 * to glGetUniformLocation (and related APIs), so there shouldn't be any
1263 * harm in always appending "[0]" to uniform array names.
1265 if (uni
->array_elements
!= 0) {
1268 /* The comparison is strange because *length does *NOT* include the
1269 * terminating NUL, but maxLength does.
1271 for (i
= 0; i
< 3 && (*length
+ i
+ 1) < maxLength
; i
++)
1272 nameOut
[*length
+ i
] = "[0]"[i
];
1274 nameOut
[*length
+ i
] = '\0';
1280 _mesa_GetActiveAtomicCounterBufferiv(GLuint program
, GLuint bufferIndex
,
1281 GLenum pname
, GLint
*params
)
1283 GET_CURRENT_CONTEXT(ctx
);
1284 struct gl_shader_program
*shProg
;
1285 struct gl_active_atomic_buffer
*ab
;
1288 if (!ctx
->Extensions
.ARB_shader_atomic_counters
) {
1289 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1290 "glGetActiveAtomicCounterBufferiv");
1294 shProg
= _mesa_lookup_shader_program_err(ctx
, program
,
1295 "glGetActiveAtomicCounterBufferiv");
1299 if (bufferIndex
>= shProg
->NumAtomicBuffers
) {
1300 _mesa_error(ctx
, GL_INVALID_VALUE
,
1301 "glGetActiveAtomicCounterBufferiv(bufferIndex)");
1305 ab
= &shProg
->AtomicBuffers
[bufferIndex
];
1308 case GL_ATOMIC_COUNTER_BUFFER_BINDING
:
1309 params
[0] = ab
->Binding
;
1311 case GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE
:
1312 params
[0] = ab
->MinimumSize
;
1314 case GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS
:
1315 params
[0] = ab
->NumUniforms
;
1317 case GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES
:
1318 for (i
= 0; i
< ab
->NumUniforms
; ++i
)
1319 params
[i
] = ab
->Uniforms
[i
];
1321 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER
:
1322 params
[0] = ab
->StageReferences
[MESA_SHADER_VERTEX
];
1324 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER
:
1325 params
[0] = ab
->StageReferences
[MESA_SHADER_GEOMETRY
];
1327 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER
:
1328 params
[0] = ab
->StageReferences
[MESA_SHADER_FRAGMENT
];
1330 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER
:
1331 params
[0] = GL_FALSE
;
1333 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER
:
1334 params
[0] = GL_FALSE
;
1337 _mesa_error(ctx
, GL_INVALID_ENUM
,
1338 "glGetActiveAtomicCounterBufferiv(pname 0x%x (%s))",
1339 pname
, _mesa_lookup_enum_by_nr(pname
));
1345 _mesa_Uniform1d(GLint location
, GLdouble v0
)
1347 GET_CURRENT_CONTEXT(ctx
);
1348 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, &v0
, GLSL_TYPE_DOUBLE
, 1);
1352 _mesa_Uniform2d(GLint location
, GLdouble v0
, GLdouble v1
)
1354 GET_CURRENT_CONTEXT(ctx
);
1358 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_DOUBLE
, 2);
1362 _mesa_Uniform3d(GLint location
, GLdouble v0
, GLdouble v1
, GLdouble v2
)
1364 GET_CURRENT_CONTEXT(ctx
);
1369 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_DOUBLE
, 3);
1373 _mesa_Uniform4d(GLint location
, GLdouble v0
, GLdouble v1
, GLdouble v2
,
1376 GET_CURRENT_CONTEXT(ctx
);
1382 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, 1, v
, GLSL_TYPE_DOUBLE
, 4);
1386 _mesa_Uniform1dv(GLint location
, GLsizei count
, const GLdouble
* value
)
1388 GET_CURRENT_CONTEXT(ctx
);
1389 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_DOUBLE
, 1);
1393 _mesa_Uniform2dv(GLint location
, GLsizei count
, const GLdouble
* value
)
1395 GET_CURRENT_CONTEXT(ctx
);
1396 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_DOUBLE
, 2);
1400 _mesa_Uniform3dv(GLint location
, GLsizei count
, const GLdouble
* value
)
1402 GET_CURRENT_CONTEXT(ctx
);
1403 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_DOUBLE
, 3);
1407 _mesa_Uniform4dv(GLint location
, GLsizei count
, const GLdouble
* value
)
1409 GET_CURRENT_CONTEXT(ctx
);
1410 _mesa_uniform(ctx
, ctx
->_Shader
->ActiveProgram
, location
, count
, value
, GLSL_TYPE_DOUBLE
, 4);
1414 _mesa_UniformMatrix2dv(GLint location
, GLsizei count
, GLboolean transpose
,
1415 const GLdouble
* value
)
1417 GET_CURRENT_CONTEXT(ctx
);
1418 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
1419 2, 2, location
, count
, transpose
, value
, GL_DOUBLE
);
1423 _mesa_UniformMatrix3dv(GLint location
, GLsizei count
, GLboolean transpose
,
1424 const GLdouble
* value
)
1426 GET_CURRENT_CONTEXT(ctx
);
1427 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
1428 3, 3, location
, count
, transpose
, value
, GL_DOUBLE
);
1432 _mesa_UniformMatrix4dv(GLint location
, GLsizei count
, GLboolean transpose
,
1433 const GLdouble
* value
)
1435 GET_CURRENT_CONTEXT(ctx
);
1436 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
1437 4, 4, location
, count
, transpose
, value
, GL_DOUBLE
);
1441 _mesa_UniformMatrix2x3dv(GLint location
, GLsizei count
, GLboolean transpose
,
1442 const GLdouble
*value
)
1444 GET_CURRENT_CONTEXT(ctx
);
1445 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
1446 2, 3, location
, count
, transpose
, value
, GL_DOUBLE
);
1450 _mesa_UniformMatrix3x2dv(GLint location
, GLsizei count
, GLboolean transpose
,
1451 const GLdouble
*value
)
1453 GET_CURRENT_CONTEXT(ctx
);
1454 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
1455 3, 2, location
, count
, transpose
, value
, GL_DOUBLE
);
1459 _mesa_UniformMatrix2x4dv(GLint location
, GLsizei count
, GLboolean transpose
,
1460 const GLdouble
*value
)
1462 GET_CURRENT_CONTEXT(ctx
);
1463 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
1464 2, 4, location
, count
, transpose
, value
, GL_DOUBLE
);
1468 _mesa_UniformMatrix4x2dv(GLint location
, GLsizei count
, GLboolean transpose
,
1469 const GLdouble
*value
)
1471 GET_CURRENT_CONTEXT(ctx
);
1472 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
1473 4, 2, location
, count
, transpose
, value
, GL_DOUBLE
);
1477 _mesa_UniformMatrix3x4dv(GLint location
, GLsizei count
, GLboolean transpose
,
1478 const GLdouble
*value
)
1480 GET_CURRENT_CONTEXT(ctx
);
1481 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
1482 3, 4, location
, count
, transpose
, value
, GL_DOUBLE
);
1486 _mesa_UniformMatrix4x3dv(GLint location
, GLsizei count
, GLboolean transpose
,
1487 const GLdouble
*value
)
1489 GET_CURRENT_CONTEXT(ctx
);
1490 _mesa_uniform_matrix(ctx
, ctx
->_Shader
->ActiveProgram
,
1491 4, 3, location
, count
, transpose
, value
, GL_DOUBLE
);
1495 _mesa_ProgramUniform1d(GLuint program
, GLint location
, GLdouble v0
)
1497 GET_CURRENT_CONTEXT(ctx
);
1498 struct gl_shader_program
*shProg
=
1499 _mesa_lookup_shader_program_err(ctx
, program
,
1500 "glProgramUniform1d");
1501 _mesa_uniform(ctx
, shProg
, location
, 1, &v0
, GLSL_TYPE_DOUBLE
, 1);
1505 _mesa_ProgramUniform2d(GLuint program
, GLint location
, GLdouble v0
, GLdouble v1
)
1507 GET_CURRENT_CONTEXT(ctx
);
1509 struct gl_shader_program
*shProg
;
1512 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform2d");
1513 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_DOUBLE
, 2);
1517 _mesa_ProgramUniform3d(GLuint program
, GLint location
, GLdouble v0
, GLdouble v1
,
1520 GET_CURRENT_CONTEXT(ctx
);
1522 struct gl_shader_program
*shProg
;
1526 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform3d");
1527 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_DOUBLE
, 3);
1531 _mesa_ProgramUniform4d(GLuint program
, GLint location
, GLdouble v0
, GLdouble v1
,
1532 GLdouble v2
, GLdouble v3
)
1534 GET_CURRENT_CONTEXT(ctx
);
1536 struct gl_shader_program
*shProg
;
1541 shProg
= _mesa_lookup_shader_program_err(ctx
, program
, "glProgramUniform4d");
1542 _mesa_uniform(ctx
, shProg
, location
, 1, v
, GLSL_TYPE_DOUBLE
, 4);
1546 _mesa_ProgramUniform1dv(GLuint program
, GLint location
, GLsizei count
,
1547 const GLdouble
* value
)
1549 GET_CURRENT_CONTEXT(ctx
);
1550 struct gl_shader_program
*shProg
=
1551 _mesa_lookup_shader_program_err(ctx
, program
,
1552 "glProgramUniform1dv");
1553 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_DOUBLE
, 1);
1557 _mesa_ProgramUniform2dv(GLuint program
, GLint location
, GLsizei count
,
1558 const GLdouble
* value
)
1560 GET_CURRENT_CONTEXT(ctx
);
1561 struct gl_shader_program
*shProg
=
1562 _mesa_lookup_shader_program_err(ctx
, program
,
1563 "glProgramUniform2dv");
1564 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_DOUBLE
, 2);
1568 _mesa_ProgramUniform3dv(GLuint program
, GLint location
, GLsizei count
,
1569 const GLdouble
* value
)
1571 GET_CURRENT_CONTEXT(ctx
);
1572 struct gl_shader_program
*shProg
=
1573 _mesa_lookup_shader_program_err(ctx
, program
,
1574 "glProgramUniform3dv");
1575 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_DOUBLE
, 3);
1579 _mesa_ProgramUniform4dv(GLuint program
, GLint location
, GLsizei count
,
1580 const GLdouble
* value
)
1582 GET_CURRENT_CONTEXT(ctx
);
1583 struct gl_shader_program
*shProg
=
1584 _mesa_lookup_shader_program_err(ctx
, program
,
1585 "glProgramUniform4dv");
1586 _mesa_uniform(ctx
, shProg
, location
, count
, value
, GLSL_TYPE_DOUBLE
, 4);
1590 _mesa_ProgramUniformMatrix2dv(GLuint program
, GLint location
, GLsizei count
,
1591 GLboolean transpose
, const GLdouble
* value
)
1593 GET_CURRENT_CONTEXT(ctx
);
1594 struct gl_shader_program
*shProg
=
1595 _mesa_lookup_shader_program_err(ctx
, program
,
1596 "glProgramUniformMatrix2dv");
1597 _mesa_uniform_matrix(ctx
, shProg
, 2, 2, location
, count
, transpose
, value
, GL_DOUBLE
);
1601 _mesa_ProgramUniformMatrix3dv(GLuint program
, GLint location
, GLsizei count
,
1602 GLboolean transpose
, const GLdouble
* value
)
1604 GET_CURRENT_CONTEXT(ctx
);
1605 struct gl_shader_program
*shProg
=
1606 _mesa_lookup_shader_program_err(ctx
, program
,
1607 "glProgramUniformMatrix3dv");
1608 _mesa_uniform_matrix(ctx
, shProg
, 3, 3, location
, count
, transpose
, value
, GL_DOUBLE
);
1612 _mesa_ProgramUniformMatrix4dv(GLuint program
, GLint location
, GLsizei count
,
1613 GLboolean transpose
, const GLdouble
* value
)
1615 GET_CURRENT_CONTEXT(ctx
);
1616 struct gl_shader_program
*shProg
=
1617 _mesa_lookup_shader_program_err(ctx
, program
,
1618 "glProgramUniformMatrix4dv");
1619 _mesa_uniform_matrix(ctx
, shProg
, 4, 4, location
, count
, transpose
, value
, GL_DOUBLE
);
1623 _mesa_ProgramUniformMatrix2x3dv(GLuint program
, GLint location
, GLsizei count
,
1624 GLboolean transpose
, const GLdouble
* value
)
1626 GET_CURRENT_CONTEXT(ctx
);
1627 struct gl_shader_program
*shProg
=
1628 _mesa_lookup_shader_program_err(ctx
, program
,
1629 "glProgramUniformMatrix2x3dv");
1630 _mesa_uniform_matrix(ctx
, shProg
, 2, 3, location
, count
, transpose
, value
, GL_DOUBLE
);
1634 _mesa_ProgramUniformMatrix3x2dv(GLuint program
, GLint location
, GLsizei count
,
1635 GLboolean transpose
, const GLdouble
* value
)
1637 GET_CURRENT_CONTEXT(ctx
);
1638 struct gl_shader_program
*shProg
=
1639 _mesa_lookup_shader_program_err(ctx
, program
,
1640 "glProgramUniformMatrix3x2dv");
1641 _mesa_uniform_matrix(ctx
, shProg
, 3, 2, location
, count
, transpose
, value
, GL_DOUBLE
);
1645 _mesa_ProgramUniformMatrix2x4dv(GLuint program
, GLint location
, GLsizei count
,
1646 GLboolean transpose
, const GLdouble
* value
)
1648 GET_CURRENT_CONTEXT(ctx
);
1649 struct gl_shader_program
*shProg
=
1650 _mesa_lookup_shader_program_err(ctx
, program
,
1651 "glProgramUniformMatrix2x4dv");
1652 _mesa_uniform_matrix(ctx
, shProg
, 2, 4, location
, count
, transpose
, value
, GL_DOUBLE
);
1656 _mesa_ProgramUniformMatrix4x2dv(GLuint program
, GLint location
, GLsizei count
,
1657 GLboolean transpose
, const GLdouble
* value
)
1659 GET_CURRENT_CONTEXT(ctx
);
1660 struct gl_shader_program
*shProg
=
1661 _mesa_lookup_shader_program_err(ctx
, program
,
1662 "glProgramUniformMatrix4x2dv");
1663 _mesa_uniform_matrix(ctx
, shProg
, 4, 2, location
, count
, transpose
, value
, GL_DOUBLE
);
1667 _mesa_ProgramUniformMatrix3x4dv(GLuint program
, GLint location
, GLsizei count
,
1668 GLboolean transpose
, const GLdouble
* value
)
1670 GET_CURRENT_CONTEXT(ctx
);
1671 struct gl_shader_program
*shProg
=
1672 _mesa_lookup_shader_program_err(ctx
, program
,
1673 "glProgramUniformMatrix3x4dv");
1674 _mesa_uniform_matrix(ctx
, shProg
, 3, 4, location
, count
, transpose
, value
, GL_DOUBLE
);
1678 _mesa_ProgramUniformMatrix4x3dv(GLuint program
, GLint location
, GLsizei count
,
1679 GLboolean transpose
, const GLdouble
* value
)
1681 GET_CURRENT_CONTEXT(ctx
);
1682 struct gl_shader_program
*shProg
=
1683 _mesa_lookup_shader_program_err(ctx
, program
,
1684 "glProgramUniformMatrix4x3dv");
1685 _mesa_uniform_matrix(ctx
, shProg
, 4, 3, location
, count
, transpose
, value
, GL_DOUBLE
);