mesa: add 'no_error' parameter to blit_framebuffer()
[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 /** Same as above with direct state access **/
298 void GLAPIENTRY
299 _mesa_ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
300 {
301 GET_CURRENT_CONTEXT(ctx);
302 struct gl_shader_program *shProg =
303 _mesa_lookup_shader_program_err(ctx, program,
304 "glProgramUniform1f");
305 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_FLOAT, 1);
306 }
307
308 void GLAPIENTRY
309 _mesa_ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
310 {
311 GET_CURRENT_CONTEXT(ctx);
312 GLfloat v[2];
313 struct gl_shader_program *shProg;
314 v[0] = v0;
315 v[1] = v1;
316 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2f");
317 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 2);
318 }
319
320 void GLAPIENTRY
321 _mesa_ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1,
322 GLfloat v2)
323 {
324 GET_CURRENT_CONTEXT(ctx);
325 GLfloat v[3];
326 struct gl_shader_program *shProg;
327 v[0] = v0;
328 v[1] = v1;
329 v[2] = v2;
330 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3f");
331 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 3);
332 }
333
334 void GLAPIENTRY
335 _mesa_ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1,
336 GLfloat v2, GLfloat v3)
337 {
338 GET_CURRENT_CONTEXT(ctx);
339 GLfloat v[4];
340 struct gl_shader_program *shProg;
341 v[0] = v0;
342 v[1] = v1;
343 v[2] = v2;
344 v[3] = v3;
345 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4f");
346 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 4);
347 }
348
349 void GLAPIENTRY
350 _mesa_ProgramUniform1i(GLuint program, GLint location, GLint v0)
351 {
352 GET_CURRENT_CONTEXT(ctx);
353 struct gl_shader_program *shProg =
354 _mesa_lookup_shader_program_err(ctx, program,
355 "glProgramUniform1i");
356 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_INT, 1);
357 }
358
359 void GLAPIENTRY
360 _mesa_ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
361 {
362 GET_CURRENT_CONTEXT(ctx);
363 GLint v[2];
364 struct gl_shader_program *shProg;
365 v[0] = v0;
366 v[1] = v1;
367 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2i");
368 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 2);
369 }
370
371 void GLAPIENTRY
372 _mesa_ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1,
373 GLint v2)
374 {
375 GET_CURRENT_CONTEXT(ctx);
376 GLint v[3];
377 struct gl_shader_program *shProg;
378 v[0] = v0;
379 v[1] = v1;
380 v[2] = v2;
381 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3i");
382 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 3);
383 }
384
385 void GLAPIENTRY
386 _mesa_ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1,
387 GLint v2, GLint v3)
388 {
389 GET_CURRENT_CONTEXT(ctx);
390 GLint v[4];
391 struct gl_shader_program *shProg;
392 v[0] = v0;
393 v[1] = v1;
394 v[2] = v2;
395 v[3] = v3;
396 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4i");
397 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 4);
398 }
399
400 void GLAPIENTRY
401 _mesa_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
402 const GLfloat * value)
403 {
404 GET_CURRENT_CONTEXT(ctx);
405 struct gl_shader_program *shProg =
406 _mesa_lookup_shader_program_err(ctx, program,
407 "glProgramUniform1fv");
408 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 1);
409 }
410
411 void GLAPIENTRY
412 _mesa_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
413 const GLfloat * value)
414 {
415 GET_CURRENT_CONTEXT(ctx);
416 struct gl_shader_program *shProg =
417 _mesa_lookup_shader_program_err(ctx, program,
418 "glProgramUniform2fv");
419 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 2);
420 }
421
422 void GLAPIENTRY
423 _mesa_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
424 const GLfloat * value)
425 {
426 GET_CURRENT_CONTEXT(ctx);
427 struct gl_shader_program *shProg =
428 _mesa_lookup_shader_program_err(ctx, program,
429 "glProgramUniform3fv");
430 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 3);
431 }
432
433 void GLAPIENTRY
434 _mesa_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
435 const GLfloat * value)
436 {
437 GET_CURRENT_CONTEXT(ctx);
438 struct gl_shader_program *shProg =
439 _mesa_lookup_shader_program_err(ctx, program,
440 "glProgramUniform4fv");
441 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 4);
442 }
443
444 void GLAPIENTRY
445 _mesa_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
446 const GLint * value)
447 {
448 GET_CURRENT_CONTEXT(ctx);
449 struct gl_shader_program *shProg =
450 _mesa_lookup_shader_program_err(ctx, program,
451 "glProgramUniform1iv");
452 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 1);
453 }
454
455 void GLAPIENTRY
456 _mesa_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
457 const GLint * value)
458 {
459 GET_CURRENT_CONTEXT(ctx);
460 struct gl_shader_program *shProg =
461 _mesa_lookup_shader_program_err(ctx, program,
462 "glProgramUniform2iv");
463 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 2);
464 }
465
466 void GLAPIENTRY
467 _mesa_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
468 const GLint * value)
469 {
470 GET_CURRENT_CONTEXT(ctx);
471 struct gl_shader_program *shProg =
472 _mesa_lookup_shader_program_err(ctx, program,
473 "glProgramUniform3iv");
474 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 3);
475 }
476
477 void GLAPIENTRY
478 _mesa_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
479 const GLint * value)
480 {
481 GET_CURRENT_CONTEXT(ctx);
482 struct gl_shader_program *shProg =
483 _mesa_lookup_shader_program_err(ctx, program,
484 "glProgramUniform4iv");
485 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 4);
486 }
487
488
489 /** OpenGL 3.0 GLuint-valued functions **/
490 void GLAPIENTRY
491 _mesa_Uniform1ui(GLint location, GLuint v0)
492 {
493 GET_CURRENT_CONTEXT(ctx);
494 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 1);
495 }
496
497 void GLAPIENTRY
498 _mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1)
499 {
500 GET_CURRENT_CONTEXT(ctx);
501 GLuint v[2];
502 v[0] = v0;
503 v[1] = v1;
504 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 2);
505 }
506
507 void GLAPIENTRY
508 _mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
509 {
510 GET_CURRENT_CONTEXT(ctx);
511 GLuint v[3];
512 v[0] = v0;
513 v[1] = v1;
514 v[2] = v2;
515 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 3);
516 }
517
518 void GLAPIENTRY
519 _mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
520 {
521 GET_CURRENT_CONTEXT(ctx);
522 GLuint v[4];
523 v[0] = v0;
524 v[1] = v1;
525 v[2] = v2;
526 v[3] = v3;
527 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 4);
528 }
529
530 void GLAPIENTRY
531 _mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
532 {
533 GET_CURRENT_CONTEXT(ctx);
534 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 1);
535 }
536
537 void GLAPIENTRY
538 _mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
539 {
540 GET_CURRENT_CONTEXT(ctx);
541 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 2);
542 }
543
544 void GLAPIENTRY
545 _mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
546 {
547 GET_CURRENT_CONTEXT(ctx);
548 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 3);
549 }
550
551 void GLAPIENTRY
552 _mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
553 {
554 GET_CURRENT_CONTEXT(ctx);
555 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 4);
556 }
557
558
559
560 void GLAPIENTRY
561 _mesa_UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose,
562 const GLfloat * value)
563 {
564 GET_CURRENT_CONTEXT(ctx);
565 _mesa_uniform_matrix(location, count, transpose, value,
566 ctx, ctx->_Shader->ActiveProgram, 2, 2, GLSL_TYPE_FLOAT);
567 }
568
569 void GLAPIENTRY
570 _mesa_UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose,
571 const GLfloat * value)
572 {
573 GET_CURRENT_CONTEXT(ctx);
574 _mesa_uniform_matrix(location, count, transpose, value,
575 ctx, ctx->_Shader->ActiveProgram, 3, 3, GLSL_TYPE_FLOAT);
576 }
577
578 void GLAPIENTRY
579 _mesa_UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
580 const GLfloat * value)
581 {
582 GET_CURRENT_CONTEXT(ctx);
583 _mesa_uniform_matrix(location, count, transpose, value,
584 ctx, ctx->_Shader->ActiveProgram, 4, 4, GLSL_TYPE_FLOAT);
585 }
586
587 /** Same as above with direct state access **/
588
589 void GLAPIENTRY
590 _mesa_ProgramUniform1ui(GLuint program, GLint location, GLuint v0)
591 {
592 GET_CURRENT_CONTEXT(ctx);
593 struct gl_shader_program *shProg =
594 _mesa_lookup_shader_program_err(ctx, program,
595 "glProgramUniform1ui");
596 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_UINT, 1);
597 }
598
599 void GLAPIENTRY
600 _mesa_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
601 {
602 GET_CURRENT_CONTEXT(ctx);
603 GLuint v[2];
604 struct gl_shader_program *shProg;
605 v[0] = v0;
606 v[1] = v1;
607 shProg = _mesa_lookup_shader_program_err(ctx, program,
608 "glProgramUniform2ui");
609 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 2);
610 }
611
612 void GLAPIENTRY
613 _mesa_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1,
614 GLuint v2)
615 {
616 GET_CURRENT_CONTEXT(ctx);
617 GLuint v[3];
618 struct gl_shader_program *shProg;
619 v[0] = v0;
620 v[1] = v1;
621 v[2] = v2;
622 shProg = _mesa_lookup_shader_program_err(ctx, program,
623 "glProgramUniform3ui");
624 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 3);
625 }
626
627 void GLAPIENTRY
628 _mesa_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1,
629 GLuint v2, GLuint v3)
630 {
631 GET_CURRENT_CONTEXT(ctx);
632 GLuint v[4];
633 struct gl_shader_program *shProg;
634 v[0] = v0;
635 v[1] = v1;
636 v[2] = v2;
637 v[3] = v3;
638 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4ui");
639 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 4);
640 }
641
642 void GLAPIENTRY
643 _mesa_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
644 const GLuint *value)
645 {
646 GET_CURRENT_CONTEXT(ctx);
647 struct gl_shader_program *shProg =
648 _mesa_lookup_shader_program_err(ctx, program,
649 "glProgramUniform1uiv");
650 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 1);
651 }
652
653 void GLAPIENTRY
654 _mesa_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
655 const GLuint *value)
656 {
657 GET_CURRENT_CONTEXT(ctx);
658 struct gl_shader_program *shProg =
659 _mesa_lookup_shader_program_err(ctx, program,
660 "glProgramUniform2uiv");
661 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 2);
662 }
663
664 void GLAPIENTRY
665 _mesa_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
666 const GLuint *value)
667 {
668 GET_CURRENT_CONTEXT(ctx);
669 struct gl_shader_program *shProg =
670 _mesa_lookup_shader_program_err(ctx, program,
671 "glProgramUniform3uiv");
672 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 3);
673 }
674
675 void GLAPIENTRY
676 _mesa_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
677 const GLuint *value)
678 {
679 GET_CURRENT_CONTEXT(ctx);
680 struct gl_shader_program *shProg =
681 _mesa_lookup_shader_program_err(ctx, program,
682 "glProgramUniform4uiv");
683 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 4);
684 }
685
686
687
688 void GLAPIENTRY
689 _mesa_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
690 GLboolean transpose, const GLfloat * value)
691 {
692 GET_CURRENT_CONTEXT(ctx);
693 struct gl_shader_program *shProg =
694 _mesa_lookup_shader_program_err(ctx, program,
695 "glProgramUniformMatrix2fv");
696 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 2, 2, GLSL_TYPE_FLOAT);
697 }
698
699 void GLAPIENTRY
700 _mesa_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
701 GLboolean transpose, const GLfloat * value)
702 {
703 GET_CURRENT_CONTEXT(ctx);
704 struct gl_shader_program *shProg =
705 _mesa_lookup_shader_program_err(ctx, program,
706 "glProgramUniformMatrix3fv");
707 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 3, 3, GLSL_TYPE_FLOAT);
708 }
709
710 void GLAPIENTRY
711 _mesa_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
712 GLboolean transpose, const GLfloat * value)
713 {
714 GET_CURRENT_CONTEXT(ctx);
715 struct gl_shader_program *shProg =
716 _mesa_lookup_shader_program_err(ctx, program,
717 "glProgramUniformMatrix4fv");
718 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 4, 4, GLSL_TYPE_FLOAT);
719 }
720
721
722 /**
723 * Non-square UniformMatrix are OpenGL 2.1
724 */
725 void GLAPIENTRY
726 _mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
727 const GLfloat *value)
728 {
729 GET_CURRENT_CONTEXT(ctx);
730 _mesa_uniform_matrix(location, count, transpose, value,
731 ctx, ctx->_Shader->ActiveProgram, 2, 3, GLSL_TYPE_FLOAT);
732 }
733
734 void GLAPIENTRY
735 _mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
736 const GLfloat *value)
737 {
738 GET_CURRENT_CONTEXT(ctx);
739 _mesa_uniform_matrix(location, count, transpose, value,
740 ctx, ctx->_Shader->ActiveProgram, 3, 2, GLSL_TYPE_FLOAT);
741 }
742
743 void GLAPIENTRY
744 _mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
745 const GLfloat *value)
746 {
747 GET_CURRENT_CONTEXT(ctx);
748 _mesa_uniform_matrix(location, count, transpose, value,
749 ctx, ctx->_Shader->ActiveProgram, 2, 4, GLSL_TYPE_FLOAT);
750 }
751
752 void GLAPIENTRY
753 _mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
754 const GLfloat *value)
755 {
756 GET_CURRENT_CONTEXT(ctx);
757 _mesa_uniform_matrix(location, count, transpose, value,
758 ctx, ctx->_Shader->ActiveProgram, 4, 2, GLSL_TYPE_FLOAT);
759 }
760
761 void GLAPIENTRY
762 _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
763 const GLfloat *value)
764 {
765 GET_CURRENT_CONTEXT(ctx);
766 _mesa_uniform_matrix(location, count, transpose, value,
767 ctx, ctx->_Shader->ActiveProgram, 3, 4, GLSL_TYPE_FLOAT);
768 }
769
770 void GLAPIENTRY
771 _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
772 const GLfloat *value)
773 {
774 GET_CURRENT_CONTEXT(ctx);
775 _mesa_uniform_matrix(location, count, transpose, value,
776 ctx, ctx->_Shader->ActiveProgram, 4, 3, GLSL_TYPE_FLOAT);
777 }
778
779 /** Same as above with direct state access **/
780
781 void GLAPIENTRY
782 _mesa_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
783 GLboolean transpose, const GLfloat * value)
784 {
785 GET_CURRENT_CONTEXT(ctx);
786 struct gl_shader_program *shProg =
787 _mesa_lookup_shader_program_err(ctx, program,
788 "glProgramUniformMatrix2x3fv");
789 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 2, 3, GLSL_TYPE_FLOAT);
790 }
791
792 void GLAPIENTRY
793 _mesa_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
794 GLboolean transpose, const GLfloat * value)
795 {
796 GET_CURRENT_CONTEXT(ctx);
797 struct gl_shader_program *shProg =
798 _mesa_lookup_shader_program_err(ctx, program,
799 "glProgramUniformMatrix3x2fv");
800 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 3, 2, GLSL_TYPE_FLOAT);
801 }
802
803 void GLAPIENTRY
804 _mesa_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
805 GLboolean transpose, const GLfloat * value)
806 {
807 GET_CURRENT_CONTEXT(ctx);
808 struct gl_shader_program *shProg =
809 _mesa_lookup_shader_program_err(ctx, program,
810 "glProgramUniformMatrix2x4fv");
811 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 2, 4, GLSL_TYPE_FLOAT);
812 }
813
814 void GLAPIENTRY
815 _mesa_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
816 GLboolean transpose, const GLfloat * value)
817 {
818 GET_CURRENT_CONTEXT(ctx);
819 struct gl_shader_program *shProg =
820 _mesa_lookup_shader_program_err(ctx, program,
821 "glProgramUniformMatrix4x2fv");
822 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 4, 2, GLSL_TYPE_FLOAT);
823 }
824
825 void GLAPIENTRY
826 _mesa_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
827 GLboolean transpose, const GLfloat * value)
828 {
829 GET_CURRENT_CONTEXT(ctx);
830 struct gl_shader_program *shProg =
831 _mesa_lookup_shader_program_err(ctx, program,
832 "glProgramUniformMatrix3x4fv");
833 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 3, 4, GLSL_TYPE_FLOAT);
834 }
835
836 void GLAPIENTRY
837 _mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
838 GLboolean transpose, const GLfloat * value)
839 {
840 GET_CURRENT_CONTEXT(ctx);
841 struct gl_shader_program *shProg =
842 _mesa_lookup_shader_program_err(ctx, program,
843 "glProgramUniformMatrix4x3fv");
844 _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 4, 3, GLSL_TYPE_FLOAT);
845 }
846
847
848 void GLAPIENTRY
849 _mesa_GetnUniformfvARB(GLuint program, GLint location,
850 GLsizei bufSize, GLfloat *params)
851 {
852 GET_CURRENT_CONTEXT(ctx);
853 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_FLOAT, params);
854 }
855
856 void GLAPIENTRY
857 _mesa_GetUniformfv(GLuint program, GLint location, GLfloat *params)
858 {
859 _mesa_GetnUniformfvARB(program, location, INT_MAX, params);
860 }
861
862
863 void GLAPIENTRY
864 _mesa_GetnUniformivARB(GLuint program, GLint location,
865 GLsizei bufSize, GLint *params)
866 {
867 GET_CURRENT_CONTEXT(ctx);
868 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_INT, params);
869 }
870
871 void GLAPIENTRY
872 _mesa_GetUniformiv(GLuint program, GLint location, GLint *params)
873 {
874 _mesa_GetnUniformivARB(program, location, INT_MAX, params);
875 }
876
877
878 /* GL3 */
879 void GLAPIENTRY
880 _mesa_GetnUniformuivARB(GLuint program, GLint location,
881 GLsizei bufSize, GLuint *params)
882 {
883 GET_CURRENT_CONTEXT(ctx);
884 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_UINT, params);
885 }
886
887 void GLAPIENTRY
888 _mesa_GetUniformuiv(GLuint program, GLint location, GLuint *params)
889 {
890 _mesa_GetnUniformuivARB(program, location, INT_MAX, params);
891 }
892
893
894 /* GL4 */
895 void GLAPIENTRY
896 _mesa_GetnUniformdvARB(GLuint program, GLint location,
897 GLsizei bufSize, GLdouble *params)
898 {
899 GET_CURRENT_CONTEXT(ctx);
900
901 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_DOUBLE, params);
902 }
903
904 void GLAPIENTRY
905 _mesa_GetUniformdv(GLuint program, GLint location, GLdouble *params)
906 {
907 _mesa_GetnUniformdvARB(program, location, INT_MAX, params);
908 }
909
910 void GLAPIENTRY
911 _mesa_GetnUniformi64vARB(GLuint program, GLint location,
912 GLsizei bufSize, GLint64 *params)
913 {
914 GET_CURRENT_CONTEXT(ctx);
915 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_INT64, params);
916 }
917 void GLAPIENTRY
918 _mesa_GetUniformi64vARB(GLuint program, GLint location, GLint64 *params)
919 {
920 _mesa_GetnUniformi64vARB(program, location, INT_MAX, params);
921 }
922
923 void GLAPIENTRY
924 _mesa_GetnUniformui64vARB(GLuint program, GLint location,
925 GLsizei bufSize, GLuint64 *params)
926 {
927 GET_CURRENT_CONTEXT(ctx);
928 _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_UINT64, params);
929 }
930
931 void GLAPIENTRY
932 _mesa_GetUniformui64vARB(GLuint program, GLint location, GLuint64 *params)
933 {
934 _mesa_GetnUniformui64vARB(program, location, INT_MAX, params);
935 }
936
937
938 GLint GLAPIENTRY
939 _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
940 {
941 struct gl_shader_program *shProg;
942
943 GET_CURRENT_CONTEXT(ctx);
944
945 shProg = _mesa_lookup_shader_program_err(ctx, programObj,
946 "glGetUniformLocation");
947 if (!shProg)
948 return -1;
949
950 /* Page 80 (page 94 of the PDF) of the OpenGL 2.1 spec says:
951 *
952 * "If program has not been successfully linked, the error
953 * INVALID_OPERATION is generated."
954 */
955 if (shProg->data->LinkStatus == linking_failure) {
956 _mesa_error(ctx, GL_INVALID_OPERATION,
957 "glGetUniformLocation(program not linked)");
958 return -1;
959 }
960
961 return _mesa_program_resource_location(shProg, GL_UNIFORM, name);
962 }
963
964 GLuint GLAPIENTRY
965 _mesa_GetUniformBlockIndex(GLuint program,
966 const GLchar *uniformBlockName)
967 {
968 GET_CURRENT_CONTEXT(ctx);
969 struct gl_shader_program *shProg;
970
971 if (!ctx->Extensions.ARB_uniform_buffer_object) {
972 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformBlockIndex");
973 return GL_INVALID_INDEX;
974 }
975
976 shProg = _mesa_lookup_shader_program_err(ctx, program,
977 "glGetUniformBlockIndex");
978 if (!shProg)
979 return GL_INVALID_INDEX;
980
981 struct gl_program_resource *res =
982 _mesa_program_resource_find_name(shProg, GL_UNIFORM_BLOCK,
983 uniformBlockName, NULL);
984 if (!res)
985 return GL_INVALID_INDEX;
986
987 return _mesa_program_resource_index(shProg, res);
988 }
989
990 void GLAPIENTRY
991 _mesa_GetUniformIndices(GLuint program,
992 GLsizei uniformCount,
993 const GLchar * const *uniformNames,
994 GLuint *uniformIndices)
995 {
996 GET_CURRENT_CONTEXT(ctx);
997 GLsizei i;
998 struct gl_shader_program *shProg;
999
1000 if (!ctx->Extensions.ARB_uniform_buffer_object) {
1001 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformIndices");
1002 return;
1003 }
1004
1005 shProg = _mesa_lookup_shader_program_err(ctx, program,
1006 "glGetUniformIndices");
1007 if (!shProg)
1008 return;
1009
1010 if (uniformCount < 0) {
1011 _mesa_error(ctx, GL_INVALID_VALUE,
1012 "glGetUniformIndices(uniformCount < 0)");
1013 return;
1014 }
1015
1016 for (i = 0; i < uniformCount; i++) {
1017 struct gl_program_resource *res =
1018 _mesa_program_resource_find_name(shProg, GL_UNIFORM, uniformNames[i],
1019 NULL);
1020 uniformIndices[i] = _mesa_program_resource_index(shProg, res);
1021 }
1022 }
1023
1024 void GLAPIENTRY
1025 _mesa_UniformBlockBinding(GLuint program,
1026 GLuint uniformBlockIndex,
1027 GLuint uniformBlockBinding)
1028 {
1029 GET_CURRENT_CONTEXT(ctx);
1030 struct gl_shader_program *shProg;
1031
1032 if (!ctx->Extensions.ARB_uniform_buffer_object) {
1033 _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformBlockBinding");
1034 return;
1035 }
1036
1037 shProg = _mesa_lookup_shader_program_err(ctx, program,
1038 "glUniformBlockBinding");
1039 if (!shProg)
1040 return;
1041
1042 if (uniformBlockIndex >= shProg->data->NumUniformBlocks) {
1043 _mesa_error(ctx, GL_INVALID_VALUE,
1044 "glUniformBlockBinding(block index %u >= %u)",
1045 uniformBlockIndex, shProg->data->NumUniformBlocks);
1046 return;
1047 }
1048
1049 if (uniformBlockBinding >= ctx->Const.MaxUniformBufferBindings) {
1050 _mesa_error(ctx, GL_INVALID_VALUE,
1051 "glUniformBlockBinding(block binding %u >= %u)",
1052 uniformBlockBinding, ctx->Const.MaxUniformBufferBindings);
1053 return;
1054 }
1055
1056 if (shProg->data->UniformBlocks[uniformBlockIndex].Binding !=
1057 uniformBlockBinding) {
1058
1059 FLUSH_VERTICES(ctx, 0);
1060 ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
1061
1062 shProg->data->UniformBlocks[uniformBlockIndex].Binding =
1063 uniformBlockBinding;
1064 }
1065 }
1066
1067 void GLAPIENTRY
1068 _mesa_ShaderStorageBlockBinding(GLuint program,
1069 GLuint shaderStorageBlockIndex,
1070 GLuint shaderStorageBlockBinding)
1071 {
1072 GET_CURRENT_CONTEXT(ctx);
1073 struct gl_shader_program *shProg;
1074
1075 if (!ctx->Extensions.ARB_shader_storage_buffer_object) {
1076 _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderStorageBlockBinding");
1077 return;
1078 }
1079
1080 shProg = _mesa_lookup_shader_program_err(ctx, program,
1081 "glShaderStorageBlockBinding");
1082 if (!shProg)
1083 return;
1084
1085 if (shaderStorageBlockIndex >= shProg->data->NumShaderStorageBlocks) {
1086 _mesa_error(ctx, GL_INVALID_VALUE,
1087 "glShaderStorageBlockBinding(block index %u >= %u)",
1088 shaderStorageBlockIndex,
1089 shProg->data->NumShaderStorageBlocks);
1090 return;
1091 }
1092
1093 if (shaderStorageBlockBinding >= ctx->Const.MaxShaderStorageBufferBindings) {
1094 _mesa_error(ctx, GL_INVALID_VALUE,
1095 "glShaderStorageBlockBinding(block binding %u >= %u)",
1096 shaderStorageBlockBinding,
1097 ctx->Const.MaxShaderStorageBufferBindings);
1098 return;
1099 }
1100
1101 if (shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding !=
1102 shaderStorageBlockBinding) {
1103
1104 FLUSH_VERTICES(ctx, 0);
1105 ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer;
1106
1107 shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding =
1108 shaderStorageBlockBinding;
1109 }
1110 }
1111
1112 /**
1113 * Generic program resource property query.
1114 */
1115 static void
1116 mesa_bufferiv(struct gl_shader_program *shProg, GLenum type,
1117 GLuint index, GLenum pname, GLint *params, const char *caller)
1118 {
1119 GET_CURRENT_CONTEXT(ctx);
1120 struct gl_program_resource *res =
1121 _mesa_program_resource_find_index(shProg, type, index);
1122
1123 if (!res) {
1124 _mesa_error(ctx, GL_INVALID_VALUE, "%s(bufferindex %d)", caller, index);
1125 return;
1126 }
1127
1128 switch (pname) {
1129 case GL_UNIFORM_BLOCK_BINDING:
1130 case GL_ATOMIC_COUNTER_BUFFER_BINDING:
1131 _mesa_program_resource_prop(shProg, res, index, GL_BUFFER_BINDING,
1132 params, caller);
1133 return;
1134 case GL_UNIFORM_BLOCK_DATA_SIZE:
1135 case GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE:
1136 _mesa_program_resource_prop(shProg, res, index, GL_BUFFER_DATA_SIZE,
1137 params, caller);
1138 return;
1139 case GL_UNIFORM_BLOCK_NAME_LENGTH:
1140 _mesa_program_resource_prop(shProg, res, index, GL_NAME_LENGTH,
1141 params, caller);
1142 return;
1143 case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
1144 case GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS:
1145 _mesa_program_resource_prop(shProg, res, index, GL_NUM_ACTIVE_VARIABLES,
1146 params, caller);
1147 return;
1148 case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
1149 case GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES:
1150 _mesa_program_resource_prop(shProg, res, index, GL_ACTIVE_VARIABLES,
1151 params, caller);
1152 return;
1153 case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
1154 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER:
1155 _mesa_program_resource_prop(shProg, res, index,
1156 GL_REFERENCED_BY_VERTEX_SHADER, params,
1157 caller);
1158 return;
1159
1160 case GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER:
1161 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER:
1162 _mesa_program_resource_prop(shProg, res, index,
1163 GL_REFERENCED_BY_TESS_CONTROL_SHADER, params,
1164 caller);
1165 return;
1166
1167 case GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER:
1168 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER:
1169 _mesa_program_resource_prop(shProg, res, index,
1170 GL_REFERENCED_BY_TESS_EVALUATION_SHADER, params,
1171 caller);
1172 return;
1173
1174 case GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER:
1175 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER:
1176 _mesa_program_resource_prop(shProg, res, index,
1177 GL_REFERENCED_BY_GEOMETRY_SHADER, params,
1178 caller);
1179 return;
1180 case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
1181 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER:
1182 _mesa_program_resource_prop(shProg, res, index,
1183 GL_REFERENCED_BY_FRAGMENT_SHADER, params,
1184 caller);
1185 return;
1186 case GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER:
1187 case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER:
1188 _mesa_program_resource_prop(shProg, res, index,
1189 GL_REFERENCED_BY_COMPUTE_SHADER, params,
1190 caller);
1191 return;
1192 default:
1193 _mesa_error(ctx, GL_INVALID_ENUM,
1194 "%s(pname 0x%x (%s))", caller, pname,
1195 _mesa_enum_to_string(pname));
1196 return;
1197 }
1198 }
1199
1200
1201 void GLAPIENTRY
1202 _mesa_GetActiveUniformBlockiv(GLuint program,
1203 GLuint uniformBlockIndex,
1204 GLenum pname,
1205 GLint *params)
1206 {
1207 GET_CURRENT_CONTEXT(ctx);
1208 struct gl_shader_program *shProg;
1209
1210 if (!ctx->Extensions.ARB_uniform_buffer_object) {
1211 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformBlockiv");
1212 return;
1213 }
1214
1215 shProg = _mesa_lookup_shader_program_err(ctx, program,
1216 "glGetActiveUniformBlockiv");
1217 if (!shProg)
1218 return;
1219
1220 mesa_bufferiv(shProg, GL_UNIFORM_BLOCK, uniformBlockIndex, pname, params,
1221 "glGetActiveUniformBlockiv");
1222 }
1223
1224 void GLAPIENTRY
1225 _mesa_GetActiveUniformBlockName(GLuint program,
1226 GLuint uniformBlockIndex,
1227 GLsizei bufSize,
1228 GLsizei *length,
1229 GLchar *uniformBlockName)
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 if (bufSize < 0) {
1240 _mesa_error(ctx, GL_INVALID_VALUE,
1241 "glGetActiveUniformBlockName(bufSize %d < 0)",
1242 bufSize);
1243 return;
1244 }
1245
1246 shProg = _mesa_lookup_shader_program_err(ctx, program,
1247 "glGetActiveUniformBlockiv");
1248 if (!shProg)
1249 return;
1250
1251 if (uniformBlockName)
1252 _mesa_get_program_resource_name(shProg, GL_UNIFORM_BLOCK,
1253 uniformBlockIndex, bufSize, length,
1254 uniformBlockName,
1255 "glGetActiveUniformBlockName");
1256 }
1257
1258 void GLAPIENTRY
1259 _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex,
1260 GLsizei bufSize, GLsizei *length,
1261 GLchar *uniformName)
1262 {
1263 GET_CURRENT_CONTEXT(ctx);
1264 struct gl_shader_program *shProg;
1265
1266 if (!ctx->Extensions.ARB_uniform_buffer_object) {
1267 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformName");
1268 return;
1269 }
1270
1271 if (bufSize < 0) {
1272 _mesa_error(ctx, GL_INVALID_VALUE,
1273 "glGetActiveUniformName(bufSize %d < 0)",
1274 bufSize);
1275 return;
1276 }
1277
1278 shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniformName");
1279
1280 if (!shProg)
1281 return;
1282
1283 _mesa_get_program_resource_name(shProg, GL_UNIFORM, uniformIndex, bufSize,
1284 length, uniformName, "glGetActiveUniformName");
1285 }
1286
1287 void GLAPIENTRY
1288 _mesa_GetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex,
1289 GLenum pname, GLint *params)
1290 {
1291 GET_CURRENT_CONTEXT(ctx);
1292 struct gl_shader_program *shProg;
1293
1294 if (!ctx->Extensions.ARB_shader_atomic_counters) {
1295 _mesa_error(ctx, GL_INVALID_OPERATION,
1296 "glGetActiveAtomicCounterBufferiv");
1297 return;
1298 }
1299
1300 shProg = _mesa_lookup_shader_program_err(ctx, program,
1301 "glGetActiveAtomicCounterBufferiv");
1302 if (!shProg)
1303 return;
1304
1305 mesa_bufferiv(shProg, GL_ATOMIC_COUNTER_BUFFER, bufferIndex, pname, params,
1306 "glGetActiveAtomicCounterBufferiv");
1307 }
1308
1309 void GLAPIENTRY
1310 _mesa_Uniform1d(GLint location, GLdouble v0)
1311 {
1312 GET_CURRENT_CONTEXT(ctx);
1313 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 1);
1314 }
1315
1316 void GLAPIENTRY
1317 _mesa_Uniform2d(GLint location, GLdouble v0, GLdouble v1)
1318 {
1319 GET_CURRENT_CONTEXT(ctx);
1320 GLdouble v[2];
1321 v[0] = v0;
1322 v[1] = v1;
1323 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 2);
1324 }
1325
1326 void GLAPIENTRY
1327 _mesa_Uniform3d(GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
1328 {
1329 GET_CURRENT_CONTEXT(ctx);
1330 GLdouble v[3];
1331 v[0] = v0;
1332 v[1] = v1;
1333 v[2] = v2;
1334 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 3);
1335 }
1336
1337 void GLAPIENTRY
1338 _mesa_Uniform4d(GLint location, GLdouble v0, GLdouble v1, GLdouble v2,
1339 GLdouble v3)
1340 {
1341 GET_CURRENT_CONTEXT(ctx);
1342 GLdouble v[4];
1343 v[0] = v0;
1344 v[1] = v1;
1345 v[2] = v2;
1346 v[3] = v3;
1347 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 4);
1348 }
1349
1350 void GLAPIENTRY
1351 _mesa_Uniform1dv(GLint location, GLsizei count, const GLdouble * value)
1352 {
1353 GET_CURRENT_CONTEXT(ctx);
1354 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 1);
1355 }
1356
1357 void GLAPIENTRY
1358 _mesa_Uniform2dv(GLint location, GLsizei count, const GLdouble * value)
1359 {
1360 GET_CURRENT_CONTEXT(ctx);
1361 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 2);
1362 }
1363
1364 void GLAPIENTRY
1365 _mesa_Uniform3dv(GLint location, GLsizei count, const GLdouble * value)
1366 {
1367 GET_CURRENT_CONTEXT(ctx);
1368 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 3);
1369 }
1370
1371 void GLAPIENTRY
1372 _mesa_Uniform4dv(GLint location, GLsizei count, const GLdouble * value)
1373 {
1374 GET_CURRENT_CONTEXT(ctx);
1375 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 4);
1376 }
1377
1378 void GLAPIENTRY
1379 _mesa_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
1380 const GLdouble * value)
1381 {
1382 GET_CURRENT_CONTEXT(ctx);
1383 _mesa_uniform_matrix(location, count, transpose, value,
1384 ctx, ctx->_Shader->ActiveProgram, 2, 2, GLSL_TYPE_DOUBLE);
1385 }
1386
1387 void GLAPIENTRY
1388 _mesa_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
1389 const GLdouble * value)
1390 {
1391 GET_CURRENT_CONTEXT(ctx);
1392 _mesa_uniform_matrix(location, count, transpose, value,
1393 ctx, ctx->_Shader->ActiveProgram, 3, 3, GLSL_TYPE_DOUBLE);
1394 }
1395
1396 void GLAPIENTRY
1397 _mesa_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
1398 const GLdouble * value)
1399 {
1400 GET_CURRENT_CONTEXT(ctx);
1401 _mesa_uniform_matrix(location, count, transpose, value,
1402 ctx, ctx->_Shader->ActiveProgram, 4, 4, GLSL_TYPE_DOUBLE);
1403 }
1404
1405 void GLAPIENTRY
1406 _mesa_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
1407 const GLdouble *value)
1408 {
1409 GET_CURRENT_CONTEXT(ctx);
1410 _mesa_uniform_matrix(location, count, transpose, value,
1411 ctx, ctx->_Shader->ActiveProgram, 2, 3, GLSL_TYPE_DOUBLE);
1412 }
1413
1414 void GLAPIENTRY
1415 _mesa_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
1416 const GLdouble *value)
1417 {
1418 GET_CURRENT_CONTEXT(ctx);
1419 _mesa_uniform_matrix(location, count, transpose, value,
1420 ctx, ctx->_Shader->ActiveProgram, 3, 2, GLSL_TYPE_DOUBLE);
1421 }
1422
1423 void GLAPIENTRY
1424 _mesa_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
1425 const GLdouble *value)
1426 {
1427 GET_CURRENT_CONTEXT(ctx);
1428 _mesa_uniform_matrix(location, count, transpose, value,
1429 ctx, ctx->_Shader->ActiveProgram, 2, 4, GLSL_TYPE_DOUBLE);
1430 }
1431
1432 void GLAPIENTRY
1433 _mesa_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
1434 const GLdouble *value)
1435 {
1436 GET_CURRENT_CONTEXT(ctx);
1437 _mesa_uniform_matrix(location, count, transpose, value,
1438 ctx, ctx->_Shader->ActiveProgram, 4, 2, GLSL_TYPE_DOUBLE);
1439 }
1440
1441 void GLAPIENTRY
1442 _mesa_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
1443 const GLdouble *value)
1444 {
1445 GET_CURRENT_CONTEXT(ctx);
1446 _mesa_uniform_matrix(location, count, transpose, value,
1447 ctx, ctx->_Shader->ActiveProgram, 3, 4, GLSL_TYPE_DOUBLE);
1448 }
1449
1450 void GLAPIENTRY
1451 _mesa_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
1452 const GLdouble *value)
1453 {
1454 GET_CURRENT_CONTEXT(ctx);
1455 _mesa_uniform_matrix(location, count, transpose, value,
1456 ctx, ctx->_Shader->ActiveProgram, 4, 3, GLSL_TYPE_DOUBLE);
1457 }
1458
1459 void GLAPIENTRY
1460 _mesa_ProgramUniform1d(GLuint program, GLint location, GLdouble v0)
1461 {
1462 GET_CURRENT_CONTEXT(ctx);
1463 struct gl_shader_program *shProg =
1464 _mesa_lookup_shader_program_err(ctx, program,
1465 "glProgramUniform1d");
1466 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_DOUBLE, 1);
1467 }
1468
1469 void GLAPIENTRY
1470 _mesa_ProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
1471 {
1472 GET_CURRENT_CONTEXT(ctx);
1473 GLdouble v[2];
1474 struct gl_shader_program *shProg;
1475 v[0] = v0;
1476 v[1] = v1;
1477 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2d");
1478 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 2);
1479 }
1480
1481 void GLAPIENTRY
1482 _mesa_ProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1,
1483 GLdouble v2)
1484 {
1485 GET_CURRENT_CONTEXT(ctx);
1486 GLdouble v[3];
1487 struct gl_shader_program *shProg;
1488 v[0] = v0;
1489 v[1] = v1;
1490 v[2] = v2;
1491 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3d");
1492 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 3);
1493 }
1494
1495 void GLAPIENTRY
1496 _mesa_ProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1,
1497 GLdouble v2, GLdouble v3)
1498 {
1499 GET_CURRENT_CONTEXT(ctx);
1500 GLdouble v[4];
1501 struct gl_shader_program *shProg;
1502 v[0] = v0;
1503 v[1] = v1;
1504 v[2] = v2;
1505 v[3] = v3;
1506 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4d");
1507 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 4);
1508 }
1509
1510 void GLAPIENTRY
1511 _mesa_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
1512 const GLdouble * value)
1513 {
1514 GET_CURRENT_CONTEXT(ctx);
1515 struct gl_shader_program *shProg =
1516 _mesa_lookup_shader_program_err(ctx, program,
1517 "glProgramUniform1dv");
1518 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 1);
1519 }
1520
1521 void GLAPIENTRY
1522 _mesa_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
1523 const GLdouble * value)
1524 {
1525 GET_CURRENT_CONTEXT(ctx);
1526 struct gl_shader_program *shProg =
1527 _mesa_lookup_shader_program_err(ctx, program,
1528 "glProgramUniform2dv");
1529 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 2);
1530 }
1531
1532 void GLAPIENTRY
1533 _mesa_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
1534 const GLdouble * value)
1535 {
1536 GET_CURRENT_CONTEXT(ctx);
1537 struct gl_shader_program *shProg =
1538 _mesa_lookup_shader_program_err(ctx, program,
1539 "glProgramUniform3dv");
1540 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 3);
1541 }
1542
1543 void GLAPIENTRY
1544 _mesa_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
1545 const GLdouble * value)
1546 {
1547 GET_CURRENT_CONTEXT(ctx);
1548 struct gl_shader_program *shProg =
1549 _mesa_lookup_shader_program_err(ctx, program,
1550 "glProgramUniform4dv");
1551 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 4);
1552 }
1553
1554 void GLAPIENTRY
1555 _mesa_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
1556 GLboolean transpose, const GLdouble * value)
1557 {
1558 GET_CURRENT_CONTEXT(ctx);
1559 struct gl_shader_program *shProg =
1560 _mesa_lookup_shader_program_err(ctx, program,
1561 "glProgramUniformMatrix2dv");
1562 _mesa_uniform_matrix(location, count, transpose, value,
1563 ctx, shProg, 2, 2, GLSL_TYPE_DOUBLE);
1564 }
1565
1566 void GLAPIENTRY
1567 _mesa_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
1568 GLboolean transpose, const GLdouble * value)
1569 {
1570 GET_CURRENT_CONTEXT(ctx);
1571 struct gl_shader_program *shProg =
1572 _mesa_lookup_shader_program_err(ctx, program,
1573 "glProgramUniformMatrix3dv");
1574 _mesa_uniform_matrix(location, count, transpose, value,
1575 ctx, shProg, 3, 3, GLSL_TYPE_DOUBLE);
1576 }
1577
1578 void GLAPIENTRY
1579 _mesa_ProgramUniformMatrix4dv(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 "glProgramUniformMatrix4dv");
1586 _mesa_uniform_matrix(location, count, transpose, value,
1587 ctx, shProg, 4, 4, GLSL_TYPE_DOUBLE);
1588 }
1589
1590 void GLAPIENTRY
1591 _mesa_ProgramUniformMatrix2x3dv(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 "glProgramUniformMatrix2x3dv");
1598 _mesa_uniform_matrix(location, count, transpose, value,
1599 ctx, shProg, 2, 3, GLSL_TYPE_DOUBLE);
1600 }
1601
1602 void GLAPIENTRY
1603 _mesa_ProgramUniformMatrix3x2dv(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 "glProgramUniformMatrix3x2dv");
1610 _mesa_uniform_matrix(location, count, transpose, value,
1611 ctx, shProg, 3, 2, GLSL_TYPE_DOUBLE);
1612 }
1613
1614 void GLAPIENTRY
1615 _mesa_ProgramUniformMatrix2x4dv(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 "glProgramUniformMatrix2x4dv");
1622 _mesa_uniform_matrix(location, count, transpose, value,
1623 ctx, shProg, 2, 4, GLSL_TYPE_DOUBLE);
1624 }
1625
1626 void GLAPIENTRY
1627 _mesa_ProgramUniformMatrix4x2dv(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 "glProgramUniformMatrix4x2dv");
1634 _mesa_uniform_matrix(location, count, transpose, value,
1635 ctx, shProg, 4, 2, GLSL_TYPE_DOUBLE);
1636 }
1637
1638 void GLAPIENTRY
1639 _mesa_ProgramUniformMatrix3x4dv(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 "glProgramUniformMatrix3x4dv");
1646 _mesa_uniform_matrix(location, count, transpose, value,
1647 ctx, shProg, 3, 4, GLSL_TYPE_DOUBLE);
1648 }
1649
1650 void GLAPIENTRY
1651 _mesa_ProgramUniformMatrix4x3dv(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 "glProgramUniformMatrix4x3dv");
1658 _mesa_uniform_matrix(location, count, transpose, value,
1659 ctx, shProg, 4, 3, GLSL_TYPE_DOUBLE);
1660 }
1661
1662 void GLAPIENTRY
1663 _mesa_Uniform1i64ARB(GLint location, GLint64 v0)
1664 {
1665 GET_CURRENT_CONTEXT(ctx);
1666 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 1);
1667 }
1668
1669 void GLAPIENTRY
1670 _mesa_Uniform2i64ARB(GLint location, GLint64 v0, GLint64 v1)
1671 {
1672 GET_CURRENT_CONTEXT(ctx);
1673 int64_t v[2];
1674 v[0] = v0;
1675 v[1] = v1;
1676 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 2);
1677 }
1678
1679 void GLAPIENTRY
1680 _mesa_Uniform3i64ARB(GLint location, GLint64 v0, GLint64 v1, GLint64 v2)
1681 {
1682 GET_CURRENT_CONTEXT(ctx);
1683 int64_t v[3];
1684 v[0] = v0;
1685 v[1] = v1;
1686 v[2] = v2;
1687 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 3);
1688 }
1689
1690 void GLAPIENTRY
1691 _mesa_Uniform4i64ARB(GLint location, GLint64 v0, GLint64 v1, GLint64 v2, GLint64 v3)
1692 {
1693 GET_CURRENT_CONTEXT(ctx);
1694 int64_t v[4];
1695 v[0] = v0;
1696 v[1] = v1;
1697 v[2] = v2;
1698 v[3] = v3;
1699 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 4);
1700 }
1701
1702 void GLAPIENTRY
1703 _mesa_Uniform1i64vARB(GLint location, GLsizei count, const GLint64 *value)
1704 {
1705 GET_CURRENT_CONTEXT(ctx);
1706 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 1);
1707 }
1708
1709 void GLAPIENTRY
1710 _mesa_Uniform2i64vARB(GLint location, GLsizei count, const GLint64 *value)
1711 {
1712 GET_CURRENT_CONTEXT(ctx);
1713 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 2);
1714 }
1715
1716 void GLAPIENTRY
1717 _mesa_Uniform3i64vARB(GLint location, GLsizei count, const GLint64 *value)
1718 {
1719 GET_CURRENT_CONTEXT(ctx);
1720 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 3);
1721 }
1722
1723 void GLAPIENTRY
1724 _mesa_Uniform4i64vARB(GLint location, GLsizei count, const GLint64 *value)
1725 {
1726 GET_CURRENT_CONTEXT(ctx);
1727 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 4);
1728 }
1729
1730 void GLAPIENTRY
1731 _mesa_Uniform1ui64ARB(GLint location, GLuint64 v0)
1732 {
1733 GET_CURRENT_CONTEXT(ctx);
1734 _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 1);
1735 }
1736
1737 void GLAPIENTRY
1738 _mesa_Uniform2ui64ARB(GLint location, GLuint64 v0, GLuint64 v1)
1739 {
1740 GET_CURRENT_CONTEXT(ctx);
1741 uint64_t v[2];
1742 v[0] = v0;
1743 v[1] = v1;
1744 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 2);
1745 }
1746
1747 void GLAPIENTRY
1748 _mesa_Uniform3ui64ARB(GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2)
1749 {
1750 GET_CURRENT_CONTEXT(ctx);
1751 uint64_t v[3];
1752 v[0] = v0;
1753 v[1] = v1;
1754 v[2] = v2;
1755 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 3);
1756 }
1757
1758 void GLAPIENTRY
1759 _mesa_Uniform4ui64ARB(GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2, GLuint64 v3)
1760 {
1761 GET_CURRENT_CONTEXT(ctx);
1762 uint64_t v[4];
1763 v[0] = v0;
1764 v[1] = v1;
1765 v[2] = v2;
1766 v[3] = v3;
1767 _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 4);
1768 }
1769
1770 void GLAPIENTRY
1771 _mesa_Uniform1ui64vARB(GLint location, GLsizei count, const GLuint64 *value)
1772 {
1773 GET_CURRENT_CONTEXT(ctx);
1774 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 1);
1775 }
1776
1777 void GLAPIENTRY
1778 _mesa_Uniform2ui64vARB(GLint location, GLsizei count, const GLuint64 *value)
1779 {
1780 GET_CURRENT_CONTEXT(ctx);
1781 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 2);
1782 }
1783
1784 void GLAPIENTRY
1785 _mesa_Uniform3ui64vARB(GLint location, GLsizei count, const GLuint64 *value)
1786 {
1787 GET_CURRENT_CONTEXT(ctx);
1788 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 3);
1789 }
1790
1791 void GLAPIENTRY
1792 _mesa_Uniform4ui64vARB(GLint location, GLsizei count, const GLuint64 *value)
1793 {
1794 GET_CURRENT_CONTEXT(ctx);
1795 _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 4);
1796 }
1797
1798 /* DSA entrypoints */
1799 void GLAPIENTRY
1800 _mesa_ProgramUniform1i64ARB(GLuint program, GLint location, GLint64 v0)
1801 {
1802 GET_CURRENT_CONTEXT(ctx);
1803 struct gl_shader_program *shProg =
1804 _mesa_lookup_shader_program_err(ctx, program,
1805 "glProgramUniform1i64ARB");
1806 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_INT64, 1);
1807 }
1808
1809 void GLAPIENTRY
1810 _mesa_ProgramUniform2i64ARB(GLuint program, GLint location, GLint64 v0, GLint64 v1)
1811 {
1812 GET_CURRENT_CONTEXT(ctx);
1813 struct gl_shader_program *shProg =
1814 _mesa_lookup_shader_program_err(ctx, program,
1815 "glProgramUniform2i64ARB");
1816 int64_t v[2];
1817 v[0] = v0;
1818 v[1] = v1;
1819 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 2);
1820 }
1821
1822 void GLAPIENTRY
1823 _mesa_ProgramUniform3i64ARB(GLuint program, GLint location, GLint64 v0, GLint64 v1, GLint64 v2)
1824 {
1825 GET_CURRENT_CONTEXT(ctx);
1826 struct gl_shader_program *shProg =
1827 _mesa_lookup_shader_program_err(ctx, program,
1828 "glProgramUniform3i64ARB");
1829 int64_t v[3];
1830 v[0] = v0;
1831 v[1] = v1;
1832 v[2] = v2;
1833 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 3);
1834 }
1835
1836 void GLAPIENTRY
1837 _mesa_ProgramUniform4i64ARB(GLuint program, GLint location, GLint64 v0, GLint64 v1, GLint64 v2, GLint64 v3)
1838 {
1839 GET_CURRENT_CONTEXT(ctx);
1840 struct gl_shader_program *shProg =
1841 _mesa_lookup_shader_program_err(ctx, program,
1842 "glProgramUniform4i64ARB");
1843 int64_t v[4];
1844 v[0] = v0;
1845 v[1] = v1;
1846 v[2] = v2;
1847 v[3] = v3;
1848 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 4);
1849 }
1850
1851 void GLAPIENTRY
1852 _mesa_ProgramUniform1i64vARB(GLuint program, GLint location, GLsizei count, const GLint64 *value)
1853 {
1854 GET_CURRENT_CONTEXT(ctx);
1855 struct gl_shader_program *shProg =
1856 _mesa_lookup_shader_program_err(ctx, program,
1857 "glProgramUniform1i64vARB");
1858 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 1);
1859 }
1860
1861 void GLAPIENTRY
1862 _mesa_ProgramUniform2i64vARB(GLuint program, GLint location, GLsizei count, const GLint64 *value)
1863 {
1864 GET_CURRENT_CONTEXT(ctx);
1865 struct gl_shader_program *shProg =
1866 _mesa_lookup_shader_program_err(ctx, program,
1867 "glProgramUniform2i64vARB");
1868 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 2);
1869 }
1870
1871 void GLAPIENTRY
1872 _mesa_ProgramUniform3i64vARB(GLuint program, GLint location, GLsizei count, const GLint64 *value)
1873 {
1874 GET_CURRENT_CONTEXT(ctx);
1875 struct gl_shader_program *shProg =
1876 _mesa_lookup_shader_program_err(ctx, program,
1877 "glProgramUniform3i64vARB");
1878 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 3);
1879 }
1880
1881 void GLAPIENTRY
1882 _mesa_ProgramUniform4i64vARB(GLuint program, GLint location, GLsizei count, const GLint64 *value)
1883 {
1884 GET_CURRENT_CONTEXT(ctx);
1885 struct gl_shader_program *shProg =
1886 _mesa_lookup_shader_program_err(ctx, program,
1887 "glProgramUniform4i64vARB");
1888 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 4);
1889 }
1890
1891 void GLAPIENTRY
1892 _mesa_ProgramUniform1ui64ARB(GLuint program, GLint location, GLuint64 v0)
1893 {
1894 GET_CURRENT_CONTEXT(ctx);
1895 struct gl_shader_program *shProg =
1896 _mesa_lookup_shader_program_err(ctx, program,
1897 "glProgramUniform1ui64ARB");
1898 _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_UINT64, 1);
1899 }
1900
1901 void GLAPIENTRY
1902 _mesa_ProgramUniform2ui64ARB(GLuint program, GLint location, GLuint64 v0, GLuint64 v1)
1903 {
1904 GET_CURRENT_CONTEXT(ctx);
1905 struct gl_shader_program *shProg =
1906 _mesa_lookup_shader_program_err(ctx, program,
1907 "glProgramUniform2ui64ARB");
1908 uint64_t v[2];
1909 v[0] = v0;
1910 v[1] = v1;
1911 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 2);
1912 }
1913
1914 void GLAPIENTRY
1915 _mesa_ProgramUniform3ui64ARB(GLuint program, GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2)
1916 {
1917 GET_CURRENT_CONTEXT(ctx);
1918 struct gl_shader_program *shProg =
1919 _mesa_lookup_shader_program_err(ctx, program,
1920 "glProgramUniform3ui64ARB");
1921 uint64_t v[3];
1922 v[0] = v0;
1923 v[1] = v1;
1924 v[2] = v2;
1925 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 3);
1926 }
1927
1928 void GLAPIENTRY
1929 _mesa_ProgramUniform4ui64ARB(GLuint program, GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2, GLuint64 v3)
1930 {
1931 GET_CURRENT_CONTEXT(ctx);
1932 struct gl_shader_program *shProg =
1933 _mesa_lookup_shader_program_err(ctx, program,
1934 "glProgramUniform4ui64ARB");
1935 uint64_t v[4];
1936 v[0] = v0;
1937 v[1] = v1;
1938 v[2] = v2;
1939 v[3] = v3;
1940 _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 4);
1941 }
1942
1943 void GLAPIENTRY
1944 _mesa_ProgramUniform1ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64 *value)
1945 {
1946 GET_CURRENT_CONTEXT(ctx);
1947 struct gl_shader_program *shProg =
1948 _mesa_lookup_shader_program_err(ctx, program,
1949 "glProgramUniform1ui64vARB");
1950 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 1);
1951 }
1952
1953 void GLAPIENTRY
1954 _mesa_ProgramUniform2ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64 *value)
1955 {
1956 GET_CURRENT_CONTEXT(ctx);
1957 struct gl_shader_program *shProg =
1958 _mesa_lookup_shader_program_err(ctx, program,
1959 "glProgramUniform2ui64vARB");
1960 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 2);
1961 }
1962
1963 void GLAPIENTRY
1964 _mesa_ProgramUniform3ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64 *value)
1965 {
1966 GET_CURRENT_CONTEXT(ctx);
1967 struct gl_shader_program *shProg =
1968 _mesa_lookup_shader_program_err(ctx, program,
1969 "glProgramUniform3ui64vARB");
1970 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 3);
1971 }
1972
1973 void GLAPIENTRY
1974 _mesa_ProgramUniform4ui64vARB(GLuint program, GLint location, GLsizei count, const GLuint64 *value)
1975 {
1976 GET_CURRENT_CONTEXT(ctx);
1977 struct gl_shader_program *shProg =
1978 _mesa_lookup_shader_program_err(ctx, program,
1979 "glProgramUniform4ui64vARB");
1980 _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 4);
1981 }