a9e7cda17c27c63bad56400efac614a247ffbfd8
[mesa.git] / src / mesa / main / uniforms.c
1 /*
2 * Mesa 3-D graphics library
3 *
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
7 *
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:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
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.
25 */
26
27 /**
28 * \file uniforms.c
29 * Functions related to GLSL uniform variables.
30 * \author Brian Paul
31 */
32
33 /**
34 * XXX things to do:
35 * 1. Check that the right error code is generated for all _mesa_error() calls.
36 * 2. Insert FLUSH_VERTICES calls in various places
37 */
38
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 "compiler/glsl/ir_uniform.h"
47 #include "compiler/glsl_types.h"
48 #include "program/program.h"
49 #include "util/bitscan.h"
50
51 /**
52 * Update the vertex/fragment program's TexturesUsed array.
53 *
54 * This needs to be called after glUniform(set sampler var) is called.
55 * A call to glUniform(samplerVar, value) causes a sampler to point to a
56 * particular texture unit. We know the sampler's texture target
57 * (1D/2D/3D/etc) from compile time but the sampler's texture unit is
58 * set by glUniform() calls.
59 *
60 * So, scan the program->SamplerUnits[] and program->SamplerTargets[]
61 * information to update the prog->TexturesUsed[] values.
62 * Each value of TexturesUsed[unit] is one of zero, TEXTURE_1D_INDEX,
63 * TEXTURE_2D_INDEX, TEXTURE_3D_INDEX, etc.
64 * We'll use that info for state validation before rendering.
65 */
66 void
67 _mesa_update_shader_textures_used(struct gl_shader_program *shProg,
68 struct gl_program *prog)
69 {
70 GLbitfield mask = prog->SamplersUsed;
71 gl_shader_stage prog_stage =
72 _mesa_program_enum_to_shader_stage(prog->Target);
73 struct gl_linked_shader *shader = shProg->_LinkedShaders[prog_stage];
74
75 assert(shader);
76
77 memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
78
79 while (mask) {
80 const int s = u_bit_scan(&mask);
81 GLuint unit = prog->SamplerUnits[s];
82 GLuint tgt = prog->sh.SamplerTargets[s];
83 assert(unit < ARRAY_SIZE(prog->TexturesUsed));
84 assert(tgt < NUM_TEXTURE_TARGETS);
85
86 /* The types of the samplers associated with a particular texture
87 * unit must be an exact match. Page 74 (page 89 of the PDF) of the
88 * OpenGL 3.3 core spec says:
89 *
90 * "It is not allowed to have variables of different sampler
91 * types pointing to the same texture image unit within a program
92 * object."
93 */
94 unsigned stages_mask = shProg->data->linked_stages;
95 while (stages_mask) {
96 const int stage = u_bit_scan(&stages_mask);
97
98 /* Skip validation if we are yet to update textures used in this
99 * stage.
100 */
101 if (prog_stage < stage)
102 break;
103
104 struct gl_program *glprog = shProg->_LinkedShaders[stage]->Program;
105 if (glprog->TexturesUsed[unit] & ~(1 << tgt))
106 shProg->SamplersValidated = GL_FALSE;
107 }
108
109 prog->TexturesUsed[unit] |= (1 << tgt);
110 }
111 }
112
113 /**
114 * Connect a piece of driver storage with a part of a uniform
115 *
116 * \param uni The uniform with which the storage will be associated
117 * \param element_stride Byte-stride between array elements.
118 * \sa gl_uniform_driver_storage::element_stride.
119 * \param vector_stride Byte-stride between vectors (in a matrix).
120 * \sa gl_uniform_driver_storage::vector_stride.
121 * \param format Conversion from native format to driver format
122 * required by the driver.
123 * \param data Location to dump the data.
124 */
125 void
126 _mesa_uniform_attach_driver_storage(struct gl_uniform_storage *uni,
127 unsigned element_stride,
128 unsigned vector_stride,
129 enum gl_uniform_driver_format format,
130 void *data)
131 {
132 uni->driver_storage =
133 realloc(uni->driver_storage,
134 sizeof(struct gl_uniform_driver_storage)
135 * (uni->num_driver_storage + 1));
136
137 uni->driver_storage[uni->num_driver_storage].element_stride = element_stride;
138 uni->driver_storage[uni->num_driver_storage].vector_stride = vector_stride;
139 uni->driver_storage[uni->num_driver_storage].format = format;
140 uni->driver_storage[uni->num_driver_storage].data = data;
141
142 uni->num_driver_storage++;
143 }
144
145 /**
146 * Sever all connections with all pieces of driver storage for all uniforms
147 *
148 * \warning
149 * This function does \b not release any of the \c data pointers
150 * previously passed in to \c _mesa_uniform_attach_driver_stoarge.
151 */
152 void
153 _mesa_uniform_detach_all_driver_storage(struct gl_uniform_storage *uni)
154 {
155 free(uni->driver_storage);
156 uni->driver_storage = NULL;
157 uni->num_driver_storage = 0;
158 }
159
160 void GLAPIENTRY
161 _mesa_Uniform1f(GLint location, GLfloat v0)
162 {
163 GET_CURRENT_CONTEXT(ctx);
164 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 1);
165 }
166
167 void GLAPIENTRY
168 _mesa_Uniform2f(GLint location, GLfloat v0, GLfloat v1)
169 {
170 GET_CURRENT_CONTEXT(ctx);
171 GLfloat v[2];
172 v[0] = v0;
173 v[1] = v1;
174 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 2);
175 }
176
177 void GLAPIENTRY
178 _mesa_Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
179 {
180 GET_CURRENT_CONTEXT(ctx);
181 GLfloat v[3];
182 v[0] = v0;
183 v[1] = v1;
184 v[2] = v2;
185 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 3);
186 }
187
188 void GLAPIENTRY
189 _mesa_Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
190 GLfloat v3)
191 {
192 GET_CURRENT_CONTEXT(ctx);
193 GLfloat v[4];
194 v[0] = v0;
195 v[1] = v1;
196 v[2] = v2;
197 v[3] = v3;
198 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 4);
199 }
200
201 void GLAPIENTRY
202 _mesa_Uniform1i(GLint location, GLint v0)
203 {
204 GET_CURRENT_CONTEXT(ctx);
205 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 1);
206 }
207
208 void GLAPIENTRY
209 _mesa_Uniform2i(GLint location, GLint v0, GLint v1)
210 {
211 GET_CURRENT_CONTEXT(ctx);
212 GLint v[2];
213 v[0] = v0;
214 v[1] = v1;
215 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 2);
216 }
217
218 void GLAPIENTRY
219 _mesa_Uniform3i(GLint location, GLint v0, GLint v1, GLint v2)
220 {
221 GET_CURRENT_CONTEXT(ctx);
222 GLint v[3];
223 v[0] = v0;
224 v[1] = v1;
225 v[2] = v2;
226 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 3);
227 }
228
229 void GLAPIENTRY
230 _mesa_Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
231 {
232 GET_CURRENT_CONTEXT(ctx);
233 GLint v[4];
234 v[0] = v0;
235 v[1] = v1;
236 v[2] = v2;
237 v[3] = v3;
238 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 4);
239 }
240
241 void GLAPIENTRY
242 _mesa_Uniform1fv(GLint location, GLsizei count, const GLfloat * value)
243 {
244 GET_CURRENT_CONTEXT(ctx);
245 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 1);
246 }
247
248 void GLAPIENTRY
249 _mesa_Uniform2fv(GLint location, GLsizei count, const GLfloat * value)
250 {
251 GET_CURRENT_CONTEXT(ctx);
252 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 2);
253 }
254
255 void GLAPIENTRY
256 _mesa_Uniform3fv(GLint location, GLsizei count, const GLfloat * value)
257 {
258 GET_CURRENT_CONTEXT(ctx);
259 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 3);
260 }
261
262 void GLAPIENTRY
263 _mesa_Uniform4fv(GLint location, GLsizei count, const GLfloat * value)
264 {
265 GET_CURRENT_CONTEXT(ctx);
266 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 4);
267 }
268
269 void GLAPIENTRY
270 _mesa_Uniform1iv(GLint location, GLsizei count, const GLint * value)
271 {
272 GET_CURRENT_CONTEXT(ctx);
273 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 1);
274 }
275
276 void GLAPIENTRY
277 _mesa_Uniform2iv(GLint location, GLsizei count, const GLint * value)
278 {
279 GET_CURRENT_CONTEXT(ctx);
280 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 2);
281 }
282
283 void GLAPIENTRY
284 _mesa_Uniform3iv(GLint location, GLsizei count, const GLint * value)
285 {
286 GET_CURRENT_CONTEXT(ctx);
287 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 3);
288 }
289
290 void GLAPIENTRY
291 _mesa_Uniform4iv(GLint location, GLsizei count, const GLint * value)
292 {
293 GET_CURRENT_CONTEXT(ctx);
294 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 4);
295 }
296
297 void GLAPIENTRY
298 _mesa_UniformHandleui64ARB(GLint location, GLuint64 value)
299 {
300 }
301
302 void GLAPIENTRY
303 _mesa_UniformHandleui64vARB(GLint location, GLsizei count,
304 const GLuint64 *value)
305 {
306 }
307
308
309 /** Same as above with direct state access **/
310 void GLAPIENTRY
311 _mesa_ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
312 {
313 GET_CURRENT_CONTEXT(ctx);
314 struct gl_shader_program *shProg =
315 _mesa_lookup_shader_program_err(ctx, program,
316 "glProgramUniform1f");
317 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_FLOAT, 1);
318 }
319
320 void GLAPIENTRY
321 _mesa_ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
322 {
323 GET_CURRENT_CONTEXT(ctx);
324 GLfloat v[2];
325 struct gl_shader_program *shProg;
326 v[0] = v0;
327 v[1] = v1;
328 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2f");
329 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 2);
330 }
331
332 void GLAPIENTRY
333 _mesa_ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1,
334 GLfloat v2)
335 {
336 GET_CURRENT_CONTEXT(ctx);
337 GLfloat v[3];
338 struct gl_shader_program *shProg;
339 v[0] = v0;
340 v[1] = v1;
341 v[2] = v2;
342 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3f");
343 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 3);
344 }
345
346 void GLAPIENTRY
347 _mesa_ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1,
348 GLfloat v2, GLfloat v3)
349 {
350 GET_CURRENT_CONTEXT(ctx);
351 GLfloat v[4];
352 struct gl_shader_program *shProg;
353 v[0] = v0;
354 v[1] = v1;
355 v[2] = v2;
356 v[3] = v3;
357 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4f");
358 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 4);
359 }
360
361 void GLAPIENTRY
362 _mesa_ProgramUniform1i(GLuint program, GLint location, GLint v0)
363 {
364 GET_CURRENT_CONTEXT(ctx);
365 struct gl_shader_program *shProg =
366 _mesa_lookup_shader_program_err(ctx, program,
367 "glProgramUniform1i");
368 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_INT, 1);
369 }
370
371 void GLAPIENTRY
372 _mesa_ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
373 {
374 GET_CURRENT_CONTEXT(ctx);
375 GLint v[2];
376 struct gl_shader_program *shProg;
377 v[0] = v0;
378 v[1] = v1;
379 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2i");
380 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 2);
381 }
382
383 void GLAPIENTRY
384 _mesa_ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1,
385 GLint v2)
386 {
387 GET_CURRENT_CONTEXT(ctx);
388 GLint v[3];
389 struct gl_shader_program *shProg;
390 v[0] = v0;
391 v[1] = v1;
392 v[2] = v2;
393 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3i");
394 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 3);
395 }
396
397 void GLAPIENTRY
398 _mesa_ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1,
399 GLint v2, GLint v3)
400 {
401 GET_CURRENT_CONTEXT(ctx);
402 GLint v[4];
403 struct gl_shader_program *shProg;
404 v[0] = v0;
405 v[1] = v1;
406 v[2] = v2;
407 v[3] = v3;
408 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4i");
409 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 4);
410 }
411
412 void GLAPIENTRY
413 _mesa_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
414 const GLfloat * value)
415 {
416 GET_CURRENT_CONTEXT(ctx);
417 struct gl_shader_program *shProg =
418 _mesa_lookup_shader_program_err(ctx, program,
419 "glProgramUniform1fv");
420 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 1);
421 }
422
423 void GLAPIENTRY
424 _mesa_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
425 const GLfloat * value)
426 {
427 GET_CURRENT_CONTEXT(ctx);
428 struct gl_shader_program *shProg =
429 _mesa_lookup_shader_program_err(ctx, program,
430 "glProgramUniform2fv");
431 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 2);
432 }
433
434 void GLAPIENTRY
435 _mesa_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
436 const GLfloat * value)
437 {
438 GET_CURRENT_CONTEXT(ctx);
439 struct gl_shader_program *shProg =
440 _mesa_lookup_shader_program_err(ctx, program,
441 "glProgramUniform3fv");
442 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 3);
443 }
444
445 void GLAPIENTRY
446 _mesa_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
447 const GLfloat * value)
448 {
449 GET_CURRENT_CONTEXT(ctx);
450 struct gl_shader_program *shProg =
451 _mesa_lookup_shader_program_err(ctx, program,
452 "glProgramUniform4fv");
453 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 4);
454 }
455
456 void GLAPIENTRY
457 _mesa_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
458 const GLint * value)
459 {
460 GET_CURRENT_CONTEXT(ctx);
461 struct gl_shader_program *shProg =
462 _mesa_lookup_shader_program_err(ctx, program,
463 "glProgramUniform1iv");
464 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 1);
465 }
466
467 void GLAPIENTRY
468 _mesa_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
469 const GLint * value)
470 {
471 GET_CURRENT_CONTEXT(ctx);
472 struct gl_shader_program *shProg =
473 _mesa_lookup_shader_program_err(ctx, program,
474 "glProgramUniform2iv");
475 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 2);
476 }
477
478 void GLAPIENTRY
479 _mesa_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
480 const GLint * value)
481 {
482 GET_CURRENT_CONTEXT(ctx);
483 struct gl_shader_program *shProg =
484 _mesa_lookup_shader_program_err(ctx, program,
485 "glProgramUniform3iv");
486 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 3);
487 }
488
489 void GLAPIENTRY
490 _mesa_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
491 const GLint * value)
492 {
493 GET_CURRENT_CONTEXT(ctx);
494 struct gl_shader_program *shProg =
495 _mesa_lookup_shader_program_err(ctx, program,
496 "glProgramUniform4iv");
497 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 4);
498 }
499
500 void GLAPIENTRY
501 _mesa_ProgramUniformHandleui64ARB(GLuint program, GLint location,
502 GLuint64 value)
503 {
504 }
505
506 void GLAPIENTRY
507 _mesa_ProgramUniformHandleui64vARB(GLuint program, GLint location,
508 GLsizei count, const GLuint64 *values)
509 {
510 }
511
512
513 /** OpenGL 3.0 GLuint-valued functions **/
514 void GLAPIENTRY
515 _mesa_Uniform1ui(GLint location, GLuint v0)
516 {
517 GET_CURRENT_CONTEXT(ctx);
518 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 1);
519 }
520
521 void GLAPIENTRY
522 _mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1)
523 {
524 GET_CURRENT_CONTEXT(ctx);
525 GLuint v[2];
526 v[0] = v0;
527 v[1] = v1;
528 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 2);
529 }
530
531 void GLAPIENTRY
532 _mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
533 {
534 GET_CURRENT_CONTEXT(ctx);
535 GLuint v[3];
536 v[0] = v0;
537 v[1] = v1;
538 v[2] = v2;
539 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 3);
540 }
541
542 void GLAPIENTRY
543 _mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
544 {
545 GET_CURRENT_CONTEXT(ctx);
546 GLuint v[4];
547 v[0] = v0;
548 v[1] = v1;
549 v[2] = v2;
550 v[3] = v3;
551 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 4);
552 }
553
554 void GLAPIENTRY
555 _mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
556 {
557 GET_CURRENT_CONTEXT(ctx);
558 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 1);
559 }
560
561 void GLAPIENTRY
562 _mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
563 {
564 GET_CURRENT_CONTEXT(ctx);
565 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 2);
566 }
567
568 void GLAPIENTRY
569 _mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
570 {
571 GET_CURRENT_CONTEXT(ctx);
572 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 3);
573 }
574
575 void GLAPIENTRY
576 _mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
577 {
578 GET_CURRENT_CONTEXT(ctx);
579 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 4);
580 }
581
582
583
584 void GLAPIENTRY
585 _mesa_UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose,
586 const GLfloat * value)
587 {
588 GET_CURRENT_CONTEXT(ctx);
589 _mesa_uniform_matrix(location, count, transpose, value,
590 ctx, ctx->_Shader->ActiveProgram, 2, 2, GLSL_TYPE_FLOAT);
591 }
592
593 void GLAPIENTRY
594 _mesa_UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose,
595 const GLfloat * value)
596 {
597 GET_CURRENT_CONTEXT(ctx);
598 _mesa_uniform_matrix(location, count, transpose, value,
599 ctx, ctx->_Shader->ActiveProgram, 3, 3, GLSL_TYPE_FLOAT);
600 }
601
602 void GLAPIENTRY
603 _mesa_UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
604 const GLfloat * value)
605 {
606 GET_CURRENT_CONTEXT(ctx);
607 _mesa_uniform_matrix(location, count, transpose, value,
608 ctx, ctx->_Shader->ActiveProgram, 4, 4, GLSL_TYPE_FLOAT);
609 }
610
611 /** Same as above with direct state access **/
612
613 void GLAPIENTRY
614 _mesa_ProgramUniform1ui(GLuint program, GLint location, GLuint v0)
615 {
616 GET_CURRENT_CONTEXT(ctx);
617 struct gl_shader_program *shProg =
618 _mesa_lookup_shader_program_err(ctx, program,
619 "glProgramUniform1ui");
620 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_UINT, 1);
621 }
622
623 void GLAPIENTRY
624 _mesa_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
625 {
626 GET_CURRENT_CONTEXT(ctx);
627 GLuint v[2];
628 struct gl_shader_program *shProg;
629 v[0] = v0;
630 v[1] = v1;
631 shProg = _mesa_lookup_shader_program_err(ctx, program,
632 "glProgramUniform2ui");
633 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 2);
634 }
635
636 void GLAPIENTRY
637 _mesa_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1,
638 GLuint v2)
639 {
640 GET_CURRENT_CONTEXT(ctx);
641 GLuint v[3];
642 struct gl_shader_program *shProg;
643 v[0] = v0;
644 v[1] = v1;
645 v[2] = v2;
646 shProg = _mesa_lookup_shader_program_err(ctx, program,
647 "glProgramUniform3ui");
648 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 3);
649 }
650
651 void GLAPIENTRY
652 _mesa_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1,
653 GLuint v2, GLuint v3)
654 {
655 GET_CURRENT_CONTEXT(ctx);
656 GLuint v[4];
657 struct gl_shader_program *shProg;
658 v[0] = v0;
659 v[1] = v1;
660 v[2] = v2;
661 v[3] = v3;
662 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4ui");
663 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 4);
664 }
665
666 void GLAPIENTRY
667 _mesa_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
668 const GLuint *value)
669 {
670 GET_CURRENT_CONTEXT(ctx);
671 struct gl_shader_program *shProg =
672 _mesa_lookup_shader_program_err(ctx, program,
673 "glProgramUniform1uiv");
674 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 1);
675 }
676
677 void GLAPIENTRY
678 _mesa_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
679 const GLuint *value)
680 {
681 GET_CURRENT_CONTEXT(ctx);
682 struct gl_shader_program *shProg =
683 _mesa_lookup_shader_program_err(ctx, program,
684 "glProgramUniform2uiv");
685 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 2);
686 }
687
688 void GLAPIENTRY
689 _mesa_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
690 const GLuint *value)
691 {
692 GET_CURRENT_CONTEXT(ctx);
693 struct gl_shader_program *shProg =
694 _mesa_lookup_shader_program_err(ctx, program,
695 "glProgramUniform3uiv");
696 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 3);
697 }
698
699 void GLAPIENTRY
700 _mesa_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
701 const GLuint *value)
702 {
703 GET_CURRENT_CONTEXT(ctx);
704 struct gl_shader_program *shProg =
705 _mesa_lookup_shader_program_err(ctx, program,
706 "glProgramUniform4uiv");
707 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 4);
708 }
709
710
711
712 void GLAPIENTRY
713 _mesa_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
714 GLboolean transpose, const GLfloat * value)
715 {
716 GET_CURRENT_CONTEXT(ctx);
717 struct gl_shader_program *shProg =
718 _mesa_lookup_shader_program_err(ctx, program,
719 "glProgramUniformMatrix2fv");
720 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 2, 2, GLSL_TYPE_FLOAT);
721 }
722
723 void GLAPIENTRY
724 _mesa_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
725 GLboolean transpose, const GLfloat * value)
726 {
727 GET_CURRENT_CONTEXT(ctx);
728 struct gl_shader_program *shProg =
729 _mesa_lookup_shader_program_err(ctx, program,
730 "glProgramUniformMatrix3fv");
731 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 3, 3, GLSL_TYPE_FLOAT);
732 }
733
734 void GLAPIENTRY
735 _mesa_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
736 GLboolean transpose, const GLfloat * value)
737 {
738 GET_CURRENT_CONTEXT(ctx);
739 struct gl_shader_program *shProg =
740 _mesa_lookup_shader_program_err(ctx, program,
741 "glProgramUniformMatrix4fv");
742 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 4, 4, GLSL_TYPE_FLOAT);
743 }
744
745
746 /**
747 * Non-square UniformMatrix are OpenGL 2.1
748 */
749 void GLAPIENTRY
750 _mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
751 const GLfloat *value)
752 {
753 GET_CURRENT_CONTEXT(ctx);
754 _mesa_uniform_matrix(location, count, transpose, value,
755 ctx, ctx->_Shader->ActiveProgram, 2, 3, GLSL_TYPE_FLOAT);
756 }
757
758 void GLAPIENTRY
759 _mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
760 const GLfloat *value)
761 {
762 GET_CURRENT_CONTEXT(ctx);
763 _mesa_uniform_matrix(location, count, transpose, value,
764 ctx, ctx->_Shader->ActiveProgram, 3, 2, GLSL_TYPE_FLOAT);
765 }
766
767 void GLAPIENTRY
768 _mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
769 const GLfloat *value)
770 {
771 GET_CURRENT_CONTEXT(ctx);
772 _mesa_uniform_matrix(location, count, transpose, value,
773 ctx, ctx->_Shader->ActiveProgram, 2, 4, GLSL_TYPE_FLOAT);
774 }
775
776 void GLAPIENTRY
777 _mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
778 const GLfloat *value)
779 {
780 GET_CURRENT_CONTEXT(ctx);
781 _mesa_uniform_matrix(location, count, transpose, value,
782 ctx, ctx->_Shader->ActiveProgram, 4, 2, GLSL_TYPE_FLOAT);
783 }
784
785 void GLAPIENTRY
786 _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
787 const GLfloat *value)
788 {
789 GET_CURRENT_CONTEXT(ctx);
790 _mesa_uniform_matrix(location, count, transpose, value,
791 ctx, ctx->_Shader->ActiveProgram, 3, 4, GLSL_TYPE_FLOAT);
792 }
793
794 void GLAPIENTRY
795 _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
796 const GLfloat *value)
797 {
798 GET_CURRENT_CONTEXT(ctx);
799 _mesa_uniform_matrix(location, count, transpose, value,
800 ctx, ctx->_Shader->ActiveProgram, 4, 3, GLSL_TYPE_FLOAT);
801 }
802
803 /** Same as above with direct state access **/
804
805 void GLAPIENTRY
806 _mesa_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
807 GLboolean transpose, const GLfloat * value)
808 {
809 GET_CURRENT_CONTEXT(ctx);
810 struct gl_shader_program *shProg =
811 _mesa_lookup_shader_program_err(ctx, program,
812 "glProgramUniformMatrix2x3fv");
813 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 2, 3, GLSL_TYPE_FLOAT);
814 }
815
816 void GLAPIENTRY
817 _mesa_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
818 GLboolean transpose, const GLfloat * value)
819 {
820 GET_CURRENT_CONTEXT(ctx);
821 struct gl_shader_program *shProg =
822 _mesa_lookup_shader_program_err(ctx, program,
823 "glProgramUniformMatrix3x2fv");
824 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 3, 2, GLSL_TYPE_FLOAT);
825 }
826
827 void GLAPIENTRY
828 _mesa_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
829 GLboolean transpose, const GLfloat * value)
830 {
831 GET_CURRENT_CONTEXT(ctx);
832 struct gl_shader_program *shProg =
833 _mesa_lookup_shader_program_err(ctx, program,
834 "glProgramUniformMatrix2x4fv");
835 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 2, 4, GLSL_TYPE_FLOAT);
836 }
837
838 void GLAPIENTRY
839 _mesa_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
840 GLboolean transpose, const GLfloat * value)
841 {
842 GET_CURRENT_CONTEXT(ctx);
843 struct gl_shader_program *shProg =
844 _mesa_lookup_shader_program_err(ctx, program,
845 "glProgramUniformMatrix4x2fv");
846 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 4, 2, GLSL_TYPE_FLOAT);
847 }
848
849 void GLAPIENTRY
850 _mesa_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
851 GLboolean transpose, const GLfloat * value)
852 {
853 GET_CURRENT_CONTEXT(ctx);
854 struct gl_shader_program *shProg =
855 _mesa_lookup_shader_program_err(ctx, program,
856 "glProgramUniformMatrix3x4fv");
857 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 3, 4, GLSL_TYPE_FLOAT);
858 }
859
860 void GLAPIENTRY
861 _mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
862 GLboolean transpose, const GLfloat * value)
863 {
864 GET_CURRENT_CONTEXT(ctx);
865 struct gl_shader_program *shProg =
866 _mesa_lookup_shader_program_err(ctx, program,
867 "glProgramUniformMatrix4x3fv");
868 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 4, 3, GLSL_TYPE_FLOAT);
869 }
870
871
872 void GLAPIENTRY
873 _mesa_GetnUniformfvARB(GLuint program, GLint location,
874 GLsizei bufSize, GLfloat *params)
875 {
876 GET_CURRENT_CONTEXT(ctx);
877 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_FLOAT, params);
878 }
879
880 void GLAPIENTRY
881 _mesa_GetUniformfv(GLuint program, GLint location, GLfloat *params)
882 {
883 _mesa_GetnUniformfvARB(program, location, INT_MAX, params);
884 }
885
886
887 void GLAPIENTRY
888 _mesa_GetnUniformivARB(GLuint program, GLint location,
889 GLsizei bufSize, GLint *params)
890 {
891 GET_CURRENT_CONTEXT(ctx);
892 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_INT, params);
893 }
894
895 void GLAPIENTRY
896 _mesa_GetUniformiv(GLuint program, GLint location, GLint *params)
897 {
898 _mesa_GetnUniformivARB(program, location, INT_MAX, params);
899 }
900
901
902 /* GL3 */
903 void GLAPIENTRY
904 _mesa_GetnUniformuivARB(GLuint program, GLint location,
905 GLsizei bufSize, GLuint *params)
906 {
907 GET_CURRENT_CONTEXT(ctx);
908 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_UINT, params);
909 }
910
911 void GLAPIENTRY
912 _mesa_GetUniformuiv(GLuint program, GLint location, GLuint *params)
913 {
914 _mesa_GetnUniformuivARB(program, location, INT_MAX, params);
915 }
916
917
918 /* GL4 */
919 void GLAPIENTRY
920 _mesa_GetnUniformdvARB(GLuint program, GLint location,
921 GLsizei bufSize, GLdouble *params)
922 {
923 GET_CURRENT_CONTEXT(ctx);
924
925 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_DOUBLE, params);
926 }
927
928 void GLAPIENTRY
929 _mesa_GetUniformdv(GLuint program, GLint location, GLdouble *params)
930 {
931 _mesa_GetnUniformdvARB(program, location, INT_MAX, params);
932 }
933
934 void GLAPIENTRY
935 _mesa_GetnUniformi64vARB(GLuint program, GLint location,
936 GLsizei bufSize, GLint64 *params)
937 {
938 GET_CURRENT_CONTEXT(ctx);
939 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_INT64, params);
940 }
941 void GLAPIENTRY
942 _mesa_GetUniformi64vARB(GLuint program, GLint location, GLint64 *params)
943 {
944 _mesa_GetnUniformi64vARB(program, location, INT_MAX, params);
945 }
946
947 void GLAPIENTRY
948 _mesa_GetnUniformui64vARB(GLuint program, GLint location,
949 GLsizei bufSize, GLuint64 *params)
950 {
951 GET_CURRENT_CONTEXT(ctx);
952 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_UINT64, params);
953 }
954
955 void GLAPIENTRY
956 _mesa_GetUniformui64vARB(GLuint program, GLint location, GLuint64 *params)
957 {
958 _mesa_GetnUniformui64vARB(program, location, INT_MAX, params);
959 }
960
961
962 GLint GLAPIENTRY
963 _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
964 {
965 struct gl_shader_program *shProg;
966
967 GET_CURRENT_CONTEXT(ctx);
968
969 shProg = _mesa_lookup_shader_program_err(ctx, programObj,
970 "glGetUniformLocation");
971 if (!shProg)
972 return -1;
973
974 /* Page 80 (page 94 of the PDF) of the OpenGL 2.1 spec says:
975 *
976 * "If program has not been successfully linked, the error
977 * INVALID_OPERATION is generated."
978 */
979 if (shProg->data->LinkStatus == linking_failure) {
980 _mesa_error(ctx, GL_INVALID_OPERATION,
981 "glGetUniformLocation(program not linked)");
982 return -1;
983 }
984
985 return _mesa_program_resource_location(shProg, GL_UNIFORM, name);
986 }
987
988 GLuint GLAPIENTRY
989 _mesa_GetUniformBlockIndex(GLuint program,
990 const GLchar *uniformBlockName)
991 {
992 GET_CURRENT_CONTEXT(ctx);
993 struct gl_shader_program *shProg;
994
995 if (!ctx->Extensions.ARB_uniform_buffer_object) {
996 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformBlockIndex");
997 return GL_INVALID_INDEX;
998 }
999
1000 shProg = _mesa_lookup_shader_program_err(ctx, program,
1001 "glGetUniformBlockIndex");
1002 if (!shProg)
1003 return GL_INVALID_INDEX;
1004
1005 struct gl_program_resource *res =
1006 _mesa_program_resource_find_name(shProg, GL_UNIFORM_BLOCK,
1007 uniformBlockName, NULL);
1008 if (!res)
1009 return GL_INVALID_INDEX;
1010
1011 return _mesa_program_resource_index(shProg, res);
1012 }
1013
1014 void GLAPIENTRY
1015 _mesa_GetUniformIndices(GLuint program,
1016 GLsizei uniformCount,
1017 const GLchar * const *uniformNames,
1018 GLuint *uniformIndices)
1019 {
1020 GET_CURRENT_CONTEXT(ctx);
1021 GLsizei i;
1022 struct gl_shader_program *shProg;
1023
1024 if (!ctx->Extensions.ARB_uniform_buffer_object) {
1025 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformIndices");
1026 return;
1027 }
1028
1029 shProg = _mesa_lookup_shader_program_err(ctx, program,
1030 "glGetUniformIndices");
1031 if (!shProg)
1032 return;
1033
1034 if (uniformCount < 0) {
1035 _mesa_error(ctx, GL_INVALID_VALUE,
1036 "glGetUniformIndices(uniformCount < 0)");
1037 return;
1038 }
1039
1040 for (i = 0; i < uniformCount; i++) {
1041 struct gl_program_resource *res =
1042 _mesa_program_resource_find_name(shProg, GL_UNIFORM, uniformNames[i],
1043 NULL);
1044 uniformIndices[i] = _mesa_program_resource_index(shProg, res);
1045 }
1046 }
1047
1048 void GLAPIENTRY
1049 _mesa_UniformBlockBinding(GLuint program,
1050 GLuint uniformBlockIndex,
1051 GLuint uniformBlockBinding)
1052 {
1053 GET_CURRENT_CONTEXT(ctx);
1054 struct gl_shader_program *shProg;
1055
1056 if (!ctx->Extensions.ARB_uniform_buffer_object) {
1057 _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformBlockBinding");
1058 return;
1059 }
1060
1061 shProg = _mesa_lookup_shader_program_err(ctx, program,
1062 "glUniformBlockBinding");
1063 if (!shProg)
1064 return;
1065
1066 if (uniformBlockIndex >= shProg->data->NumUniformBlocks) {
1067 _mesa_error(ctx, GL_INVALID_VALUE,
1068 "glUniformBlockBinding(block index %u >= %u)",
1069 uniformBlockIndex, shProg->data->NumUniformBlocks);
1070 return;
1071 }
1072
1073 if (uniformBlockBinding >= ctx->Const.MaxUniformBufferBindings) {
1074 _mesa_error(ctx, GL_INVALID_VALUE,
1075 "glUniformBlockBinding(block binding %u >= %u)",
1076 uniformBlockBinding, ctx->Const.MaxUniformBufferBindings);
1077 return;
1078 }
1079
1080 if (shProg->data->UniformBlocks[uniformBlockIndex].Binding !=
1081 uniformBlockBinding) {
1082
1083 FLUSH_VERTICES(ctx, 0);
1084 ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
1085
1086 shProg->data->UniformBlocks[uniformBlockIndex].Binding =
1087 uniformBlockBinding;
1088 }
1089 }
1090
1091 void GLAPIENTRY
1092 _mesa_ShaderStorageBlockBinding(GLuint program,
1093 GLuint shaderStorageBlockIndex,
1094 GLuint shaderStorageBlockBinding)
1095 {
1096 GET_CURRENT_CONTEXT(ctx);
1097 struct gl_shader_program *shProg;
1098
1099 if (!ctx->Extensions.ARB_shader_storage_buffer_object) {
1100 _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderStorageBlockBinding");
1101 return;
1102 }
1103
1104 shProg = _mesa_lookup_shader_program_err(ctx, program,
1105 "glShaderStorageBlockBinding");
1106 if (!shProg)
1107 return;
1108
1109 if (shaderStorageBlockIndex >= shProg->data->NumShaderStorageBlocks) {
1110 _mesa_error(ctx, GL_INVALID_VALUE,
1111 "glShaderStorageBlockBinding(block index %u >= %u)",
1112 shaderStorageBlockIndex,
1113 shProg->data->NumShaderStorageBlocks);
1114 return;
1115 }
1116
1117 if (shaderStorageBlockBinding >= ctx->Const.MaxShaderStorageBufferBindings) {
1118 _mesa_error(ctx, GL_INVALID_VALUE,
1119 "glShaderStorageBlockBinding(block binding %u >= %u)",
1120 shaderStorageBlockBinding,
1121 ctx->Const.MaxShaderStorageBufferBindings);
1122 return;
1123 }
1124
1125 if (shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding !=
1126 shaderStorageBlockBinding) {
1127
1128 FLUSH_VERTICES(ctx, 0);
1129 ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer;
1130
1131 shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding =
1132 shaderStorageBlockBinding;
1133 }
1134 }
1135
1136 /**
1137 * Generic program resource property query.
1138 */
1139 static void
1140 mesa_bufferiv(struct gl_shader_program *shProg, GLenum type,
1141 GLuint index, GLenum pname, GLint *params, const char *caller)
1142 {
1143 GET_CURRENT_CONTEXT(ctx);
1144 struct gl_program_resource *res =
1145 _mesa_program_resource_find_index(shProg, type, index);
1146
1147 if (!res) {
1148 _mesa_error(ctx, GL_INVALID_VALUE, "%s(bufferindex %d)", caller, index);
1149 return;
1150 }
1151
1152 switch (pname) {
1153 case GL_UNIFORM_BLOCK_BINDING:
1154 case GL_ATOMIC_COUNTER_BUFFER_BINDING:
1155 _mesa_program_resource_prop(shProg, res, index, GL_BUFFER_BINDING,
1156 params, caller);
1157 return;
1158 case GL_UNIFORM_BLOCK_DATA_SIZE:
1159 case GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE:
1160 _mesa_program_resource_prop(shProg, res, index, GL_BUFFER_DATA_SIZE,
1161 params, caller);
1162 return;
1163 case GL_UNIFORM_BLOCK_NAME_LENGTH:
1164 _mesa_program_resource_prop(shProg, res, index, GL_NAME_LENGTH,
1165 params, caller);
1166 return;
1167 case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
1168 case GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS:
1169 _mesa_program_resource_prop(shProg, res, index, GL_NUM_ACTIVE_VARIABLES,
1170 params, caller);
1171 return;
1172 case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
1173 case GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES:
1174 _mesa_program_resource_prop(shProg, res, index, GL_ACTIVE_VARIABLES,
1175 params, caller);
1176 return;
1177 case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
1178 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER:
1179 _mesa_program_resource_prop(shProg, res, index,
1180 GL_REFERENCED_BY_VERTEX_SHADER, params,
1181 caller);
1182 return;
1183
1184 case GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER:
1185 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER:
1186 _mesa_program_resource_prop(shProg, res, index,
1187 GL_REFERENCED_BY_TESS_CONTROL_SHADER, params,
1188 caller);
1189 return;
1190
1191 case GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER:
1192 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER:
1193 _mesa_program_resource_prop(shProg, res, index,
1194 GL_REFERENCED_BY_TESS_EVALUATION_SHADER, params,
1195 caller);
1196 return;
1197
1198 case GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER:
1199 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER:
1200 _mesa_program_resource_prop(shProg, res, index,
1201 GL_REFERENCED_BY_GEOMETRY_SHADER, params,
1202 caller);
1203 return;
1204 case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
1205 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER:
1206 _mesa_program_resource_prop(shProg, res, index,
1207 GL_REFERENCED_BY_FRAGMENT_SHADER, params,
1208 caller);
1209 return;
1210 case GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER:
1211 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER:
1212 _mesa_program_resource_prop(shProg, res, index,
1213 GL_REFERENCED_BY_COMPUTE_SHADER, params,
1214 caller);
1215 return;
1216 default:
1217 _mesa_error(ctx, GL_INVALID_ENUM,
1218 "%s(pname 0x%x (%s))", caller, pname,
1219 _mesa_enum_to_string(pname));
1220 return;
1221 }
1222 }
1223
1224
1225 void GLAPIENTRY
1226 _mesa_GetActiveUniformBlockiv(GLuint program,
1227 GLuint uniformBlockIndex,
1228 GLenum pname,
1229 GLint *params)
1230 {
1231 GET_CURRENT_CONTEXT(ctx);
1232 struct gl_shader_program *shProg;
1233
1234 if (!ctx->Extensions.ARB_uniform_buffer_object) {
1235 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformBlockiv");
1236 return;
1237 }
1238
1239 shProg = _mesa_lookup_shader_program_err(ctx, program,
1240 "glGetActiveUniformBlockiv");
1241 if (!shProg)
1242 return;
1243
1244 mesa_bufferiv(shProg, GL_UNIFORM_BLOCK, uniformBlockIndex, pname, params,
1245 "glGetActiveUniformBlockiv");
1246 }
1247
1248 void GLAPIENTRY
1249 _mesa_GetActiveUniformBlockName(GLuint program,
1250 GLuint uniformBlockIndex,
1251 GLsizei bufSize,
1252 GLsizei *length,
1253 GLchar *uniformBlockName)
1254 {
1255 GET_CURRENT_CONTEXT(ctx);
1256 struct gl_shader_program *shProg;
1257
1258 if (!ctx->Extensions.ARB_uniform_buffer_object) {
1259 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformBlockiv");
1260 return;
1261 }
1262
1263 if (bufSize < 0) {
1264 _mesa_error(ctx, GL_INVALID_VALUE,
1265 "glGetActiveUniformBlockName(bufSize %d < 0)",
1266 bufSize);
1267 return;
1268 }
1269
1270 shProg = _mesa_lookup_shader_program_err(ctx, program,
1271 "glGetActiveUniformBlockiv");
1272 if (!shProg)
1273 return;
1274
1275 if (uniformBlockName)
1276 _mesa_get_program_resource_name(shProg, GL_UNIFORM_BLOCK,
1277 uniformBlockIndex, bufSize, length,
1278 uniformBlockName,
1279 "glGetActiveUniformBlockName");
1280 }
1281
1282 void GLAPIENTRY
1283 _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex,
1284 GLsizei bufSize, GLsizei *length,
1285 GLchar *uniformName)
1286 {
1287 GET_CURRENT_CONTEXT(ctx);
1288 struct gl_shader_program *shProg;
1289
1290 if (!ctx->Extensions.ARB_uniform_buffer_object) {
1291 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformName");
1292 return;
1293 }
1294
1295 if (bufSize < 0) {
1296 _mesa_error(ctx, GL_INVALID_VALUE,
1297 "glGetActiveUniformName(bufSize %d < 0)",
1298 bufSize);
1299 return;
1300 }
1301
1302 shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniformName");
1303
1304 if (!shProg)
1305 return;
1306
1307 _mesa_get_program_resource_name(shProg, GL_UNIFORM, uniformIndex, bufSize,
1308 length, uniformName, "glGetActiveUniformName");
1309 }
1310
1311 void GLAPIENTRY
1312 _mesa_GetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex,
1313 GLenum pname, GLint *params)
1314 {
1315 GET_CURRENT_CONTEXT(ctx);
1316 struct gl_shader_program *shProg;
1317
1318 if (!ctx->Extensions.ARB_shader_atomic_counters) {
1319 _mesa_error(ctx, GL_INVALID_OPERATION,
1320 "glGetActiveAtomicCounterBufferiv");
1321 return;
1322 }
1323
1324 shProg = _mesa_lookup_shader_program_err(ctx, program,
1325 "glGetActiveAtomicCounterBufferiv");
1326 if (!shProg)
1327 return;
1328
1329 mesa_bufferiv(shProg, GL_ATOMIC_COUNTER_BUFFER, bufferIndex, pname, params,
1330 "glGetActiveAtomicCounterBufferiv");
1331 }
1332
1333 void GLAPIENTRY
1334 _mesa_Uniform1d(GLint location, GLdouble v0)
1335 {
1336 GET_CURRENT_CONTEXT(ctx);
1337 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 1);
1338 }
1339
1340 void GLAPIENTRY
1341 _mesa_Uniform2d(GLint location, GLdouble v0, GLdouble v1)
1342 {
1343 GET_CURRENT_CONTEXT(ctx);
1344 GLdouble v[2];
1345 v[0] = v0;
1346 v[1] = v1;
1347 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 2);
1348 }
1349
1350 void GLAPIENTRY
1351 _mesa_Uniform3d(GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
1352 {
1353 GET_CURRENT_CONTEXT(ctx);
1354 GLdouble v[3];
1355 v[0] = v0;
1356 v[1] = v1;
1357 v[2] = v2;
1358 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 3);
1359 }
1360
1361 void GLAPIENTRY
1362 _mesa_Uniform4d(GLint location, GLdouble v0, GLdouble v1, GLdouble v2,
1363 GLdouble v3)
1364 {
1365 GET_CURRENT_CONTEXT(ctx);
1366 GLdouble v[4];
1367 v[0] = v0;
1368 v[1] = v1;
1369 v[2] = v2;
1370 v[3] = v3;
1371 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 4);
1372 }
1373
1374 void GLAPIENTRY
1375 _mesa_Uniform1dv(GLint location, GLsizei count, const GLdouble * value)
1376 {
1377 GET_CURRENT_CONTEXT(ctx);
1378 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 1);
1379 }
1380
1381 void GLAPIENTRY
1382 _mesa_Uniform2dv(GLint location, GLsizei count, const GLdouble * value)
1383 {
1384 GET_CURRENT_CONTEXT(ctx);
1385 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 2);
1386 }
1387
1388 void GLAPIENTRY
1389 _mesa_Uniform3dv(GLint location, GLsizei count, const GLdouble * value)
1390 {
1391 GET_CURRENT_CONTEXT(ctx);
1392 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 3);
1393 }
1394
1395 void GLAPIENTRY
1396 _mesa_Uniform4dv(GLint location, GLsizei count, const GLdouble * value)
1397 {
1398 GET_CURRENT_CONTEXT(ctx);
1399 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 4);
1400 }
1401
1402 void GLAPIENTRY
1403 _mesa_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
1404 const GLdouble * value)
1405 {
1406 GET_CURRENT_CONTEXT(ctx);
1407 _mesa_uniform_matrix(location, count, transpose, value,
1408 ctx, ctx->_Shader->ActiveProgram, 2, 2, GLSL_TYPE_DOUBLE);
1409 }
1410
1411 void GLAPIENTRY
1412 _mesa_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
1413 const GLdouble * value)
1414 {
1415 GET_CURRENT_CONTEXT(ctx);
1416 _mesa_uniform_matrix(location, count, transpose, value,
1417 ctx, ctx->_Shader->ActiveProgram, 3, 3, GLSL_TYPE_DOUBLE);
1418 }
1419
1420 void GLAPIENTRY
1421 _mesa_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
1422 const GLdouble * value)
1423 {
1424 GET_CURRENT_CONTEXT(ctx);
1425 _mesa_uniform_matrix(location, count, transpose, value,
1426 ctx, ctx->_Shader->ActiveProgram, 4, 4, GLSL_TYPE_DOUBLE);
1427 }
1428
1429 void GLAPIENTRY
1430 _mesa_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
1431 const GLdouble *value)
1432 {
1433 GET_CURRENT_CONTEXT(ctx);
1434 _mesa_uniform_matrix(location, count, transpose, value,
1435 ctx, ctx->_Shader->ActiveProgram, 2, 3, GLSL_TYPE_DOUBLE);
1436 }
1437
1438 void GLAPIENTRY
1439 _mesa_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
1440 const GLdouble *value)
1441 {
1442 GET_CURRENT_CONTEXT(ctx);
1443 _mesa_uniform_matrix(location, count, transpose, value,
1444 ctx, ctx->_Shader->ActiveProgram, 3, 2, GLSL_TYPE_DOUBLE);
1445 }
1446
1447 void GLAPIENTRY
1448 _mesa_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
1449 const GLdouble *value)
1450 {
1451 GET_CURRENT_CONTEXT(ctx);
1452 _mesa_uniform_matrix(location, count, transpose, value,
1453 ctx, ctx->_Shader->ActiveProgram, 2, 4, GLSL_TYPE_DOUBLE);
1454 }
1455
1456 void GLAPIENTRY
1457 _mesa_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
1458 const GLdouble *value)
1459 {
1460 GET_CURRENT_CONTEXT(ctx);
1461 _mesa_uniform_matrix(location, count, transpose, value,
1462 ctx, ctx->_Shader->ActiveProgram, 4, 2, GLSL_TYPE_DOUBLE);
1463 }
1464
1465 void GLAPIENTRY
1466 _mesa_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
1467 const GLdouble *value)
1468 {
1469 GET_CURRENT_CONTEXT(ctx);
1470 _mesa_uniform_matrix(location, count, transpose, value,
1471 ctx, ctx->_Shader->ActiveProgram, 3, 4, GLSL_TYPE_DOUBLE);
1472 }
1473
1474 void GLAPIENTRY
1475 _mesa_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
1476 const GLdouble *value)
1477 {
1478 GET_CURRENT_CONTEXT(ctx);
1479 _mesa_uniform_matrix(location, count, transpose, value,
1480 ctx, ctx->_Shader->ActiveProgram, 4, 3, GLSL_TYPE_DOUBLE);
1481 }
1482
1483 void GLAPIENTRY
1484 _mesa_ProgramUniform1d(GLuint program, GLint location, GLdouble v0)
1485 {
1486 GET_CURRENT_CONTEXT(ctx);
1487 struct gl_shader_program *shProg =
1488 _mesa_lookup_shader_program_err(ctx, program,
1489 "glProgramUniform1d");
1490 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_DOUBLE, 1);
1491 }
1492
1493 void GLAPIENTRY
1494 _mesa_ProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
1495 {
1496 GET_CURRENT_CONTEXT(ctx);
1497 GLdouble v[2];
1498 struct gl_shader_program *shProg;
1499 v[0] = v0;
1500 v[1] = v1;
1501 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2d");
1502 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 2);
1503 }
1504
1505 void GLAPIENTRY
1506 _mesa_ProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1,
1507 GLdouble v2)
1508 {
1509 GET_CURRENT_CONTEXT(ctx);
1510 GLdouble v[3];
1511 struct gl_shader_program *shProg;
1512 v[0] = v0;
1513 v[1] = v1;
1514 v[2] = v2;
1515 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3d");
1516 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 3);
1517 }
1518
1519 void GLAPIENTRY
1520 _mesa_ProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1,
1521 GLdouble v2, GLdouble v3)
1522 {
1523 GET_CURRENT_CONTEXT(ctx);
1524 GLdouble v[4];
1525 struct gl_shader_program *shProg;
1526 v[0] = v0;
1527 v[1] = v1;
1528 v[2] = v2;
1529 v[3] = v3;
1530 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4d");
1531 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 4);
1532 }
1533
1534 void GLAPIENTRY
1535 _mesa_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
1536 const GLdouble * value)
1537 {
1538 GET_CURRENT_CONTEXT(ctx);
1539 struct gl_shader_program *shProg =
1540 _mesa_lookup_shader_program_err(ctx, program,
1541 "glProgramUniform1dv");
1542 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 1);
1543 }
1544
1545 void GLAPIENTRY
1546 _mesa_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
1547 const GLdouble * value)
1548 {
1549 GET_CURRENT_CONTEXT(ctx);
1550 struct gl_shader_program *shProg =
1551 _mesa_lookup_shader_program_err(ctx, program,
1552 "glProgramUniform2dv");
1553 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 2);
1554 }
1555
1556 void GLAPIENTRY
1557 _mesa_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
1558 const GLdouble * value)
1559 {
1560 GET_CURRENT_CONTEXT(ctx);
1561 struct gl_shader_program *shProg =
1562 _mesa_lookup_shader_program_err(ctx, program,
1563 "glProgramUniform3dv");
1564 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 3);
1565 }
1566
1567 void GLAPIENTRY
1568 _mesa_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
1569 const GLdouble * value)
1570 {
1571 GET_CURRENT_CONTEXT(ctx);
1572 struct gl_shader_program *shProg =
1573 _mesa_lookup_shader_program_err(ctx, program,
1574 "glProgramUniform4dv");
1575 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 4);
1576 }
1577
1578 void GLAPIENTRY
1579 _mesa_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
1580 GLboolean transpose, const GLdouble * value)
1581 {
1582 GET_CURRENT_CONTEXT(ctx);
1583 struct gl_shader_program *shProg =
1584 _mesa_lookup_shader_program_err(ctx, program,
1585 "glProgramUniformMatrix2dv");
1586 _mesa_uniform_matrix(location, count, transpose, value,
1587 ctx, shProg, 2, 2, GLSL_TYPE_DOUBLE);
1588 }
1589
1590 void GLAPIENTRY
1591 _mesa_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
1592 GLboolean transpose, const GLdouble * value)
1593 {
1594 GET_CURRENT_CONTEXT(ctx);
1595 struct gl_shader_program *shProg =
1596 _mesa_lookup_shader_program_err(ctx, program,
1597 "glProgramUniformMatrix3dv");
1598 _mesa_uniform_matrix(location, count, transpose, value,
1599 ctx, shProg, 3, 3, GLSL_TYPE_DOUBLE);
1600 }
1601
1602 void GLAPIENTRY
1603 _mesa_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
1604 GLboolean transpose, const GLdouble * value)
1605 {
1606 GET_CURRENT_CONTEXT(ctx);
1607 struct gl_shader_program *shProg =
1608 _mesa_lookup_shader_program_err(ctx, program,
1609 "glProgramUniformMatrix4dv");
1610 _mesa_uniform_matrix(location, count, transpose, value,
1611 ctx, shProg, 4, 4, GLSL_TYPE_DOUBLE);
1612 }
1613
1614 void GLAPIENTRY
1615 _mesa_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
1616 GLboolean transpose, const GLdouble * value)
1617 {
1618 GET_CURRENT_CONTEXT(ctx);
1619 struct gl_shader_program *shProg =
1620 _mesa_lookup_shader_program_err(ctx, program,
1621 "glProgramUniformMatrix2x3dv");
1622 _mesa_uniform_matrix(location, count, transpose, value,
1623 ctx, shProg, 2, 3, GLSL_TYPE_DOUBLE);
1624 }
1625
1626 void GLAPIENTRY
1627 _mesa_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
1628 GLboolean transpose, const GLdouble * value)
1629 {
1630 GET_CURRENT_CONTEXT(ctx);
1631 struct gl_shader_program *shProg =
1632 _mesa_lookup_shader_program_err(ctx, program,
1633 "glProgramUniformMatrix3x2dv");
1634 _mesa_uniform_matrix(location, count, transpose, value,
1635 ctx, shProg, 3, 2, GLSL_TYPE_DOUBLE);
1636 }
1637
1638 void GLAPIENTRY
1639 _mesa_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
1640 GLboolean transpose, const GLdouble * value)
1641 {
1642 GET_CURRENT_CONTEXT(ctx);
1643 struct gl_shader_program *shProg =
1644 _mesa_lookup_shader_program_err(ctx, program,
1645 "glProgramUniformMatrix2x4dv");
1646 _mesa_uniform_matrix(location, count, transpose, value,
1647 ctx, shProg, 2, 4, GLSL_TYPE_DOUBLE);
1648 }
1649
1650 void GLAPIENTRY
1651 _mesa_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
1652 GLboolean transpose, const GLdouble * value)
1653 {
1654 GET_CURRENT_CONTEXT(ctx);
1655 struct gl_shader_program *shProg =
1656 _mesa_lookup_shader_program_err(ctx, program,
1657 "glProgramUniformMatrix4x2dv");
1658 _mesa_uniform_matrix(location, count, transpose, value,
1659 ctx, shProg, 4, 2, GLSL_TYPE_DOUBLE);
1660 }
1661
1662 void GLAPIENTRY
1663 _mesa_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
1664 GLboolean transpose, const GLdouble * value)
1665 {
1666 GET_CURRENT_CONTEXT(ctx);
1667 struct gl_shader_program *shProg =
1668 _mesa_lookup_shader_program_err(ctx, program,
1669 "glProgramUniformMatrix3x4dv");
1670 _mesa_uniform_matrix(location, count, transpose, value,
1671 ctx, shProg, 3, 4, GLSL_TYPE_DOUBLE);
1672 }
1673
1674 void GLAPIENTRY
1675 _mesa_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
1676 GLboolean transpose, const GLdouble * value)
1677 {
1678 GET_CURRENT_CONTEXT(ctx);
1679 struct gl_shader_program *shProg =
1680 _mesa_lookup_shader_program_err(ctx, program,
1681 "glProgramUniformMatrix4x3dv");
1682 _mesa_uniform_matrix(location, count, transpose, value,
1683 ctx, shProg, 4, 3, GLSL_TYPE_DOUBLE);
1684 }
1685
1686 void GLAPIENTRY
1687 _mesa_Uniform1i64ARB(GLint location, GLint64 v0)
1688 {
1689 GET_CURRENT_CONTEXT(ctx);
1690 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 1);
1691 }
1692
1693 void GLAPIENTRY
1694 _mesa_Uniform2i64ARB(GLint location, GLint64 v0, GLint64 v1)
1695 {
1696 GET_CURRENT_CONTEXT(ctx);
1697 int64_t v[2];
1698 v[0] = v0;
1699 v[1] = v1;
1700 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 2);
1701 }
1702
1703 void GLAPIENTRY
1704 _mesa_Uniform3i64ARB(GLint location, GLint64 v0, GLint64 v1, GLint64 v2)
1705 {
1706 GET_CURRENT_CONTEXT(ctx);
1707 int64_t v[3];
1708 v[0] = v0;
1709 v[1] = v1;
1710 v[2] = v2;
1711 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 3);
1712 }
1713
1714 void GLAPIENTRY
1715 _mesa_Uniform4i64ARB(GLint location, GLint64 v0, GLint64 v1, GLint64 v2, GLint64 v3)
1716 {
1717 GET_CURRENT_CONTEXT(ctx);
1718 int64_t v[4];
1719 v[0] = v0;
1720 v[1] = v1;
1721 v[2] = v2;
1722 v[3] = v3;
1723 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 4);
1724 }
1725
1726 void GLAPIENTRY
1727 _mesa_Uniform1i64vARB(GLint location, GLsizei count, const GLint64 *value)
1728 {
1729 GET_CURRENT_CONTEXT(ctx);
1730 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 1);
1731 }
1732
1733 void GLAPIENTRY
1734 _mesa_Uniform2i64vARB(GLint location, GLsizei count, const GLint64 *value)
1735 {
1736 GET_CURRENT_CONTEXT(ctx);
1737 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 2);
1738 }
1739
1740 void GLAPIENTRY
1741 _mesa_Uniform3i64vARB(GLint location, GLsizei count, const GLint64 *value)
1742 {
1743 GET_CURRENT_CONTEXT(ctx);
1744 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 3);
1745 }
1746
1747 void GLAPIENTRY
1748 _mesa_Uniform4i64vARB(GLint location, GLsizei count, const GLint64 *value)
1749 {
1750 GET_CURRENT_CONTEXT(ctx);
1751 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 4);
1752 }
1753
1754 void GLAPIENTRY
1755 _mesa_Uniform1ui64ARB(GLint location, GLuint64 v0)
1756 {
1757 GET_CURRENT_CONTEXT(ctx);
1758 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 1);
1759 }
1760
1761 void GLAPIENTRY
1762 _mesa_Uniform2ui64ARB(GLint location, GLuint64 v0, GLuint64 v1)
1763 {
1764 GET_CURRENT_CONTEXT(ctx);
1765 uint64_t v[2];
1766 v[0] = v0;
1767 v[1] = v1;
1768 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 2);
1769 }
1770
1771 void GLAPIENTRY
1772 _mesa_Uniform3ui64ARB(GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2)
1773 {
1774 GET_CURRENT_CONTEXT(ctx);
1775 uint64_t v[3];
1776 v[0] = v0;
1777 v[1] = v1;
1778 v[2] = v2;
1779 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 3);
1780 }
1781
1782 void GLAPIENTRY
1783 _mesa_Uniform4ui64ARB(GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2, GLuint64 v3)
1784 {
1785 GET_CURRENT_CONTEXT(ctx);
1786 uint64_t v[4];
1787 v[0] = v0;
1788 v[1] = v1;
1789 v[2] = v2;
1790 v[3] = v3;
1791 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 4);
1792 }
1793
1794 void GLAPIENTRY
1795 _mesa_Uniform1ui64vARB(GLint location, GLsizei count, const GLuint64 *value)
1796 {
1797 GET_CURRENT_CONTEXT(ctx);
1798 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 1);
1799 }
1800
1801 void GLAPIENTRY
1802 _mesa_Uniform2ui64vARB(GLint location, GLsizei count, const GLuint64 *value)
1803 {
1804 GET_CURRENT_CONTEXT(ctx);
1805 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 2);
1806 }
1807
1808 void GLAPIENTRY
1809 _mesa_Uniform3ui64vARB(GLint location, GLsizei count, const GLuint64 *value)
1810 {
1811 GET_CURRENT_CONTEXT(ctx);
1812 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 3);
1813 }
1814
1815 void GLAPIENTRY
1816 _mesa_Uniform4ui64vARB(GLint location, GLsizei count, const GLuint64 *value)
1817 {
1818 GET_CURRENT_CONTEXT(ctx);
1819 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 4);
1820 }
1821
1822 /* DSA entrypoints */
1823 void GLAPIENTRY
1824 _mesa_ProgramUniform1i64ARB(GLuint program, GLint location, GLint64 v0)
1825 {
1826 GET_CURRENT_CONTEXT(ctx);
1827 struct gl_shader_program *shProg =
1828 _mesa_lookup_shader_program_err(ctx, program,
1829 "glProgramUniform1i64ARB");
1830 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_INT64, 1);
1831 }
1832
1833 void GLAPIENTRY
1834 _mesa_ProgramUniform2i64ARB(GLuint program, GLint location, GLint64 v0, GLint64 v1)
1835 {
1836 GET_CURRENT_CONTEXT(ctx);
1837 struct gl_shader_program *shProg =
1838 _mesa_lookup_shader_program_err(ctx, program,
1839 "glProgramUniform2i64ARB");
1840 int64_t v[2];
1841 v[0] = v0;
1842 v[1] = v1;
1843 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 2);
1844 }
1845
1846 void GLAPIENTRY
1847 _mesa_ProgramUniform3i64ARB(GLuint program, GLint location, GLint64 v0, GLint64 v1, GLint64 v2)
1848 {
1849 GET_CURRENT_CONTEXT(ctx);
1850 struct gl_shader_program *shProg =
1851 _mesa_lookup_shader_program_err(ctx, program,
1852 "glProgramUniform3i64ARB");
1853 int64_t v[3];
1854 v[0] = v0;
1855 v[1] = v1;
1856 v[2] = v2;
1857 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 3);
1858 }
1859
1860 void GLAPIENTRY
1861 _mesa_ProgramUniform4i64ARB(GLuint program, GLint location, GLint64 v0, GLint64 v1, GLint64 v2, GLint64 v3)
1862 {
1863 GET_CURRENT_CONTEXT(ctx);
1864 struct gl_shader_program *shProg =
1865 _mesa_lookup_shader_program_err(ctx, program,
1866 "glProgramUniform4i64ARB");
1867 int64_t v[4];
1868 v[0] = v0;
1869 v[1] = v1;
1870 v[2] = v2;
1871 v[3] = v3;
1872 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 4);
1873 }
1874
1875 void GLAPIENTRY
1876 _mesa_ProgramUniform1i64vARB(GLuint program, GLint location, GLsizei count, const GLint64 *value)
1877 {
1878 GET_CURRENT_CONTEXT(ctx);
1879 struct gl_shader_program *shProg =
1880 _mesa_lookup_shader_program_err(ctx, program,
1881 "glProgramUniform1i64vARB");
1882 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 1);
1883 }
1884
1885 void GLAPIENTRY
1886 _mesa_ProgramUniform2i64vARB(GLuint program, GLint location, GLsizei count, const GLint64 *value)
1887 {
1888 GET_CURRENT_CONTEXT(ctx);
1889 struct gl_shader_program *shProg =
1890 _mesa_lookup_shader_program_err(ctx, program,
1891 "glProgramUniform2i64vARB");
1892 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 2);
1893 }
1894
1895 void GLAPIENTRY
1896 _mesa_ProgramUniform3i64vARB(GLuint program, GLint location, GLsizei count, const GLint64 *value)
1897 {
1898 GET_CURRENT_CONTEXT(ctx);
1899 struct gl_shader_program *shProg =
1900 _mesa_lookup_shader_program_err(ctx, program,
1901 "glProgramUniform3i64vARB");
1902 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 3);
1903 }
1904
1905 void GLAPIENTRY
1906 _mesa_ProgramUniform4i64vARB(GLuint program, GLint location, GLsizei count, const GLint64 *value)
1907 {
1908 GET_CURRENT_CONTEXT(ctx);
1909 struct gl_shader_program *shProg =
1910 _mesa_lookup_shader_program_err(ctx, program,
1911 "glProgramUniform4i64vARB");
1912 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 4);
1913 }
1914
1915 void GLAPIENTRY
1916 _mesa_ProgramUniform1ui64ARB(GLuint program, GLint location, GLuint64 v0)
1917 {
1918 GET_CURRENT_CONTEXT(ctx);
1919 struct gl_shader_program *shProg =
1920 _mesa_lookup_shader_program_err(ctx, program,
1921 "glProgramUniform1ui64ARB");
1922 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_UINT64, 1);
1923 }
1924
1925 void GLAPIENTRY
1926 _mesa_ProgramUniform2ui64ARB(GLuint program, GLint location, GLuint64 v0, GLuint64 v1)
1927 {
1928 GET_CURRENT_CONTEXT(ctx);
1929 struct gl_shader_program *shProg =
1930 _mesa_lookup_shader_program_err(ctx, program,
1931 "glProgramUniform2ui64ARB");
1932 uint64_t v[2];
1933 v[0] = v0;
1934 v[1] = v1;
1935 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 2);
1936 }
1937
1938 void GLAPIENTRY
1939 _mesa_ProgramUniform3ui64ARB(GLuint program, GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2)
1940 {
1941 GET_CURRENT_CONTEXT(ctx);
1942 struct gl_shader_program *shProg =
1943 _mesa_lookup_shader_program_err(ctx, program,
1944 "glProgramUniform3ui64ARB");
1945 uint64_t v[3];
1946 v[0] = v0;
1947 v[1] = v1;
1948 v[2] = v2;
1949 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 3);
1950 }
1951
1952 void GLAPIENTRY
1953 _mesa_ProgramUniform4ui64ARB(GLuint program, GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2, GLuint64 v3)
1954 {
1955 GET_CURRENT_CONTEXT(ctx);
1956 struct gl_shader_program *shProg =
1957 _mesa_lookup_shader_program_err(ctx, program,
1958 "glProgramUniform4ui64ARB");
1959 uint64_t v[4];
1960 v[0] = v0;
1961 v[1] = v1;
1962 v[2] = v2;
1963 v[3] = v3;
1964 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 4);
1965 }
1966
1967 void GLAPIENTRY
1968 _mesa_ProgramUniform1ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64 *value)
1969 {
1970 GET_CURRENT_CONTEXT(ctx);
1971 struct gl_shader_program *shProg =
1972 _mesa_lookup_shader_program_err(ctx, program,
1973 "glProgramUniform1ui64vARB");
1974 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 1);
1975 }
1976
1977 void GLAPIENTRY
1978 _mesa_ProgramUniform2ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64 *value)
1979 {
1980 GET_CURRENT_CONTEXT(ctx);
1981 struct gl_shader_program *shProg =
1982 _mesa_lookup_shader_program_err(ctx, program,
1983 "glProgramUniform2ui64vARB");
1984 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 2);
1985 }
1986
1987 void GLAPIENTRY
1988 _mesa_ProgramUniform3ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64 *value)
1989 {
1990 GET_CURRENT_CONTEXT(ctx);
1991 struct gl_shader_program *shProg =
1992 _mesa_lookup_shader_program_err(ctx, program,
1993 "glProgramUniform3ui64vARB");
1994 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 3);
1995 }
1996
1997 void GLAPIENTRY
1998 _mesa_ProgramUniform4ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64 *value)
1999 {
2000 GET_CURRENT_CONTEXT(ctx);
2001 struct gl_shader_program *shProg =
2002 _mesa_lookup_shader_program_err(ctx, program,
2003 "glProgramUniform4ui64vARB");
2004 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 4);
2005 }