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