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