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