13464ebd5Sriastradh/*
23464ebd5Sriastradh * Mesa 3-D graphics library
33464ebd5Sriastradh *
43464ebd5Sriastradh * Copyright (C) 2004-2008  Brian Paul   All Rights Reserved.
53464ebd5Sriastradh * Copyright (C) 2009-2010  VMware, Inc.  All Rights Reserved.
63464ebd5Sriastradh * Copyright © 2010 Intel Corporation
73464ebd5Sriastradh *
83464ebd5Sriastradh * Permission is hereby granted, free of charge, to any person obtaining a
93464ebd5Sriastradh * copy of this software and associated documentation files (the "Software"),
103464ebd5Sriastradh * to deal in the Software without restriction, including without limitation
113464ebd5Sriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense,
123464ebd5Sriastradh * and/or sell copies of the Software, and to permit persons to whom the
133464ebd5Sriastradh * Software is furnished to do so, subject to the following conditions:
143464ebd5Sriastradh *
153464ebd5Sriastradh * The above copyright notice and this permission notice shall be included
163464ebd5Sriastradh * in all copies or substantial portions of the Software.
173464ebd5Sriastradh *
183464ebd5Sriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
193464ebd5Sriastradh * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
203464ebd5Sriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE.
253464ebd5Sriastradh */
263464ebd5Sriastradh
273464ebd5Sriastradh/**
283464ebd5Sriastradh * \file uniforms.c
293464ebd5Sriastradh * Functions related to GLSL uniform variables.
303464ebd5Sriastradh * \author Brian Paul
313464ebd5Sriastradh */
323464ebd5Sriastradh
333464ebd5Sriastradh/**
343464ebd5Sriastradh * XXX things to do:
353464ebd5Sriastradh * 1. Check that the right error code is generated for all _mesa_error() calls.
363464ebd5Sriastradh * 2. Insert FLUSH_VERTICES calls in various places
373464ebd5Sriastradh */
383464ebd5Sriastradh
393464ebd5Sriastradh#include "main/glheader.h"
403464ebd5Sriastradh#include "main/context.h"
413464ebd5Sriastradh#include "main/shaderapi.h"
423464ebd5Sriastradh#include "main/shaderobj.h"
433464ebd5Sriastradh#include "main/uniforms.h"
44af69d88dSmrg#include "main/enums.h"
4501e04c3fSmrg#include "compiler/glsl/ir_uniform.h"
4601e04c3fSmrg#include "compiler/glsl_types.h"
47af69d88dSmrg#include "program/program.h"
4801e04c3fSmrg#include "util/bitscan.h"
493464ebd5Sriastradh
503464ebd5Sriastradh/**
513464ebd5Sriastradh * Update the vertex/fragment program's TexturesUsed array.
523464ebd5Sriastradh *
533464ebd5Sriastradh * This needs to be called after glUniform(set sampler var) is called.
543464ebd5Sriastradh * A call to glUniform(samplerVar, value) causes a sampler to point to a
553464ebd5Sriastradh * particular texture unit.  We know the sampler's texture target
563464ebd5Sriastradh * (1D/2D/3D/etc) from compile time but the sampler's texture unit is
573464ebd5Sriastradh * set by glUniform() calls.
583464ebd5Sriastradh *
593464ebd5Sriastradh * So, scan the program->SamplerUnits[] and program->SamplerTargets[]
603464ebd5Sriastradh * information to update the prog->TexturesUsed[] values.
613464ebd5Sriastradh * Each value of TexturesUsed[unit] is one of zero, TEXTURE_1D_INDEX,
623464ebd5Sriastradh * TEXTURE_2D_INDEX, TEXTURE_3D_INDEX, etc.
633464ebd5Sriastradh * We'll use that info for state validation before rendering.
643464ebd5Sriastradh */
6501e04c3fSmrgstatic inline void
6601e04c3fSmrgupdate_single_shader_texture_used(struct gl_shader_program *shProg,
6701e04c3fSmrg                                  struct gl_program *prog,
6801e04c3fSmrg                                  GLuint unit, GLuint target)
6901e04c3fSmrg{
7001e04c3fSmrg   gl_shader_stage prog_stage =
7101e04c3fSmrg      _mesa_program_enum_to_shader_stage(prog->Target);
7201e04c3fSmrg
7301e04c3fSmrg   assert(unit < ARRAY_SIZE(prog->TexturesUsed));
7401e04c3fSmrg   assert(target < NUM_TEXTURE_TARGETS);
7501e04c3fSmrg
7601e04c3fSmrg   /* From section 7.10 (Samplers) of the OpenGL 4.5 spec:
7701e04c3fSmrg    *
7801e04c3fSmrg    * "It is not allowed to have variables of different sampler types pointing
7901e04c3fSmrg    *  to the same texture image unit within a program object."
8001e04c3fSmrg    */
8101e04c3fSmrg   unsigned stages_mask = shProg->data->linked_stages;
8201e04c3fSmrg   while (stages_mask) {
8301e04c3fSmrg      const int stage = u_bit_scan(&stages_mask);
8401e04c3fSmrg
8501e04c3fSmrg      /* Skip validation if we are yet to update textures used in this
8601e04c3fSmrg       * stage.
8701e04c3fSmrg       */
8801e04c3fSmrg      if (prog_stage < stage)
8901e04c3fSmrg         break;
9001e04c3fSmrg
9101e04c3fSmrg      struct gl_program *glprog = shProg->_LinkedShaders[stage]->Program;
9201e04c3fSmrg      if (glprog->TexturesUsed[unit] & ~(1 << target))
9301e04c3fSmrg         shProg->SamplersValidated = GL_FALSE;
9401e04c3fSmrg   }
9501e04c3fSmrg
9601e04c3fSmrg   prog->TexturesUsed[unit] |= (1 << target);
9701e04c3fSmrg}
9801e04c3fSmrg
993464ebd5Sriastradhvoid
100af69d88dSmrg_mesa_update_shader_textures_used(struct gl_shader_program *shProg,
10101e04c3fSmrg                                  struct gl_program *prog)
1023464ebd5Sriastradh{
10301e04c3fSmrg   GLbitfield mask = prog->SamplersUsed;
1047ec681f3Smrg   ASSERTED gl_shader_stage prog_stage =
10501e04c3fSmrg      _mesa_program_enum_to_shader_stage(prog->Target);
1063464ebd5Sriastradh   GLuint s;
107af69d88dSmrg
1087ec681f3Smrg   assert(shProg->_LinkedShaders[prog_stage]);
1093464ebd5Sriastradh
1103464ebd5Sriastradh   memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
1113464ebd5Sriastradh
11201e04c3fSmrg   while (mask) {
11301e04c3fSmrg      s = u_bit_scan(&mask);
11401e04c3fSmrg
11501e04c3fSmrg      update_single_shader_texture_used(shProg, prog,
11601e04c3fSmrg                                        prog->SamplerUnits[s],
11701e04c3fSmrg                                        prog->sh.SamplerTargets[s]);
11801e04c3fSmrg   }
11901e04c3fSmrg
12001e04c3fSmrg   if (unlikely(prog->sh.HasBoundBindlessSampler)) {
12101e04c3fSmrg      /* Loop over bindless samplers bound to texture units.
12201e04c3fSmrg       */
12301e04c3fSmrg      for (s = 0; s < prog->sh.NumBindlessSamplers; s++) {
12401e04c3fSmrg         struct gl_bindless_sampler *sampler = &prog->sh.BindlessSamplers[s];
12501e04c3fSmrg
12601e04c3fSmrg         if (!sampler->bound)
12701e04c3fSmrg            continue;
12801e04c3fSmrg
12901e04c3fSmrg         update_single_shader_texture_used(shProg, prog, sampler->unit,
13001e04c3fSmrg                                           sampler->target);
1313464ebd5Sriastradh      }
1323464ebd5Sriastradh   }
1333464ebd5Sriastradh}
1343464ebd5Sriastradh
1353464ebd5Sriastradh/**
136af69d88dSmrg * Connect a piece of driver storage with a part of a uniform
137af69d88dSmrg *
138af69d88dSmrg * \param uni            The uniform with which the storage will be associated
139af69d88dSmrg * \param element_stride Byte-stride between array elements.
140af69d88dSmrg *                       \sa gl_uniform_driver_storage::element_stride.
141af69d88dSmrg * \param vector_stride  Byte-stride between vectors (in a matrix).
142af69d88dSmrg *                       \sa gl_uniform_driver_storage::vector_stride.
143af69d88dSmrg * \param format         Conversion from native format to driver format
144af69d88dSmrg *                       required by the driver.
145af69d88dSmrg * \param data           Location to dump the data.
1463464ebd5Sriastradh */
147af69d88dSmrgvoid
148af69d88dSmrg_mesa_uniform_attach_driver_storage(struct gl_uniform_storage *uni,
149af69d88dSmrg				    unsigned element_stride,
150af69d88dSmrg				    unsigned vector_stride,
151af69d88dSmrg				    enum gl_uniform_driver_format format,
152af69d88dSmrg				    void *data)
1533464ebd5Sriastradh{
154af69d88dSmrg   uni->driver_storage =
155af69d88dSmrg      realloc(uni->driver_storage,
156af69d88dSmrg	      sizeof(struct gl_uniform_driver_storage)
157af69d88dSmrg	      * (uni->num_driver_storage + 1));
1583464ebd5Sriastradh
159af69d88dSmrg   uni->driver_storage[uni->num_driver_storage].element_stride = element_stride;
160af69d88dSmrg   uni->driver_storage[uni->num_driver_storage].vector_stride = vector_stride;
161af69d88dSmrg   uni->driver_storage[uni->num_driver_storage].format = format;
162af69d88dSmrg   uni->driver_storage[uni->num_driver_storage].data = data;
1633464ebd5Sriastradh
164af69d88dSmrg   uni->num_driver_storage++;
1653464ebd5Sriastradh}
1663464ebd5Sriastradh
1673464ebd5Sriastradh/**
168af69d88dSmrg * Sever all connections with all pieces of driver storage for all uniforms
169af69d88dSmrg *
170af69d88dSmrg * \warning
171af69d88dSmrg * This function does \b not release any of the \c data pointers
172af69d88dSmrg * previously passed in to \c _mesa_uniform_attach_driver_stoarge.
1733464ebd5Sriastradh */
174af69d88dSmrgvoid
175af69d88dSmrg_mesa_uniform_detach_all_driver_storage(struct gl_uniform_storage *uni)
1763464ebd5Sriastradh{
177af69d88dSmrg   free(uni->driver_storage);
178af69d88dSmrg   uni->driver_storage = NULL;
179af69d88dSmrg   uni->num_driver_storage = 0;
1803464ebd5Sriastradh}
1813464ebd5Sriastradh
182af69d88dSmrgvoid GLAPIENTRY
183af69d88dSmrg_mesa_Uniform1f(GLint location, GLfloat v0)
1843464ebd5Sriastradh{
185af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
18601e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 1);
1873464ebd5Sriastradh}
1883464ebd5Sriastradh
189af69d88dSmrgvoid GLAPIENTRY
190af69d88dSmrg_mesa_Uniform2f(GLint location, GLfloat v0, GLfloat v1)
191af69d88dSmrg{
192af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
193af69d88dSmrg   GLfloat v[2];
194af69d88dSmrg   v[0] = v0;
195af69d88dSmrg   v[1] = v1;
19601e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 2);
1973464ebd5Sriastradh}
1983464ebd5Sriastradh
199af69d88dSmrgvoid GLAPIENTRY
200af69d88dSmrg_mesa_Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
2013464ebd5Sriastradh{
202af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
203af69d88dSmrg   GLfloat v[3];
204af69d88dSmrg   v[0] = v0;
205af69d88dSmrg   v[1] = v1;
206af69d88dSmrg   v[2] = v2;
20701e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 3);
208af69d88dSmrg}
2093464ebd5Sriastradh
210af69d88dSmrgvoid GLAPIENTRY
211af69d88dSmrg_mesa_Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
212af69d88dSmrg                   GLfloat v3)
213af69d88dSmrg{
214af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
215af69d88dSmrg   GLfloat v[4];
216af69d88dSmrg   v[0] = v0;
217af69d88dSmrg   v[1] = v1;
218af69d88dSmrg   v[2] = v2;
219af69d88dSmrg   v[3] = v3;
22001e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 4);
221af69d88dSmrg}
2223464ebd5Sriastradh
223af69d88dSmrgvoid GLAPIENTRY
224af69d88dSmrg_mesa_Uniform1i(GLint location, GLint v0)
225af69d88dSmrg{
226af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
22701e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 1);
228af69d88dSmrg}
2293464ebd5Sriastradh
230af69d88dSmrgvoid GLAPIENTRY
231af69d88dSmrg_mesa_Uniform2i(GLint location, GLint v0, GLint v1)
232af69d88dSmrg{
233af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
234af69d88dSmrg   GLint v[2];
235af69d88dSmrg   v[0] = v0;
236af69d88dSmrg   v[1] = v1;
23701e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 2);
238af69d88dSmrg}
2393464ebd5Sriastradh
240af69d88dSmrgvoid GLAPIENTRY
241af69d88dSmrg_mesa_Uniform3i(GLint location, GLint v0, GLint v1, GLint v2)
242af69d88dSmrg{
243af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
244af69d88dSmrg   GLint v[3];
245af69d88dSmrg   v[0] = v0;
246af69d88dSmrg   v[1] = v1;
247af69d88dSmrg   v[2] = v2;
24801e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 3);
249af69d88dSmrg}
2503464ebd5Sriastradh
251af69d88dSmrgvoid GLAPIENTRY
252af69d88dSmrg_mesa_Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
253af69d88dSmrg{
254af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
255af69d88dSmrg   GLint v[4];
256af69d88dSmrg   v[0] = v0;
257af69d88dSmrg   v[1] = v1;
258af69d88dSmrg   v[2] = v2;
259af69d88dSmrg   v[3] = v3;
26001e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 4);
261af69d88dSmrg}
2623464ebd5Sriastradh
263af69d88dSmrgvoid GLAPIENTRY
264af69d88dSmrg_mesa_Uniform1fv(GLint location, GLsizei count, const GLfloat * value)
265af69d88dSmrg{
266af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
26701e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 1);
268af69d88dSmrg}
2693464ebd5Sriastradh
270af69d88dSmrgvoid GLAPIENTRY
271af69d88dSmrg_mesa_Uniform2fv(GLint location, GLsizei count, const GLfloat * value)
272af69d88dSmrg{
273af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
27401e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 2);
275af69d88dSmrg}
2763464ebd5Sriastradh
277af69d88dSmrgvoid GLAPIENTRY
278af69d88dSmrg_mesa_Uniform3fv(GLint location, GLsizei count, const GLfloat * value)
279af69d88dSmrg{
280af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
28101e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 3);
282af69d88dSmrg}
2833464ebd5Sriastradh
284af69d88dSmrgvoid GLAPIENTRY
285af69d88dSmrg_mesa_Uniform4fv(GLint location, GLsizei count, const GLfloat * value)
286af69d88dSmrg{
287af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
28801e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 4);
289af69d88dSmrg}
2903464ebd5Sriastradh
291af69d88dSmrgvoid GLAPIENTRY
292af69d88dSmrg_mesa_Uniform1iv(GLint location, GLsizei count, const GLint * value)
293af69d88dSmrg{
294af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
29501e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 1);
296af69d88dSmrg}
2973464ebd5Sriastradh
298af69d88dSmrgvoid GLAPIENTRY
299af69d88dSmrg_mesa_Uniform2iv(GLint location, GLsizei count, const GLint * value)
300af69d88dSmrg{
301af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
30201e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 2);
303af69d88dSmrg}
3043464ebd5Sriastradh
305af69d88dSmrgvoid GLAPIENTRY
306af69d88dSmrg_mesa_Uniform3iv(GLint location, GLsizei count, const GLint * value)
307af69d88dSmrg{
308af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
30901e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 3);
3103464ebd5Sriastradh}
3113464ebd5Sriastradh
312af69d88dSmrgvoid GLAPIENTRY
313af69d88dSmrg_mesa_Uniform4iv(GLint location, GLsizei count, const GLint * value)
314af69d88dSmrg{
315af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
31601e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 4);
31701e04c3fSmrg}
31801e04c3fSmrg
31901e04c3fSmrgvoid GLAPIENTRY
32001e04c3fSmrg_mesa_UniformHandleui64ARB(GLint location, GLuint64 value)
32101e04c3fSmrg{
32201e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
32301e04c3fSmrg   _mesa_uniform_handle(location, 1, &value, ctx, ctx->_Shader->ActiveProgram);
32401e04c3fSmrg}
32501e04c3fSmrg
32601e04c3fSmrgvoid GLAPIENTRY
32701e04c3fSmrg_mesa_UniformHandleui64vARB(GLint location, GLsizei count,
32801e04c3fSmrg                            const GLuint64 *value)
32901e04c3fSmrg{
33001e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
33101e04c3fSmrg   _mesa_uniform_handle(location, count, value, ctx,
33201e04c3fSmrg                        ctx->_Shader->ActiveProgram);
333af69d88dSmrg}
3343464ebd5Sriastradh
33501e04c3fSmrg
336af69d88dSmrg/** Same as above with direct state access **/
3373464ebd5Sriastradhvoid GLAPIENTRY
338af69d88dSmrg_mesa_ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
3393464ebd5Sriastradh{
3403464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
341af69d88dSmrg   struct gl_shader_program *shProg =
342af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
343af69d88dSmrg            "glProgramUniform1f");
34401e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_FLOAT, 1);
3453464ebd5Sriastradh}
3463464ebd5Sriastradh
3473464ebd5Sriastradhvoid GLAPIENTRY
348af69d88dSmrg_mesa_ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
3493464ebd5Sriastradh{
3503464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
3513464ebd5Sriastradh   GLfloat v[2];
352af69d88dSmrg   struct gl_shader_program *shProg;
3533464ebd5Sriastradh   v[0] = v0;
3543464ebd5Sriastradh   v[1] = v1;
355af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2f");
35601e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 2);
3573464ebd5Sriastradh}
3583464ebd5Sriastradh
3593464ebd5Sriastradhvoid GLAPIENTRY
360af69d88dSmrg_mesa_ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1,
361af69d88dSmrg                       GLfloat v2)
3623464ebd5Sriastradh{
3633464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
3643464ebd5Sriastradh   GLfloat v[3];
365af69d88dSmrg   struct gl_shader_program *shProg;
3663464ebd5Sriastradh   v[0] = v0;
3673464ebd5Sriastradh   v[1] = v1;
3683464ebd5Sriastradh   v[2] = v2;
369af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3f");
37001e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 3);
3713464ebd5Sriastradh}
3723464ebd5Sriastradh
3733464ebd5Sriastradhvoid GLAPIENTRY
374af69d88dSmrg_mesa_ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1,
375af69d88dSmrg                       GLfloat v2, GLfloat v3)
3763464ebd5Sriastradh{
3773464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
3783464ebd5Sriastradh   GLfloat v[4];
379af69d88dSmrg   struct gl_shader_program *shProg;
3803464ebd5Sriastradh   v[0] = v0;
3813464ebd5Sriastradh   v[1] = v1;
3823464ebd5Sriastradh   v[2] = v2;
3833464ebd5Sriastradh   v[3] = v3;
384af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4f");
38501e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 4);
3863464ebd5Sriastradh}
3873464ebd5Sriastradh
3883464ebd5Sriastradhvoid GLAPIENTRY
389af69d88dSmrg_mesa_ProgramUniform1i(GLuint program, GLint location, GLint v0)
3903464ebd5Sriastradh{
3913464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
392af69d88dSmrg   struct gl_shader_program *shProg =
393af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
394af69d88dSmrg            "glProgramUniform1i");
39501e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_INT, 1);
3963464ebd5Sriastradh}
3973464ebd5Sriastradh
3983464ebd5Sriastradhvoid GLAPIENTRY
399af69d88dSmrg_mesa_ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
4003464ebd5Sriastradh{
4013464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
4023464ebd5Sriastradh   GLint v[2];
403af69d88dSmrg   struct gl_shader_program *shProg;
4043464ebd5Sriastradh   v[0] = v0;
4053464ebd5Sriastradh   v[1] = v1;
406af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2i");
40701e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 2);
4083464ebd5Sriastradh}
4093464ebd5Sriastradh
4103464ebd5Sriastradhvoid GLAPIENTRY
411af69d88dSmrg_mesa_ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1,
412af69d88dSmrg                       GLint v2)
4133464ebd5Sriastradh{
4143464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
4153464ebd5Sriastradh   GLint v[3];
416af69d88dSmrg   struct gl_shader_program *shProg;
4173464ebd5Sriastradh   v[0] = v0;
4183464ebd5Sriastradh   v[1] = v1;
4193464ebd5Sriastradh   v[2] = v2;
420af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3i");
42101e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 3);
4223464ebd5Sriastradh}
4233464ebd5Sriastradh
4243464ebd5Sriastradhvoid GLAPIENTRY
425af69d88dSmrg_mesa_ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1,
426af69d88dSmrg                       GLint v2, GLint v3)
4273464ebd5Sriastradh{
4283464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
4293464ebd5Sriastradh   GLint v[4];
430af69d88dSmrg   struct gl_shader_program *shProg;
4313464ebd5Sriastradh   v[0] = v0;
4323464ebd5Sriastradh   v[1] = v1;
4333464ebd5Sriastradh   v[2] = v2;
4343464ebd5Sriastradh   v[3] = v3;
435af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4i");
43601e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 4);
4373464ebd5Sriastradh}
4383464ebd5Sriastradh
4393464ebd5Sriastradhvoid GLAPIENTRY
440af69d88dSmrg_mesa_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
441af69d88dSmrg                        const GLfloat * value)
4423464ebd5Sriastradh{
4433464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
444af69d88dSmrg   struct gl_shader_program *shProg =
445af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
446af69d88dSmrg            "glProgramUniform1fv");
44701e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 1);
4483464ebd5Sriastradh}
4493464ebd5Sriastradh
4503464ebd5Sriastradhvoid GLAPIENTRY
451af69d88dSmrg_mesa_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
452af69d88dSmrg                        const GLfloat * value)
4533464ebd5Sriastradh{
4543464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
455af69d88dSmrg   struct gl_shader_program *shProg =
456af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
457af69d88dSmrg            "glProgramUniform2fv");
45801e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 2);
4593464ebd5Sriastradh}
4603464ebd5Sriastradh
4613464ebd5Sriastradhvoid GLAPIENTRY
462af69d88dSmrg_mesa_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
463af69d88dSmrg                        const GLfloat * value)
4643464ebd5Sriastradh{
4653464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
466af69d88dSmrg   struct gl_shader_program *shProg =
467af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
468af69d88dSmrg            "glProgramUniform3fv");
46901e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 3);
4703464ebd5Sriastradh}
4713464ebd5Sriastradh
4723464ebd5Sriastradhvoid GLAPIENTRY
473af69d88dSmrg_mesa_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
474af69d88dSmrg                        const GLfloat * value)
4753464ebd5Sriastradh{
4763464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
477af69d88dSmrg   struct gl_shader_program *shProg =
478af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
479af69d88dSmrg            "glProgramUniform4fv");
48001e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 4);
4813464ebd5Sriastradh}
4823464ebd5Sriastradh
4833464ebd5Sriastradhvoid GLAPIENTRY
484af69d88dSmrg_mesa_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
485af69d88dSmrg                        const GLint * value)
486af69d88dSmrg{
487af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
488af69d88dSmrg   struct gl_shader_program *shProg =
489af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
490af69d88dSmrg            "glProgramUniform1iv");
49101e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 1);
492af69d88dSmrg}
493af69d88dSmrg
494af69d88dSmrgvoid GLAPIENTRY
495af69d88dSmrg_mesa_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
496af69d88dSmrg                        const GLint * value)
497af69d88dSmrg{
498af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
499af69d88dSmrg   struct gl_shader_program *shProg =
500af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
501af69d88dSmrg            "glProgramUniform2iv");
50201e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 2);
503af69d88dSmrg}
504af69d88dSmrg
505af69d88dSmrgvoid GLAPIENTRY
506af69d88dSmrg_mesa_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
507af69d88dSmrg                        const GLint * value)
508af69d88dSmrg{
509af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
510af69d88dSmrg   struct gl_shader_program *shProg =
511af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
512af69d88dSmrg            "glProgramUniform3iv");
51301e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 3);
514af69d88dSmrg}
515af69d88dSmrg
516af69d88dSmrgvoid GLAPIENTRY
517af69d88dSmrg_mesa_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
518af69d88dSmrg                        const GLint * value)
519af69d88dSmrg{
520af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
521af69d88dSmrg   struct gl_shader_program *shProg =
522af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
523af69d88dSmrg            "glProgramUniform4iv");
52401e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 4);
52501e04c3fSmrg}
52601e04c3fSmrg
52701e04c3fSmrgvoid GLAPIENTRY
52801e04c3fSmrg_mesa_ProgramUniformHandleui64ARB(GLuint program, GLint location,
52901e04c3fSmrg                                  GLuint64 value)
53001e04c3fSmrg{
53101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
53201e04c3fSmrg   struct gl_shader_program *shProg =
53301e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
53401e04c3fSmrg            "glProgramUniformHandleui64ARB");
53501e04c3fSmrg   _mesa_uniform_handle(location, 1, &value, ctx, shProg);
53601e04c3fSmrg}
53701e04c3fSmrg
53801e04c3fSmrgvoid GLAPIENTRY
53901e04c3fSmrg_mesa_ProgramUniformHandleui64vARB(GLuint program, GLint location,
54001e04c3fSmrg                                   GLsizei count, const GLuint64 *values)
54101e04c3fSmrg{
54201e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
54301e04c3fSmrg   struct gl_shader_program *shProg =
54401e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
54501e04c3fSmrg            "glProgramUniformHandleui64vARB");
54601e04c3fSmrg   _mesa_uniform_handle(location, count, values, ctx, shProg);
547af69d88dSmrg}
548af69d88dSmrg
549af69d88dSmrg
550af69d88dSmrg/** OpenGL 3.0 GLuint-valued functions **/
551af69d88dSmrgvoid GLAPIENTRY
552af69d88dSmrg_mesa_Uniform1ui(GLint location, GLuint v0)
553af69d88dSmrg{
554af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
55501e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 1);
556af69d88dSmrg}
557af69d88dSmrg
558af69d88dSmrgvoid GLAPIENTRY
559af69d88dSmrg_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1)
560af69d88dSmrg{
561af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
562af69d88dSmrg   GLuint v[2];
563af69d88dSmrg   v[0] = v0;
564af69d88dSmrg   v[1] = v1;
56501e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 2);
566af69d88dSmrg}
567af69d88dSmrg
568af69d88dSmrgvoid GLAPIENTRY
569af69d88dSmrg_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
570af69d88dSmrg{
571af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
572af69d88dSmrg   GLuint v[3];
573af69d88dSmrg   v[0] = v0;
574af69d88dSmrg   v[1] = v1;
575af69d88dSmrg   v[2] = v2;
57601e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 3);
577af69d88dSmrg}
578af69d88dSmrg
579af69d88dSmrgvoid GLAPIENTRY
580af69d88dSmrg_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
581af69d88dSmrg{
582af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
583af69d88dSmrg   GLuint v[4];
584af69d88dSmrg   v[0] = v0;
585af69d88dSmrg   v[1] = v1;
586af69d88dSmrg   v[2] = v2;
587af69d88dSmrg   v[3] = v3;
58801e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 4);
589af69d88dSmrg}
590af69d88dSmrg
591af69d88dSmrgvoid GLAPIENTRY
592af69d88dSmrg_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
593af69d88dSmrg{
594af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
59501e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 1);
596af69d88dSmrg}
597af69d88dSmrg
598af69d88dSmrgvoid GLAPIENTRY
599af69d88dSmrg_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
600af69d88dSmrg{
601af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
60201e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 2);
603af69d88dSmrg}
604af69d88dSmrg
605af69d88dSmrgvoid GLAPIENTRY
606af69d88dSmrg_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
607af69d88dSmrg{
608af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
60901e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 3);
610af69d88dSmrg}
611af69d88dSmrg
612af69d88dSmrgvoid GLAPIENTRY
613af69d88dSmrg_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
6143464ebd5Sriastradh{
6153464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
61601e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 4);
6173464ebd5Sriastradh}
6183464ebd5Sriastradh
619af69d88dSmrg
620af69d88dSmrg
6213464ebd5Sriastradhvoid GLAPIENTRY
622af69d88dSmrg_mesa_UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose,
623af69d88dSmrg                          const GLfloat * value)
6243464ebd5Sriastradh{
6253464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
62601e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
62701e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 2, 2, GLSL_TYPE_FLOAT);
6283464ebd5Sriastradh}
6293464ebd5Sriastradh
6303464ebd5Sriastradhvoid GLAPIENTRY
631af69d88dSmrg_mesa_UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose,
632af69d88dSmrg                          const GLfloat * value)
6333464ebd5Sriastradh{
6343464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
63501e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
63601e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 3, 3, GLSL_TYPE_FLOAT);
6373464ebd5Sriastradh}
6383464ebd5Sriastradh
6393464ebd5Sriastradhvoid GLAPIENTRY
640af69d88dSmrg_mesa_UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
641af69d88dSmrg                          const GLfloat * value)
6423464ebd5Sriastradh{
6433464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
64401e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
64501e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 4, 4, GLSL_TYPE_FLOAT);
6463464ebd5Sriastradh}
6473464ebd5Sriastradh
648af69d88dSmrg/** Same as above with direct state access **/
6493464ebd5Sriastradh
6503464ebd5Sriastradhvoid GLAPIENTRY
651af69d88dSmrg_mesa_ProgramUniform1ui(GLuint program, GLint location, GLuint v0)
6523464ebd5Sriastradh{
6533464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
654af69d88dSmrg   struct gl_shader_program *shProg =
655af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
656af69d88dSmrg            "glProgramUniform1ui");
65701e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_UINT, 1);
6583464ebd5Sriastradh}
6593464ebd5Sriastradh
6603464ebd5Sriastradhvoid GLAPIENTRY
661af69d88dSmrg_mesa_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
6623464ebd5Sriastradh{
6633464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
6643464ebd5Sriastradh   GLuint v[2];
665af69d88dSmrg   struct gl_shader_program *shProg;
6663464ebd5Sriastradh   v[0] = v0;
6673464ebd5Sriastradh   v[1] = v1;
668af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program,
669af69d88dSmrg                                            "glProgramUniform2ui");
67001e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 2);
6713464ebd5Sriastradh}
6723464ebd5Sriastradh
6733464ebd5Sriastradhvoid GLAPIENTRY
674af69d88dSmrg_mesa_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1,
675af69d88dSmrg                        GLuint v2)
6763464ebd5Sriastradh{
6773464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
6783464ebd5Sriastradh   GLuint v[3];
679af69d88dSmrg   struct gl_shader_program *shProg;
6803464ebd5Sriastradh   v[0] = v0;
6813464ebd5Sriastradh   v[1] = v1;
6823464ebd5Sriastradh   v[2] = v2;
683af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program,
684af69d88dSmrg                                            "glProgramUniform3ui");
68501e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 3);
6863464ebd5Sriastradh}
6873464ebd5Sriastradh
6883464ebd5Sriastradhvoid GLAPIENTRY
689af69d88dSmrg_mesa_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1,
690af69d88dSmrg                        GLuint v2, GLuint v3)
6913464ebd5Sriastradh{
6923464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
6933464ebd5Sriastradh   GLuint v[4];
694af69d88dSmrg   struct gl_shader_program *shProg;
6953464ebd5Sriastradh   v[0] = v0;
6963464ebd5Sriastradh   v[1] = v1;
6973464ebd5Sriastradh   v[2] = v2;
6983464ebd5Sriastradh   v[3] = v3;
699af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4ui");
70001e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 4);
7013464ebd5Sriastradh}
7023464ebd5Sriastradh
7033464ebd5Sriastradhvoid GLAPIENTRY
704af69d88dSmrg_mesa_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
705af69d88dSmrg                         const GLuint *value)
7063464ebd5Sriastradh{
7073464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
708af69d88dSmrg   struct gl_shader_program *shProg =
709af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
710af69d88dSmrg            "glProgramUniform1uiv");
71101e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 1);
7123464ebd5Sriastradh}
7133464ebd5Sriastradh
7143464ebd5Sriastradhvoid GLAPIENTRY
715af69d88dSmrg_mesa_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
716af69d88dSmrg                         const GLuint *value)
7173464ebd5Sriastradh{
7183464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
719af69d88dSmrg   struct gl_shader_program *shProg =
720af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
721af69d88dSmrg            "glProgramUniform2uiv");
72201e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 2);
7233464ebd5Sriastradh}
7243464ebd5Sriastradh
7253464ebd5Sriastradhvoid GLAPIENTRY
726af69d88dSmrg_mesa_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
727af69d88dSmrg                         const GLuint *value)
7283464ebd5Sriastradh{
7293464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
730af69d88dSmrg   struct gl_shader_program *shProg =
731af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
732af69d88dSmrg            "glProgramUniform3uiv");
73301e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 3);
7343464ebd5Sriastradh}
7353464ebd5Sriastradh
7363464ebd5Sriastradhvoid GLAPIENTRY
737af69d88dSmrg_mesa_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
738af69d88dSmrg                         const GLuint *value)
7393464ebd5Sriastradh{
7403464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
741af69d88dSmrg   struct gl_shader_program *shProg =
742af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
743af69d88dSmrg            "glProgramUniform4uiv");
74401e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 4);
7453464ebd5Sriastradh}
7463464ebd5Sriastradh
7473464ebd5Sriastradh
7483464ebd5Sriastradh
7493464ebd5Sriastradhvoid GLAPIENTRY
750af69d88dSmrg_mesa_ProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count,
751af69d88dSmrg                              GLboolean transpose, const GLfloat * value)
7523464ebd5Sriastradh{
7533464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
754af69d88dSmrg   struct gl_shader_program *shProg =
755af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
756af69d88dSmrg            "glProgramUniformMatrix2fv");
75701e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 2, 2, GLSL_TYPE_FLOAT);
7583464ebd5Sriastradh}
7593464ebd5Sriastradh
7603464ebd5Sriastradhvoid GLAPIENTRY
761af69d88dSmrg_mesa_ProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count,
762af69d88dSmrg                              GLboolean transpose, const GLfloat * value)
7633464ebd5Sriastradh{
7643464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
765af69d88dSmrg   struct gl_shader_program *shProg =
766af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
767af69d88dSmrg            "glProgramUniformMatrix3fv");
76801e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 3, 3, GLSL_TYPE_FLOAT);
7693464ebd5Sriastradh}
7703464ebd5Sriastradh
7713464ebd5Sriastradhvoid GLAPIENTRY
772af69d88dSmrg_mesa_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
773af69d88dSmrg                              GLboolean transpose, const GLfloat * value)
7743464ebd5Sriastradh{
7753464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
776af69d88dSmrg   struct gl_shader_program *shProg =
777af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
778af69d88dSmrg            "glProgramUniformMatrix4fv");
77901e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 4, 4, GLSL_TYPE_FLOAT);
7803464ebd5Sriastradh}
7813464ebd5Sriastradh
7823464ebd5Sriastradh
7833464ebd5Sriastradh/**
7843464ebd5Sriastradh * Non-square UniformMatrix are OpenGL 2.1
7853464ebd5Sriastradh */
7863464ebd5Sriastradhvoid GLAPIENTRY
7873464ebd5Sriastradh_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
7883464ebd5Sriastradh                         const GLfloat *value)
7893464ebd5Sriastradh{
7903464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
79101e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
79201e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 2, 3, GLSL_TYPE_FLOAT);
7933464ebd5Sriastradh}
7943464ebd5Sriastradh
7953464ebd5Sriastradhvoid GLAPIENTRY
7963464ebd5Sriastradh_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
7973464ebd5Sriastradh                         const GLfloat *value)
7983464ebd5Sriastradh{
7993464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
80001e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
80101e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 3, 2, GLSL_TYPE_FLOAT);
8023464ebd5Sriastradh}
8033464ebd5Sriastradh
8043464ebd5Sriastradhvoid GLAPIENTRY
8053464ebd5Sriastradh_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
8063464ebd5Sriastradh                         const GLfloat *value)
8073464ebd5Sriastradh{
8083464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
80901e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
81001e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 2, 4, GLSL_TYPE_FLOAT);
8113464ebd5Sriastradh}
8123464ebd5Sriastradh
8133464ebd5Sriastradhvoid GLAPIENTRY
8143464ebd5Sriastradh_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
8153464ebd5Sriastradh                         const GLfloat *value)
8163464ebd5Sriastradh{
8173464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
81801e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
81901e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 4, 2, GLSL_TYPE_FLOAT);
8203464ebd5Sriastradh}
8213464ebd5Sriastradh
8223464ebd5Sriastradhvoid GLAPIENTRY
8233464ebd5Sriastradh_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
8243464ebd5Sriastradh                         const GLfloat *value)
8253464ebd5Sriastradh{
8263464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
82701e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
82801e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 3, 4, GLSL_TYPE_FLOAT);
8293464ebd5Sriastradh}
8303464ebd5Sriastradh
8313464ebd5Sriastradhvoid GLAPIENTRY
8323464ebd5Sriastradh_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
8333464ebd5Sriastradh                         const GLfloat *value)
8343464ebd5Sriastradh{
8353464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
83601e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
83701e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 4, 3, GLSL_TYPE_FLOAT);
8383464ebd5Sriastradh}
8393464ebd5Sriastradh
840af69d88dSmrg/** Same as above with direct state access **/
841af69d88dSmrg
842af69d88dSmrgvoid GLAPIENTRY
843af69d88dSmrg_mesa_ProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count,
844af69d88dSmrg                                GLboolean transpose, const GLfloat * value)
845af69d88dSmrg{
846af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
847af69d88dSmrg   struct gl_shader_program *shProg =
848af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
849af69d88dSmrg            "glProgramUniformMatrix2x3fv");
85001e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 2, 3, GLSL_TYPE_FLOAT);
851af69d88dSmrg}
852af69d88dSmrg
853af69d88dSmrgvoid GLAPIENTRY
854af69d88dSmrg_mesa_ProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count,
855af69d88dSmrg                                GLboolean transpose, const GLfloat * value)
856af69d88dSmrg{
857af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
858af69d88dSmrg   struct gl_shader_program *shProg =
859af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
860af69d88dSmrg            "glProgramUniformMatrix3x2fv");
86101e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 3, 2, GLSL_TYPE_FLOAT);
862af69d88dSmrg}
863af69d88dSmrg
864af69d88dSmrgvoid GLAPIENTRY
865af69d88dSmrg_mesa_ProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count,
866af69d88dSmrg                                GLboolean transpose, const GLfloat * value)
867af69d88dSmrg{
868af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
869af69d88dSmrg   struct gl_shader_program *shProg =
870af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
871af69d88dSmrg            "glProgramUniformMatrix2x4fv");
87201e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 2, 4, GLSL_TYPE_FLOAT);
873af69d88dSmrg}
874af69d88dSmrg
875af69d88dSmrgvoid GLAPIENTRY
876af69d88dSmrg_mesa_ProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count,
877af69d88dSmrg                                GLboolean transpose, const GLfloat * value)
878af69d88dSmrg{
879af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
880af69d88dSmrg   struct gl_shader_program *shProg =
881af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
882af69d88dSmrg            "glProgramUniformMatrix4x2fv");
88301e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 4, 2, GLSL_TYPE_FLOAT);
884af69d88dSmrg}
885af69d88dSmrg
886af69d88dSmrgvoid GLAPIENTRY
887af69d88dSmrg_mesa_ProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count,
888af69d88dSmrg                                GLboolean transpose, const GLfloat * value)
889af69d88dSmrg{
890af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
891af69d88dSmrg   struct gl_shader_program *shProg =
892af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
893af69d88dSmrg            "glProgramUniformMatrix3x4fv");
89401e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 3, 4, GLSL_TYPE_FLOAT);
895af69d88dSmrg}
896af69d88dSmrg
897af69d88dSmrgvoid GLAPIENTRY
898af69d88dSmrg_mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
899af69d88dSmrg                                GLboolean transpose, const GLfloat * value)
900af69d88dSmrg{
901af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
902af69d88dSmrg   struct gl_shader_program *shProg =
903af69d88dSmrg      _mesa_lookup_shader_program_err(ctx, program,
904af69d88dSmrg            "glProgramUniformMatrix4x3fv");
90501e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value, ctx, shProg, 4, 3, GLSL_TYPE_FLOAT);
906af69d88dSmrg}
907af69d88dSmrg
9083464ebd5Sriastradh
9093464ebd5Sriastradhvoid GLAPIENTRY
910af69d88dSmrg_mesa_GetnUniformfvARB(GLuint program, GLint location,
9113464ebd5Sriastradh                       GLsizei bufSize, GLfloat *params)
9123464ebd5Sriastradh{
9133464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
914af69d88dSmrg   _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_FLOAT, params);
9153464ebd5Sriastradh}
9163464ebd5Sriastradh
9173464ebd5Sriastradhvoid GLAPIENTRY
918af69d88dSmrg_mesa_GetUniformfv(GLuint program, GLint location, GLfloat *params)
9193464ebd5Sriastradh{
9203464ebd5Sriastradh   _mesa_GetnUniformfvARB(program, location, INT_MAX, params);
9213464ebd5Sriastradh}
9223464ebd5Sriastradh
9233464ebd5Sriastradh
9243464ebd5Sriastradhvoid GLAPIENTRY
925af69d88dSmrg_mesa_GetnUniformivARB(GLuint program, GLint location,
9263464ebd5Sriastradh                       GLsizei bufSize, GLint *params)
9273464ebd5Sriastradh{
9283464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
929af69d88dSmrg   _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_INT, params);
9303464ebd5Sriastradh}
9313464ebd5Sriastradh
9323464ebd5Sriastradhvoid GLAPIENTRY
933af69d88dSmrg_mesa_GetUniformiv(GLuint program, GLint location, GLint *params)
9343464ebd5Sriastradh{
9353464ebd5Sriastradh   _mesa_GetnUniformivARB(program, location, INT_MAX, params);
9363464ebd5Sriastradh}
9373464ebd5Sriastradh
9383464ebd5Sriastradh
9393464ebd5Sriastradh/* GL3 */
9403464ebd5Sriastradhvoid GLAPIENTRY
941af69d88dSmrg_mesa_GetnUniformuivARB(GLuint program, GLint location,
9423464ebd5Sriastradh                        GLsizei bufSize, GLuint *params)
9433464ebd5Sriastradh{
9443464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
945af69d88dSmrg   _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_UINT, params);
9463464ebd5Sriastradh}
9473464ebd5Sriastradh
9483464ebd5Sriastradhvoid GLAPIENTRY
949af69d88dSmrg_mesa_GetUniformuiv(GLuint program, GLint location, GLuint *params)
9503464ebd5Sriastradh{
9513464ebd5Sriastradh   _mesa_GetnUniformuivARB(program, location, INT_MAX, params);
9523464ebd5Sriastradh}
9533464ebd5Sriastradh
9543464ebd5Sriastradh
9553464ebd5Sriastradh/* GL4 */
9563464ebd5Sriastradhvoid GLAPIENTRY
957af69d88dSmrg_mesa_GetnUniformdvARB(GLuint program, GLint location,
958af69d88dSmrg                       GLsizei bufSize, GLdouble *params)
9593464ebd5Sriastradh{
9603464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
961af69d88dSmrg
962af69d88dSmrg   _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_DOUBLE, params);
9633464ebd5Sriastradh}
9643464ebd5Sriastradh
9653464ebd5Sriastradhvoid GLAPIENTRY
966af69d88dSmrg_mesa_GetUniformdv(GLuint program, GLint location, GLdouble *params)
9673464ebd5Sriastradh{
9683464ebd5Sriastradh   _mesa_GetnUniformdvARB(program, location, INT_MAX, params);
9693464ebd5Sriastradh}
9703464ebd5Sriastradh
97101e04c3fSmrgvoid GLAPIENTRY
97201e04c3fSmrg_mesa_GetnUniformi64vARB(GLuint program, GLint location,
97301e04c3fSmrg                         GLsizei bufSize, GLint64 *params)
97401e04c3fSmrg{
97501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
97601e04c3fSmrg   _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_INT64, params);
97701e04c3fSmrg}
97801e04c3fSmrgvoid GLAPIENTRY
97901e04c3fSmrg_mesa_GetUniformi64vARB(GLuint program, GLint location, GLint64 *params)
98001e04c3fSmrg{
98101e04c3fSmrg   _mesa_GetnUniformi64vARB(program, location, INT_MAX, params);
98201e04c3fSmrg}
98301e04c3fSmrg
98401e04c3fSmrgvoid GLAPIENTRY
98501e04c3fSmrg_mesa_GetnUniformui64vARB(GLuint program, GLint location,
98601e04c3fSmrg                         GLsizei bufSize, GLuint64 *params)
98701e04c3fSmrg{
98801e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
98901e04c3fSmrg   _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_UINT64, params);
99001e04c3fSmrg}
99101e04c3fSmrg
99201e04c3fSmrgvoid GLAPIENTRY
99301e04c3fSmrg_mesa_GetUniformui64vARB(GLuint program, GLint location, GLuint64 *params)
99401e04c3fSmrg{
99501e04c3fSmrg   _mesa_GetnUniformui64vARB(program, location, INT_MAX, params);
99601e04c3fSmrg}
99701e04c3fSmrg
9983464ebd5Sriastradh
9997ec681f3SmrgGLint
10007ec681f3Smrg_mesa_GetUniformLocation_impl(GLuint programObj, const GLcharARB *name,
10017ec681f3Smrg                              bool glthread)
10023464ebd5Sriastradh{
10033464ebd5Sriastradh   struct gl_shader_program *shProg;
10043464ebd5Sriastradh
10053464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
10063464ebd5Sriastradh
10077ec681f3Smrg   shProg = _mesa_lookup_shader_program_err_glthread(ctx, programObj, glthread,
10087ec681f3Smrg                                                     "glGetUniformLocation");
10097ec681f3Smrg   if (!shProg || !name)
10103464ebd5Sriastradh      return -1;
10113464ebd5Sriastradh
1012af69d88dSmrg   /* Page 80 (page 94 of the PDF) of the OpenGL 2.1 spec says:
1013af69d88dSmrg    *
1014af69d88dSmrg    *     "If program has not been successfully linked, the error
1015af69d88dSmrg    *     INVALID_OPERATION is generated."
1016af69d88dSmrg    */
101701e04c3fSmrg   if (shProg->data->LinkStatus == LINKING_FAILURE) {
10187ec681f3Smrg      _mesa_error_glthread_safe(ctx, GL_INVALID_OPERATION, glthread,
10197ec681f3Smrg                                "glGetUniformLocation(program not linked)");
1020af69d88dSmrg      return -1;
1021af69d88dSmrg   }
1022af69d88dSmrg
102301e04c3fSmrg   return _mesa_program_resource_location(shProg, GL_UNIFORM, name);
102401e04c3fSmrg}
1025af69d88dSmrg
10267ec681f3SmrgGLint GLAPIENTRY
10277ec681f3Smrg_mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
10287ec681f3Smrg{
10297ec681f3Smrg   return _mesa_GetUniformLocation_impl(programObj, name, false);
10307ec681f3Smrg}
10317ec681f3Smrg
103201e04c3fSmrgGLint GLAPIENTRY
103301e04c3fSmrg_mesa_GetUniformLocation_no_error(GLuint programObj, const GLcharARB *name)
103401e04c3fSmrg{
103501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
103601e04c3fSmrg
103701e04c3fSmrg   struct gl_shader_program *shProg =
103801e04c3fSmrg      _mesa_lookup_shader_program(ctx, programObj);
1039af69d88dSmrg
104001e04c3fSmrg   return _mesa_program_resource_location(shProg, GL_UNIFORM, name);
10413464ebd5Sriastradh}
10423464ebd5Sriastradh
1043af69d88dSmrgGLuint GLAPIENTRY
1044af69d88dSmrg_mesa_GetUniformBlockIndex(GLuint program,
1045af69d88dSmrg			   const GLchar *uniformBlockName)
1046af69d88dSmrg{
1047af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
1048af69d88dSmrg   struct gl_shader_program *shProg;
1049af69d88dSmrg
1050af69d88dSmrg   if (!ctx->Extensions.ARB_uniform_buffer_object) {
1051af69d88dSmrg      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformBlockIndex");
1052af69d88dSmrg      return GL_INVALID_INDEX;
1053af69d88dSmrg   }
1054af69d88dSmrg
1055af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program,
1056af69d88dSmrg					    "glGetUniformBlockIndex");
1057af69d88dSmrg   if (!shProg)
1058af69d88dSmrg      return GL_INVALID_INDEX;
1059af69d88dSmrg
106001e04c3fSmrg   struct gl_program_resource *res =
106101e04c3fSmrg      _mesa_program_resource_find_name(shProg, GL_UNIFORM_BLOCK,
106201e04c3fSmrg                                       uniformBlockName, NULL);
106301e04c3fSmrg   if (!res)
106401e04c3fSmrg      return GL_INVALID_INDEX;
1065af69d88dSmrg
106601e04c3fSmrg   return _mesa_program_resource_index(shProg, res);
1067af69d88dSmrg}
10683464ebd5Sriastradh
10693464ebd5Sriastradhvoid GLAPIENTRY
1070af69d88dSmrg_mesa_GetUniformIndices(GLuint program,
1071af69d88dSmrg			GLsizei uniformCount,
1072af69d88dSmrg			const GLchar * const *uniformNames,
1073af69d88dSmrg			GLuint *uniformIndices)
10743464ebd5Sriastradh{
10753464ebd5Sriastradh   GET_CURRENT_CONTEXT(ctx);
1076af69d88dSmrg   GLsizei i;
1077af69d88dSmrg   struct gl_shader_program *shProg;
1078af69d88dSmrg
1079af69d88dSmrg   if (!ctx->Extensions.ARB_uniform_buffer_object) {
1080af69d88dSmrg      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformIndices");
1081af69d88dSmrg      return;
1082af69d88dSmrg   }
1083af69d88dSmrg
1084af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program,
1085af69d88dSmrg					    "glGetUniformIndices");
1086af69d88dSmrg   if (!shProg)
1087af69d88dSmrg      return;
1088af69d88dSmrg
1089af69d88dSmrg   if (uniformCount < 0) {
1090af69d88dSmrg      _mesa_error(ctx, GL_INVALID_VALUE,
1091af69d88dSmrg		  "glGetUniformIndices(uniformCount < 0)");
1092af69d88dSmrg      return;
1093af69d88dSmrg   }
1094af69d88dSmrg
1095af69d88dSmrg   for (i = 0; i < uniformCount; i++) {
109601e04c3fSmrg      struct gl_program_resource *res =
109701e04c3fSmrg         _mesa_program_resource_find_name(shProg, GL_UNIFORM, uniformNames[i],
109801e04c3fSmrg                                          NULL);
109901e04c3fSmrg      uniformIndices[i] = _mesa_program_resource_index(shProg, res);
110001e04c3fSmrg   }
110101e04c3fSmrg}
110201e04c3fSmrg
110301e04c3fSmrgstatic void
110401e04c3fSmrguniform_block_binding(struct gl_context *ctx, struct gl_shader_program *shProg,
110501e04c3fSmrg                      GLuint uniformBlockIndex, GLuint uniformBlockBinding)
110601e04c3fSmrg{
110701e04c3fSmrg   if (shProg->data->UniformBlocks[uniformBlockIndex].Binding !=
110801e04c3fSmrg       uniformBlockBinding) {
110901e04c3fSmrg
11107ec681f3Smrg      FLUSH_VERTICES(ctx, 0, 0);
111101e04c3fSmrg      ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
111201e04c3fSmrg
111301e04c3fSmrg      shProg->data->UniformBlocks[uniformBlockIndex].Binding =
111401e04c3fSmrg         uniformBlockBinding;
1115af69d88dSmrg   }
11163464ebd5Sriastradh}
11173464ebd5Sriastradh
111801e04c3fSmrgvoid GLAPIENTRY
111901e04c3fSmrg_mesa_UniformBlockBinding_no_error(GLuint program, GLuint uniformBlockIndex,
112001e04c3fSmrg                                   GLuint uniformBlockBinding)
112101e04c3fSmrg{
112201e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
112301e04c3fSmrg
112401e04c3fSmrg   struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program);
112501e04c3fSmrg   uniform_block_binding(ctx, shProg, uniformBlockIndex, uniformBlockBinding);
112601e04c3fSmrg}
112701e04c3fSmrg
1128af69d88dSmrgvoid GLAPIENTRY
1129af69d88dSmrg_mesa_UniformBlockBinding(GLuint program,
1130af69d88dSmrg			  GLuint uniformBlockIndex,
1131af69d88dSmrg			  GLuint uniformBlockBinding)
1132af69d88dSmrg{
1133af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
1134af69d88dSmrg   struct gl_shader_program *shProg;
1135af69d88dSmrg
1136af69d88dSmrg   if (!ctx->Extensions.ARB_uniform_buffer_object) {
1137af69d88dSmrg      _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformBlockBinding");
1138af69d88dSmrg      return;
1139af69d88dSmrg   }
1140af69d88dSmrg
1141af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program,
1142af69d88dSmrg					    "glUniformBlockBinding");
1143af69d88dSmrg   if (!shProg)
1144af69d88dSmrg      return;
1145af69d88dSmrg
114601e04c3fSmrg   if (uniformBlockIndex >= shProg->data->NumUniformBlocks) {
1147af69d88dSmrg      _mesa_error(ctx, GL_INVALID_VALUE,
1148af69d88dSmrg		  "glUniformBlockBinding(block index %u >= %u)",
114901e04c3fSmrg                  uniformBlockIndex, shProg->data->NumUniformBlocks);
1150af69d88dSmrg      return;
1151af69d88dSmrg   }
1152af69d88dSmrg
1153af69d88dSmrg   if (uniformBlockBinding >= ctx->Const.MaxUniformBufferBindings) {
1154af69d88dSmrg      _mesa_error(ctx, GL_INVALID_VALUE,
1155af69d88dSmrg		  "glUniformBlockBinding(block binding %u >= %u)",
1156af69d88dSmrg		  uniformBlockBinding, ctx->Const.MaxUniformBufferBindings);
1157af69d88dSmrg      return;
1158af69d88dSmrg   }
1159af69d88dSmrg
116001e04c3fSmrg   uniform_block_binding(ctx, shProg, uniformBlockIndex, uniformBlockBinding);
116101e04c3fSmrg}
116201e04c3fSmrg
116301e04c3fSmrgstatic void
116401e04c3fSmrgshader_storage_block_binding(struct gl_context *ctx,
116501e04c3fSmrg                             struct gl_shader_program *shProg,
116601e04c3fSmrg                             GLuint shaderStorageBlockIndex,
116701e04c3fSmrg                             GLuint shaderStorageBlockBinding)
116801e04c3fSmrg{
116901e04c3fSmrg   if (shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding !=
117001e04c3fSmrg       shaderStorageBlockBinding) {
1171af69d88dSmrg
11727ec681f3Smrg      FLUSH_VERTICES(ctx, 0, 0);
117301e04c3fSmrg      ctx->NewDriverState |= ctx->DriverFlags.NewShaderStorageBuffer;
1174af69d88dSmrg
117501e04c3fSmrg      shProg->data->ShaderStorageBlocks[shaderStorageBlockIndex].Binding =
117601e04c3fSmrg         shaderStorageBlockBinding;
117701e04c3fSmrg   }
117801e04c3fSmrg}
1179af69d88dSmrg
118001e04c3fSmrgvoid GLAPIENTRY
118101e04c3fSmrg_mesa_ShaderStorageBlockBinding_no_error(GLuint program,
118201e04c3fSmrg                                         GLuint shaderStorageBlockIndex,
118301e04c3fSmrg                                         GLuint shaderStorageBlockBinding)
118401e04c3fSmrg{
118501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
1186af69d88dSmrg
118701e04c3fSmrg   struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program);
118801e04c3fSmrg   shader_storage_block_binding(ctx, shProg, shaderStorageBlockIndex,
118901e04c3fSmrg                                shaderStorageBlockBinding);
1190af69d88dSmrg}
1191af69d88dSmrg
1192af69d88dSmrgvoid GLAPIENTRY
119301e04c3fSmrg_mesa_ShaderStorageBlockBinding(GLuint program,
119401e04c3fSmrg			        GLuint shaderStorageBlockIndex,
119501e04c3fSmrg			        GLuint shaderStorageBlockBinding)
1196af69d88dSmrg{
1197af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
1198af69d88dSmrg   struct gl_shader_program *shProg;
1199af69d88dSmrg
120001e04c3fSmrg   if (!ctx->Extensions.ARB_shader_storage_buffer_object) {
120101e04c3fSmrg      _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderStorageBlockBinding");
1202af69d88dSmrg      return;
1203af69d88dSmrg   }
1204af69d88dSmrg
1205af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program,
120601e04c3fSmrg					    "glShaderStorageBlockBinding");
1207af69d88dSmrg   if (!shProg)
1208af69d88dSmrg      return;
1209af69d88dSmrg
121001e04c3fSmrg   if (shaderStorageBlockIndex >= shProg->data->NumShaderStorageBlocks) {
121101e04c3fSmrg      _mesa_error(ctx, GL_INVALID_VALUE,
121201e04c3fSmrg		  "glShaderStorageBlockBinding(block index %u >= %u)",
121301e04c3fSmrg                  shaderStorageBlockIndex,
121401e04c3fSmrg                  shProg->data->NumShaderStorageBlocks);
121501e04c3fSmrg      return;
121601e04c3fSmrg   }
121701e04c3fSmrg
121801e04c3fSmrg   if (shaderStorageBlockBinding >= ctx->Const.MaxShaderStorageBufferBindings) {
1219af69d88dSmrg      _mesa_error(ctx, GL_INVALID_VALUE,
122001e04c3fSmrg		  "glShaderStorageBlockBinding(block binding %u >= %u)",
122101e04c3fSmrg		  shaderStorageBlockBinding,
122201e04c3fSmrg                  ctx->Const.MaxShaderStorageBufferBindings);
1223af69d88dSmrg      return;
1224af69d88dSmrg   }
1225af69d88dSmrg
122601e04c3fSmrg   shader_storage_block_binding(ctx, shProg, shaderStorageBlockIndex,
122701e04c3fSmrg                                shaderStorageBlockBinding);
122801e04c3fSmrg}
122901e04c3fSmrg
123001e04c3fSmrg/**
123101e04c3fSmrg * Generic program resource property query.
123201e04c3fSmrg */
123301e04c3fSmrgstatic void
123401e04c3fSmrgmesa_bufferiv(struct gl_shader_program *shProg, GLenum type,
123501e04c3fSmrg              GLuint index, GLenum pname, GLint *params, const char *caller)
123601e04c3fSmrg{
123701e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
123801e04c3fSmrg   struct gl_program_resource *res =
123901e04c3fSmrg      _mesa_program_resource_find_index(shProg, type, index);
124001e04c3fSmrg
124101e04c3fSmrg   if (!res) {
124201e04c3fSmrg      _mesa_error(ctx, GL_INVALID_VALUE, "%s(bufferindex %d)", caller, index);
124301e04c3fSmrg      return;
124401e04c3fSmrg   }
1245af69d88dSmrg
1246af69d88dSmrg   switch (pname) {
1247af69d88dSmrg   case GL_UNIFORM_BLOCK_BINDING:
124801e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_BINDING:
124901e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index, GL_BUFFER_BINDING,
12507ec681f3Smrg                                  params, false, caller);
1251af69d88dSmrg      return;
1252af69d88dSmrg   case GL_UNIFORM_BLOCK_DATA_SIZE:
125301e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE:
125401e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index, GL_BUFFER_DATA_SIZE,
12557ec681f3Smrg                                  params, false, caller);
1256af69d88dSmrg      return;
1257af69d88dSmrg   case GL_UNIFORM_BLOCK_NAME_LENGTH:
125801e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index, GL_NAME_LENGTH,
12597ec681f3Smrg                                  params, false, caller);
1260af69d88dSmrg      return;
126101e04c3fSmrg   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
126201e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS:
126301e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index, GL_NUM_ACTIVE_VARIABLES,
12647ec681f3Smrg                                  params, false, caller);
126501e04c3fSmrg      return;
126601e04c3fSmrg   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
126701e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES:
126801e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index, GL_ACTIVE_VARIABLES,
12697ec681f3Smrg                                  params, false, caller);
127001e04c3fSmrg      return;
127101e04c3fSmrg   case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
127201e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER:
127301e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index,
127401e04c3fSmrg                                  GL_REFERENCED_BY_VERTEX_SHADER, params,
12757ec681f3Smrg                                  false, caller);
1276af69d88dSmrg      return;
1277af69d88dSmrg
127801e04c3fSmrg   case GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER:
127901e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER:
128001e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index,
128101e04c3fSmrg                                  GL_REFERENCED_BY_TESS_CONTROL_SHADER, params,
12827ec681f3Smrg                                  false, caller);
1283af69d88dSmrg      return;
1284af69d88dSmrg
128501e04c3fSmrg   case GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER:
128601e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER:
128701e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index,
128801e04c3fSmrg                                  GL_REFERENCED_BY_TESS_EVALUATION_SHADER, params,
12897ec681f3Smrg                                  false, caller);
1290af69d88dSmrg      return;
1291af69d88dSmrg
1292af69d88dSmrg   case GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER:
129301e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER:
129401e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index,
129501e04c3fSmrg                                  GL_REFERENCED_BY_GEOMETRY_SHADER, params,
12967ec681f3Smrg                                  false, caller);
1297af69d88dSmrg      return;
1298af69d88dSmrg   case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
129901e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER:
130001e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index,
130101e04c3fSmrg                                  GL_REFERENCED_BY_FRAGMENT_SHADER, params,
13027ec681f3Smrg                                  false, caller);
130301e04c3fSmrg      return;
130401e04c3fSmrg   case GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER:
130501e04c3fSmrg   case GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER:
130601e04c3fSmrg      _mesa_program_resource_prop(shProg, res, index,
130701e04c3fSmrg                                  GL_REFERENCED_BY_COMPUTE_SHADER, params,
13087ec681f3Smrg                                  false, caller);
1309af69d88dSmrg      return;
1310af69d88dSmrg   default:
1311af69d88dSmrg      _mesa_error(ctx, GL_INVALID_ENUM,
131201e04c3fSmrg                  "%s(pname 0x%x (%s))", caller, pname,
131301e04c3fSmrg                  _mesa_enum_to_string(pname));
131401e04c3fSmrg      return;
131501e04c3fSmrg   }
131601e04c3fSmrg}
131701e04c3fSmrg
131801e04c3fSmrg
131901e04c3fSmrgvoid GLAPIENTRY
132001e04c3fSmrg_mesa_GetActiveUniformBlockiv(GLuint program,
132101e04c3fSmrg			      GLuint uniformBlockIndex,
132201e04c3fSmrg			      GLenum pname,
132301e04c3fSmrg			      GLint *params)
132401e04c3fSmrg{
132501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
132601e04c3fSmrg   struct gl_shader_program *shProg;
132701e04c3fSmrg
132801e04c3fSmrg   if (!ctx->Extensions.ARB_uniform_buffer_object) {
132901e04c3fSmrg      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformBlockiv");
1330af69d88dSmrg      return;
1331af69d88dSmrg   }
133201e04c3fSmrg
133301e04c3fSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program,
133401e04c3fSmrg					    "glGetActiveUniformBlockiv");
133501e04c3fSmrg   if (!shProg)
133601e04c3fSmrg      return;
133701e04c3fSmrg
133801e04c3fSmrg   mesa_bufferiv(shProg, GL_UNIFORM_BLOCK, uniformBlockIndex, pname, params,
133901e04c3fSmrg                 "glGetActiveUniformBlockiv");
1340af69d88dSmrg}
1341af69d88dSmrg
1342af69d88dSmrgvoid GLAPIENTRY
1343af69d88dSmrg_mesa_GetActiveUniformBlockName(GLuint program,
1344af69d88dSmrg				GLuint uniformBlockIndex,
1345af69d88dSmrg				GLsizei bufSize,
1346af69d88dSmrg				GLsizei *length,
1347af69d88dSmrg				GLchar *uniformBlockName)
1348af69d88dSmrg{
1349af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
1350af69d88dSmrg   struct gl_shader_program *shProg;
1351af69d88dSmrg
1352af69d88dSmrg   if (!ctx->Extensions.ARB_uniform_buffer_object) {
1353af69d88dSmrg      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformBlockiv");
1354af69d88dSmrg      return;
1355af69d88dSmrg   }
1356af69d88dSmrg
1357af69d88dSmrg   if (bufSize < 0) {
1358af69d88dSmrg      _mesa_error(ctx, GL_INVALID_VALUE,
1359af69d88dSmrg		  "glGetActiveUniformBlockName(bufSize %d < 0)",
1360af69d88dSmrg		  bufSize);
1361af69d88dSmrg      return;
1362af69d88dSmrg   }
1363af69d88dSmrg
1364af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program,
1365af69d88dSmrg					    "glGetActiveUniformBlockiv");
1366af69d88dSmrg   if (!shProg)
1367af69d88dSmrg      return;
1368af69d88dSmrg
136901e04c3fSmrg   if (uniformBlockName)
137001e04c3fSmrg      _mesa_get_program_resource_name(shProg, GL_UNIFORM_BLOCK,
137101e04c3fSmrg                                      uniformBlockIndex, bufSize, length,
13727ec681f3Smrg                                      uniformBlockName, false,
137301e04c3fSmrg                                      "glGetActiveUniformBlockName");
1374af69d88dSmrg}
1375af69d88dSmrg
1376af69d88dSmrgvoid GLAPIENTRY
1377af69d88dSmrg_mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex,
1378af69d88dSmrg			   GLsizei bufSize, GLsizei *length,
1379af69d88dSmrg			   GLchar *uniformName)
1380af69d88dSmrg{
1381af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
1382af69d88dSmrg   struct gl_shader_program *shProg;
1383af69d88dSmrg
1384af69d88dSmrg   if (!ctx->Extensions.ARB_uniform_buffer_object) {
138501e04c3fSmrg      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformName");
1386af69d88dSmrg      return;
1387af69d88dSmrg   }
1388af69d88dSmrg
1389af69d88dSmrg   if (bufSize < 0) {
1390af69d88dSmrg      _mesa_error(ctx, GL_INVALID_VALUE,
1391af69d88dSmrg		  "glGetActiveUniformName(bufSize %d < 0)",
1392af69d88dSmrg		  bufSize);
1393af69d88dSmrg      return;
1394af69d88dSmrg   }
1395af69d88dSmrg
1396af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniformName");
1397af69d88dSmrg
1398af69d88dSmrg   if (!shProg)
1399af69d88dSmrg      return;
1400af69d88dSmrg
140101e04c3fSmrg   _mesa_get_program_resource_name(shProg, GL_UNIFORM, uniformIndex, bufSize,
14027ec681f3Smrg                                   length, uniformName, false,
14037ec681f3Smrg                                   "glGetActiveUniformName");
1404af69d88dSmrg}
1405af69d88dSmrg
1406af69d88dSmrgvoid GLAPIENTRY
1407af69d88dSmrg_mesa_GetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex,
1408af69d88dSmrg                                     GLenum pname, GLint *params)
1409af69d88dSmrg{
1410af69d88dSmrg   GET_CURRENT_CONTEXT(ctx);
1411af69d88dSmrg   struct gl_shader_program *shProg;
1412af69d88dSmrg
1413af69d88dSmrg   if (!ctx->Extensions.ARB_shader_atomic_counters) {
1414af69d88dSmrg      _mesa_error(ctx, GL_INVALID_OPERATION,
1415af69d88dSmrg                  "glGetActiveAtomicCounterBufferiv");
1416af69d88dSmrg      return;
1417af69d88dSmrg   }
1418af69d88dSmrg
1419af69d88dSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program,
1420af69d88dSmrg                                            "glGetActiveAtomicCounterBufferiv");
1421af69d88dSmrg   if (!shProg)
1422af69d88dSmrg      return;
1423af69d88dSmrg
142401e04c3fSmrg   mesa_bufferiv(shProg, GL_ATOMIC_COUNTER_BUFFER, bufferIndex, pname, params,
142501e04c3fSmrg                 "glGetActiveAtomicCounterBufferiv");
142601e04c3fSmrg}
1427af69d88dSmrg
142801e04c3fSmrgvoid GLAPIENTRY
142901e04c3fSmrg_mesa_Uniform1d(GLint location, GLdouble v0)
143001e04c3fSmrg{
143101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
143201e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 1);
143301e04c3fSmrg}
1434af69d88dSmrg
143501e04c3fSmrgvoid GLAPIENTRY
143601e04c3fSmrg_mesa_Uniform2d(GLint location, GLdouble v0, GLdouble v1)
143701e04c3fSmrg{
143801e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
143901e04c3fSmrg   GLdouble v[2];
144001e04c3fSmrg   v[0] = v0;
144101e04c3fSmrg   v[1] = v1;
144201e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 2);
144301e04c3fSmrg}
144401e04c3fSmrg
144501e04c3fSmrgvoid GLAPIENTRY
144601e04c3fSmrg_mesa_Uniform3d(GLint location, GLdouble v0, GLdouble v1, GLdouble v2)
144701e04c3fSmrg{
144801e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
144901e04c3fSmrg   GLdouble v[3];
145001e04c3fSmrg   v[0] = v0;
145101e04c3fSmrg   v[1] = v1;
145201e04c3fSmrg   v[2] = v2;
145301e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 3);
145401e04c3fSmrg}
145501e04c3fSmrg
145601e04c3fSmrgvoid GLAPIENTRY
145701e04c3fSmrg_mesa_Uniform4d(GLint location, GLdouble v0, GLdouble v1, GLdouble v2,
145801e04c3fSmrg                GLdouble v3)
145901e04c3fSmrg{
146001e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
146101e04c3fSmrg   GLdouble v[4];
146201e04c3fSmrg   v[0] = v0;
146301e04c3fSmrg   v[1] = v1;
146401e04c3fSmrg   v[2] = v2;
146501e04c3fSmrg   v[3] = v3;
146601e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 4);
146701e04c3fSmrg}
146801e04c3fSmrg
146901e04c3fSmrgvoid GLAPIENTRY
147001e04c3fSmrg_mesa_Uniform1dv(GLint location, GLsizei count, const GLdouble * value)
147101e04c3fSmrg{
147201e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
147301e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 1);
147401e04c3fSmrg}
147501e04c3fSmrg
147601e04c3fSmrgvoid GLAPIENTRY
147701e04c3fSmrg_mesa_Uniform2dv(GLint location, GLsizei count, const GLdouble * value)
147801e04c3fSmrg{
147901e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
148001e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 2);
148101e04c3fSmrg}
148201e04c3fSmrg
148301e04c3fSmrgvoid GLAPIENTRY
148401e04c3fSmrg_mesa_Uniform3dv(GLint location, GLsizei count, const GLdouble * value)
148501e04c3fSmrg{
148601e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
148701e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 3);
148801e04c3fSmrg}
148901e04c3fSmrg
149001e04c3fSmrgvoid GLAPIENTRY
149101e04c3fSmrg_mesa_Uniform4dv(GLint location, GLsizei count, const GLdouble * value)
149201e04c3fSmrg{
149301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
149401e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 4);
149501e04c3fSmrg}
149601e04c3fSmrg
149701e04c3fSmrgvoid GLAPIENTRY
149801e04c3fSmrg_mesa_UniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose,
149901e04c3fSmrg                       const GLdouble * value)
150001e04c3fSmrg{
150101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
150201e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
150301e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 2, 2, GLSL_TYPE_DOUBLE);
150401e04c3fSmrg}
150501e04c3fSmrg
150601e04c3fSmrgvoid GLAPIENTRY
150701e04c3fSmrg_mesa_UniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose,
150801e04c3fSmrg                       const GLdouble * value)
150901e04c3fSmrg{
151001e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
151101e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
151201e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 3, 3, GLSL_TYPE_DOUBLE);
151301e04c3fSmrg}
151401e04c3fSmrg
151501e04c3fSmrgvoid GLAPIENTRY
151601e04c3fSmrg_mesa_UniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose,
151701e04c3fSmrg                       const GLdouble * value)
151801e04c3fSmrg{
151901e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
152001e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
152101e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 4, 4, GLSL_TYPE_DOUBLE);
152201e04c3fSmrg}
152301e04c3fSmrg
152401e04c3fSmrgvoid GLAPIENTRY
152501e04c3fSmrg_mesa_UniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose,
152601e04c3fSmrg                         const GLdouble *value)
152701e04c3fSmrg{
152801e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
152901e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
153001e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 2, 3, GLSL_TYPE_DOUBLE);
153101e04c3fSmrg}
153201e04c3fSmrg
153301e04c3fSmrgvoid GLAPIENTRY
153401e04c3fSmrg_mesa_UniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose,
153501e04c3fSmrg                         const GLdouble *value)
153601e04c3fSmrg{
153701e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
153801e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
153901e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 3, 2, GLSL_TYPE_DOUBLE);
154001e04c3fSmrg}
154101e04c3fSmrg
154201e04c3fSmrgvoid GLAPIENTRY
154301e04c3fSmrg_mesa_UniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose,
154401e04c3fSmrg                         const GLdouble *value)
154501e04c3fSmrg{
154601e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
154701e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
154801e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 2, 4, GLSL_TYPE_DOUBLE);
154901e04c3fSmrg}
155001e04c3fSmrg
155101e04c3fSmrgvoid GLAPIENTRY
155201e04c3fSmrg_mesa_UniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose,
155301e04c3fSmrg                         const GLdouble *value)
155401e04c3fSmrg{
155501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
155601e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
155701e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 4, 2, GLSL_TYPE_DOUBLE);
155801e04c3fSmrg}
155901e04c3fSmrg
156001e04c3fSmrgvoid GLAPIENTRY
156101e04c3fSmrg_mesa_UniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose,
156201e04c3fSmrg                         const GLdouble *value)
156301e04c3fSmrg{
156401e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
156501e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
156601e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 3, 4, GLSL_TYPE_DOUBLE);
156701e04c3fSmrg}
156801e04c3fSmrg
156901e04c3fSmrgvoid GLAPIENTRY
157001e04c3fSmrg_mesa_UniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose,
157101e04c3fSmrg                         const GLdouble *value)
157201e04c3fSmrg{
157301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
157401e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
157501e04c3fSmrg                        ctx, ctx->_Shader->ActiveProgram, 4, 3, GLSL_TYPE_DOUBLE);
157601e04c3fSmrg}
157701e04c3fSmrg
157801e04c3fSmrgvoid GLAPIENTRY
157901e04c3fSmrg_mesa_ProgramUniform1d(GLuint program, GLint location, GLdouble v0)
158001e04c3fSmrg{
158101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
158201e04c3fSmrg   struct gl_shader_program *shProg =
158301e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
158401e04c3fSmrg            "glProgramUniform1d");
158501e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_DOUBLE, 1);
158601e04c3fSmrg}
158701e04c3fSmrg
158801e04c3fSmrgvoid GLAPIENTRY
158901e04c3fSmrg_mesa_ProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
159001e04c3fSmrg{
159101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
159201e04c3fSmrg   GLdouble v[2];
159301e04c3fSmrg   struct gl_shader_program *shProg;
159401e04c3fSmrg   v[0] = v0;
159501e04c3fSmrg   v[1] = v1;
159601e04c3fSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2d");
159701e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 2);
159801e04c3fSmrg}
159901e04c3fSmrg
160001e04c3fSmrgvoid GLAPIENTRY
160101e04c3fSmrg_mesa_ProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1,
160201e04c3fSmrg                       GLdouble v2)
160301e04c3fSmrg{
160401e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
160501e04c3fSmrg   GLdouble v[3];
160601e04c3fSmrg   struct gl_shader_program *shProg;
160701e04c3fSmrg   v[0] = v0;
160801e04c3fSmrg   v[1] = v1;
160901e04c3fSmrg   v[2] = v2;
161001e04c3fSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3d");
161101e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 3);
161201e04c3fSmrg}
161301e04c3fSmrg
161401e04c3fSmrgvoid GLAPIENTRY
161501e04c3fSmrg_mesa_ProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1,
161601e04c3fSmrg                       GLdouble v2, GLdouble v3)
161701e04c3fSmrg{
161801e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
161901e04c3fSmrg   GLdouble v[4];
162001e04c3fSmrg   struct gl_shader_program *shProg;
162101e04c3fSmrg   v[0] = v0;
162201e04c3fSmrg   v[1] = v1;
162301e04c3fSmrg   v[2] = v2;
162401e04c3fSmrg   v[3] = v3;
162501e04c3fSmrg   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4d");
162601e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 4);
162701e04c3fSmrg}
162801e04c3fSmrg
162901e04c3fSmrgvoid GLAPIENTRY
163001e04c3fSmrg_mesa_ProgramUniform1dv(GLuint program, GLint location, GLsizei count,
163101e04c3fSmrg                        const GLdouble * value)
163201e04c3fSmrg{
163301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
163401e04c3fSmrg   struct gl_shader_program *shProg =
163501e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
163601e04c3fSmrg            "glProgramUniform1dv");
163701e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 1);
163801e04c3fSmrg}
163901e04c3fSmrg
164001e04c3fSmrgvoid GLAPIENTRY
164101e04c3fSmrg_mesa_ProgramUniform2dv(GLuint program, GLint location, GLsizei count,
164201e04c3fSmrg                        const GLdouble * value)
164301e04c3fSmrg{
164401e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
164501e04c3fSmrg   struct gl_shader_program *shProg =
164601e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
164701e04c3fSmrg            "glProgramUniform2dv");
164801e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 2);
164901e04c3fSmrg}
165001e04c3fSmrg
165101e04c3fSmrgvoid GLAPIENTRY
165201e04c3fSmrg_mesa_ProgramUniform3dv(GLuint program, GLint location, GLsizei count,
165301e04c3fSmrg                        const GLdouble * value)
165401e04c3fSmrg{
165501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
165601e04c3fSmrg   struct gl_shader_program *shProg =
165701e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
165801e04c3fSmrg            "glProgramUniform3dv");
165901e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 3);
166001e04c3fSmrg}
166101e04c3fSmrg
166201e04c3fSmrgvoid GLAPIENTRY
166301e04c3fSmrg_mesa_ProgramUniform4dv(GLuint program, GLint location, GLsizei count,
166401e04c3fSmrg                        const GLdouble * value)
166501e04c3fSmrg{
166601e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
166701e04c3fSmrg   struct gl_shader_program *shProg =
166801e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
166901e04c3fSmrg            "glProgramUniform4dv");
167001e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 4);
167101e04c3fSmrg}
167201e04c3fSmrg
167301e04c3fSmrgvoid GLAPIENTRY
167401e04c3fSmrg_mesa_ProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count,
167501e04c3fSmrg                              GLboolean transpose, const GLdouble * value)
167601e04c3fSmrg{
167701e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
167801e04c3fSmrg   struct gl_shader_program *shProg =
167901e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
168001e04c3fSmrg            "glProgramUniformMatrix2dv");
168101e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
168201e04c3fSmrg                        ctx, shProg, 2, 2, GLSL_TYPE_DOUBLE);
168301e04c3fSmrg}
168401e04c3fSmrg
168501e04c3fSmrgvoid GLAPIENTRY
168601e04c3fSmrg_mesa_ProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count,
168701e04c3fSmrg                              GLboolean transpose, const GLdouble * value)
168801e04c3fSmrg{
168901e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
169001e04c3fSmrg   struct gl_shader_program *shProg =
169101e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
169201e04c3fSmrg            "glProgramUniformMatrix3dv");
169301e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
169401e04c3fSmrg                        ctx, shProg, 3, 3, GLSL_TYPE_DOUBLE);
169501e04c3fSmrg}
169601e04c3fSmrg
169701e04c3fSmrgvoid GLAPIENTRY
169801e04c3fSmrg_mesa_ProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count,
169901e04c3fSmrg                              GLboolean transpose, const GLdouble * value)
170001e04c3fSmrg{
170101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
170201e04c3fSmrg   struct gl_shader_program *shProg =
170301e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
170401e04c3fSmrg            "glProgramUniformMatrix4dv");
170501e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
170601e04c3fSmrg                        ctx, shProg, 4, 4, GLSL_TYPE_DOUBLE);
170701e04c3fSmrg}
170801e04c3fSmrg
170901e04c3fSmrgvoid GLAPIENTRY
171001e04c3fSmrg_mesa_ProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count,
171101e04c3fSmrg                                GLboolean transpose, const GLdouble * value)
171201e04c3fSmrg{
171301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
171401e04c3fSmrg   struct gl_shader_program *shProg =
171501e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
171601e04c3fSmrg            "glProgramUniformMatrix2x3dv");
171701e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
171801e04c3fSmrg                        ctx, shProg, 2, 3, GLSL_TYPE_DOUBLE);
171901e04c3fSmrg}
172001e04c3fSmrg
172101e04c3fSmrgvoid GLAPIENTRY
172201e04c3fSmrg_mesa_ProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count,
172301e04c3fSmrg                                GLboolean transpose, const GLdouble * value)
172401e04c3fSmrg{
172501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
172601e04c3fSmrg   struct gl_shader_program *shProg =
172701e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
172801e04c3fSmrg            "glProgramUniformMatrix3x2dv");
172901e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
173001e04c3fSmrg                        ctx, shProg, 3, 2, GLSL_TYPE_DOUBLE);
173101e04c3fSmrg}
173201e04c3fSmrg
173301e04c3fSmrgvoid GLAPIENTRY
173401e04c3fSmrg_mesa_ProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count,
173501e04c3fSmrg                                GLboolean transpose, const GLdouble * value)
173601e04c3fSmrg{
173701e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
173801e04c3fSmrg   struct gl_shader_program *shProg =
173901e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
174001e04c3fSmrg            "glProgramUniformMatrix2x4dv");
174101e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
174201e04c3fSmrg                        ctx, shProg, 2, 4, GLSL_TYPE_DOUBLE);
174301e04c3fSmrg}
174401e04c3fSmrg
174501e04c3fSmrgvoid GLAPIENTRY
174601e04c3fSmrg_mesa_ProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count,
174701e04c3fSmrg                                GLboolean transpose, const GLdouble * value)
174801e04c3fSmrg{
174901e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
175001e04c3fSmrg   struct gl_shader_program *shProg =
175101e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
175201e04c3fSmrg            "glProgramUniformMatrix4x2dv");
175301e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
175401e04c3fSmrg                        ctx, shProg, 4, 2, GLSL_TYPE_DOUBLE);
175501e04c3fSmrg}
175601e04c3fSmrg
175701e04c3fSmrgvoid GLAPIENTRY
175801e04c3fSmrg_mesa_ProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count,
175901e04c3fSmrg                                GLboolean transpose, const GLdouble * value)
176001e04c3fSmrg{
176101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
176201e04c3fSmrg   struct gl_shader_program *shProg =
176301e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
176401e04c3fSmrg            "glProgramUniformMatrix3x4dv");
176501e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
176601e04c3fSmrg                        ctx, shProg, 3, 4, GLSL_TYPE_DOUBLE);
176701e04c3fSmrg}
176801e04c3fSmrg
176901e04c3fSmrgvoid GLAPIENTRY
177001e04c3fSmrg_mesa_ProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count,
177101e04c3fSmrg                                GLboolean transpose, const GLdouble * value)
177201e04c3fSmrg{
177301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
177401e04c3fSmrg   struct gl_shader_program *shProg =
177501e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
177601e04c3fSmrg            "glProgramUniformMatrix4x3dv");
177701e04c3fSmrg   _mesa_uniform_matrix(location, count, transpose, value,
177801e04c3fSmrg                        ctx, shProg, 4, 3, GLSL_TYPE_DOUBLE);
177901e04c3fSmrg}
178001e04c3fSmrg
178101e04c3fSmrgvoid GLAPIENTRY
178201e04c3fSmrg_mesa_Uniform1i64ARB(GLint location, GLint64 v0)
178301e04c3fSmrg{
178401e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
178501e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 1);
178601e04c3fSmrg}
178701e04c3fSmrg
178801e04c3fSmrgvoid GLAPIENTRY
178901e04c3fSmrg_mesa_Uniform2i64ARB(GLint location, GLint64 v0, GLint64 v1)
179001e04c3fSmrg{
179101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
179201e04c3fSmrg   int64_t v[2];
179301e04c3fSmrg   v[0] = v0;
179401e04c3fSmrg   v[1] = v1;
179501e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 2);
179601e04c3fSmrg}
179701e04c3fSmrg
179801e04c3fSmrgvoid GLAPIENTRY
179901e04c3fSmrg_mesa_Uniform3i64ARB(GLint location, GLint64 v0, GLint64 v1, GLint64 v2)
180001e04c3fSmrg{
180101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
180201e04c3fSmrg   int64_t v[3];
180301e04c3fSmrg   v[0] = v0;
180401e04c3fSmrg   v[1] = v1;
180501e04c3fSmrg   v[2] = v2;
180601e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 3);
180701e04c3fSmrg}
180801e04c3fSmrg
180901e04c3fSmrgvoid GLAPIENTRY
181001e04c3fSmrg_mesa_Uniform4i64ARB(GLint location,  GLint64 v0, GLint64 v1, GLint64 v2, GLint64 v3)
181101e04c3fSmrg{
181201e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
181301e04c3fSmrg   int64_t v[4];
181401e04c3fSmrg   v[0] = v0;
181501e04c3fSmrg   v[1] = v1;
181601e04c3fSmrg   v[2] = v2;
181701e04c3fSmrg   v[3] = v3;
181801e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 4);
181901e04c3fSmrg}
182001e04c3fSmrg
182101e04c3fSmrgvoid GLAPIENTRY
182201e04c3fSmrg_mesa_Uniform1i64vARB(GLint location, GLsizei count, const GLint64 *value)
182301e04c3fSmrg{
182401e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
182501e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 1);
182601e04c3fSmrg}
182701e04c3fSmrg
182801e04c3fSmrgvoid GLAPIENTRY
182901e04c3fSmrg_mesa_Uniform2i64vARB(GLint location,  GLsizei count, const GLint64 *value)
183001e04c3fSmrg{
183101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
183201e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 2);
183301e04c3fSmrg}
183401e04c3fSmrg
183501e04c3fSmrgvoid GLAPIENTRY
183601e04c3fSmrg_mesa_Uniform3i64vARB(GLint location,  GLsizei count, const GLint64 *value)
183701e04c3fSmrg{
183801e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
183901e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 3);
184001e04c3fSmrg}
184101e04c3fSmrg
184201e04c3fSmrgvoid GLAPIENTRY
184301e04c3fSmrg_mesa_Uniform4i64vARB(GLint location,  GLsizei count, const GLint64 *value)
184401e04c3fSmrg{
184501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
184601e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 4);
184701e04c3fSmrg}
184801e04c3fSmrg
184901e04c3fSmrgvoid GLAPIENTRY
185001e04c3fSmrg_mesa_Uniform1ui64ARB(GLint location,  GLuint64 v0)
185101e04c3fSmrg{
185201e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
185301e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 1);
185401e04c3fSmrg}
185501e04c3fSmrg
185601e04c3fSmrgvoid GLAPIENTRY
185701e04c3fSmrg_mesa_Uniform2ui64ARB(GLint location,  GLuint64 v0, GLuint64 v1)
185801e04c3fSmrg{
185901e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
186001e04c3fSmrg   uint64_t v[2];
186101e04c3fSmrg   v[0] = v0;
186201e04c3fSmrg   v[1] = v1;
186301e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 2);
186401e04c3fSmrg}
186501e04c3fSmrg
186601e04c3fSmrgvoid GLAPIENTRY
186701e04c3fSmrg_mesa_Uniform3ui64ARB(GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2)
186801e04c3fSmrg{
186901e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
187001e04c3fSmrg   uint64_t v[3];
187101e04c3fSmrg   v[0] = v0;
187201e04c3fSmrg   v[1] = v1;
187301e04c3fSmrg   v[2] = v2;
187401e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 3);
187501e04c3fSmrg}
187601e04c3fSmrg
187701e04c3fSmrgvoid GLAPIENTRY
187801e04c3fSmrg_mesa_Uniform4ui64ARB(GLint location,  GLuint64 v0, GLuint64 v1, GLuint64 v2, GLuint64 v3)
187901e04c3fSmrg{
188001e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
188101e04c3fSmrg   uint64_t v[4];
188201e04c3fSmrg   v[0] = v0;
188301e04c3fSmrg   v[1] = v1;
188401e04c3fSmrg   v[2] = v2;
188501e04c3fSmrg   v[3] = v3;
188601e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 4);
188701e04c3fSmrg}
188801e04c3fSmrg
188901e04c3fSmrgvoid GLAPIENTRY
189001e04c3fSmrg_mesa_Uniform1ui64vARB(GLint location,  GLsizei count, const GLuint64 *value)
189101e04c3fSmrg{
189201e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
189301e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 1);
189401e04c3fSmrg}
189501e04c3fSmrg
189601e04c3fSmrgvoid GLAPIENTRY
189701e04c3fSmrg_mesa_Uniform2ui64vARB(GLint location,  GLsizei count, const GLuint64 *value)
189801e04c3fSmrg{
189901e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
190001e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 2);
190101e04c3fSmrg}
190201e04c3fSmrg
190301e04c3fSmrgvoid GLAPIENTRY
190401e04c3fSmrg_mesa_Uniform3ui64vARB(GLint location,  GLsizei count, const GLuint64 *value)
190501e04c3fSmrg{
190601e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
190701e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 3);
190801e04c3fSmrg}
190901e04c3fSmrg
191001e04c3fSmrgvoid GLAPIENTRY
191101e04c3fSmrg_mesa_Uniform4ui64vARB(GLint location,  GLsizei count, const GLuint64 *value)
191201e04c3fSmrg{
191301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
191401e04c3fSmrg   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 4);
191501e04c3fSmrg}
191601e04c3fSmrg
191701e04c3fSmrg/* DSA entrypoints */
191801e04c3fSmrgvoid GLAPIENTRY
191901e04c3fSmrg_mesa_ProgramUniform1i64ARB(GLuint program, GLint location, GLint64 v0)
192001e04c3fSmrg{
192101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
192201e04c3fSmrg   struct gl_shader_program *shProg =
192301e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
192401e04c3fSmrg            "glProgramUniform1i64ARB");
192501e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_INT64, 1);
192601e04c3fSmrg}
192701e04c3fSmrg
192801e04c3fSmrgvoid GLAPIENTRY
192901e04c3fSmrg_mesa_ProgramUniform2i64ARB(GLuint program, GLint location, GLint64 v0, GLint64 v1)
193001e04c3fSmrg{
193101e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
193201e04c3fSmrg   struct gl_shader_program *shProg =
193301e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
193401e04c3fSmrg                                      "glProgramUniform2i64ARB");
193501e04c3fSmrg   int64_t v[2];
193601e04c3fSmrg   v[0] = v0;
193701e04c3fSmrg   v[1] = v1;
193801e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 2);
193901e04c3fSmrg}
194001e04c3fSmrg
194101e04c3fSmrgvoid GLAPIENTRY
194201e04c3fSmrg_mesa_ProgramUniform3i64ARB(GLuint program, GLint location, GLint64 v0, GLint64 v1, GLint64 v2)
194301e04c3fSmrg{
194401e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
194501e04c3fSmrg   struct gl_shader_program *shProg =
194601e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
194701e04c3fSmrg                                      "glProgramUniform3i64ARB");
194801e04c3fSmrg   int64_t v[3];
194901e04c3fSmrg   v[0] = v0;
195001e04c3fSmrg   v[1] = v1;
195101e04c3fSmrg   v[2] = v2;
195201e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 3);
195301e04c3fSmrg}
195401e04c3fSmrg
195501e04c3fSmrgvoid GLAPIENTRY
195601e04c3fSmrg_mesa_ProgramUniform4i64ARB(GLuint program, GLint location,  GLint64 v0, GLint64 v1, GLint64 v2, GLint64 v3)
195701e04c3fSmrg{
195801e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
195901e04c3fSmrg   struct gl_shader_program *shProg =
196001e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
196101e04c3fSmrg                                      "glProgramUniform4i64ARB");
196201e04c3fSmrg   int64_t v[4];
196301e04c3fSmrg   v[0] = v0;
196401e04c3fSmrg   v[1] = v1;
196501e04c3fSmrg   v[2] = v2;
196601e04c3fSmrg   v[3] = v3;
196701e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 4);
196801e04c3fSmrg}
196901e04c3fSmrg
197001e04c3fSmrgvoid GLAPIENTRY
197101e04c3fSmrg_mesa_ProgramUniform1i64vARB(GLuint program, GLint location, GLsizei count, const GLint64 *value)
197201e04c3fSmrg{
197301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
197401e04c3fSmrg   struct gl_shader_program *shProg =
197501e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
197601e04c3fSmrg                                      "glProgramUniform1i64vARB");
197701e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 1);
197801e04c3fSmrg}
197901e04c3fSmrg
198001e04c3fSmrgvoid GLAPIENTRY
198101e04c3fSmrg_mesa_ProgramUniform2i64vARB(GLuint program, GLint location,  GLsizei count, const GLint64 *value)
198201e04c3fSmrg{
198301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
198401e04c3fSmrg   struct gl_shader_program *shProg =
198501e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
198601e04c3fSmrg                                      "glProgramUniform2i64vARB");
198701e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 2);
198801e04c3fSmrg}
198901e04c3fSmrg
199001e04c3fSmrgvoid GLAPIENTRY
199101e04c3fSmrg_mesa_ProgramUniform3i64vARB(GLuint program, GLint location,  GLsizei count, const GLint64 *value)
199201e04c3fSmrg{
199301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
199401e04c3fSmrg   struct gl_shader_program *shProg =
199501e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
199601e04c3fSmrg                                      "glProgramUniform3i64vARB");
199701e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 3);
199801e04c3fSmrg}
199901e04c3fSmrg
200001e04c3fSmrgvoid GLAPIENTRY
200101e04c3fSmrg_mesa_ProgramUniform4i64vARB(GLuint program, GLint location,  GLsizei count, const GLint64 *value)
200201e04c3fSmrg{
200301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
200401e04c3fSmrg   struct gl_shader_program *shProg =
200501e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
200601e04c3fSmrg                                      "glProgramUniform4i64vARB");
200701e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 4);
200801e04c3fSmrg}
200901e04c3fSmrg
201001e04c3fSmrgvoid GLAPIENTRY
201101e04c3fSmrg_mesa_ProgramUniform1ui64ARB(GLuint program, GLint location,  GLuint64 v0)
201201e04c3fSmrg{
201301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
201401e04c3fSmrg   struct gl_shader_program *shProg =
201501e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
201601e04c3fSmrg                                      "glProgramUniform1ui64ARB");
201701e04c3fSmrg   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_UINT64, 1);
201801e04c3fSmrg}
201901e04c3fSmrg
202001e04c3fSmrgvoid GLAPIENTRY
202101e04c3fSmrg_mesa_ProgramUniform2ui64ARB(GLuint program, GLint location,  GLuint64 v0, GLuint64 v1)
202201e04c3fSmrg{
202301e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
202401e04c3fSmrg   struct gl_shader_program *shProg =
202501e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
202601e04c3fSmrg                                      "glProgramUniform2ui64ARB");
202701e04c3fSmrg   uint64_t v[2];
202801e04c3fSmrg   v[0] = v0;
202901e04c3fSmrg   v[1] = v1;
203001e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 2);
203101e04c3fSmrg}
203201e04c3fSmrg
203301e04c3fSmrgvoid GLAPIENTRY
203401e04c3fSmrg_mesa_ProgramUniform3ui64ARB(GLuint program, GLint location, GLuint64 v0, GLuint64 v1, GLuint64 v2)
203501e04c3fSmrg{
203601e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
203701e04c3fSmrg   struct gl_shader_program *shProg =
203801e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
203901e04c3fSmrg                                      "glProgramUniform3ui64ARB");
204001e04c3fSmrg   uint64_t v[3];
204101e04c3fSmrg   v[0] = v0;
204201e04c3fSmrg   v[1] = v1;
204301e04c3fSmrg   v[2] = v2;
204401e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 3);
204501e04c3fSmrg}
204601e04c3fSmrg
204701e04c3fSmrgvoid GLAPIENTRY
204801e04c3fSmrg_mesa_ProgramUniform4ui64ARB(GLuint program, GLint location,  GLuint64 v0, GLuint64 v1, GLuint64 v2, GLuint64 v3)
204901e04c3fSmrg{
205001e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
205101e04c3fSmrg   struct gl_shader_program *shProg =
205201e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
205301e04c3fSmrg                                      "glProgramUniform4ui64ARB");
205401e04c3fSmrg   uint64_t v[4];
205501e04c3fSmrg   v[0] = v0;
205601e04c3fSmrg   v[1] = v1;
205701e04c3fSmrg   v[2] = v2;
205801e04c3fSmrg   v[3] = v3;
205901e04c3fSmrg   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 4);
206001e04c3fSmrg}
206101e04c3fSmrg
206201e04c3fSmrgvoid GLAPIENTRY
206301e04c3fSmrg_mesa_ProgramUniform1ui64vARB(GLuint program, GLint location,  GLsizei count, const GLuint64 *value)
206401e04c3fSmrg{
206501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
206601e04c3fSmrg   struct gl_shader_program *shProg =
206701e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
206801e04c3fSmrg                                      "glProgramUniform1ui64vARB");
206901e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 1);
207001e04c3fSmrg}
207101e04c3fSmrg
207201e04c3fSmrgvoid GLAPIENTRY
207301e04c3fSmrg_mesa_ProgramUniform2ui64vARB(GLuint program, GLint location,  GLsizei count, const GLuint64 *value)
207401e04c3fSmrg{
207501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
207601e04c3fSmrg   struct gl_shader_program *shProg =
207701e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
207801e04c3fSmrg                                      "glProgramUniform2ui64vARB");
207901e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 2);
208001e04c3fSmrg}
208101e04c3fSmrg
208201e04c3fSmrgvoid GLAPIENTRY
208301e04c3fSmrg_mesa_ProgramUniform3ui64vARB(GLuint program, GLint location,  GLsizei count, const GLuint64 *value)
208401e04c3fSmrg{
208501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
208601e04c3fSmrg   struct gl_shader_program *shProg =
208701e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
208801e04c3fSmrg                                      "glProgramUniform3ui64vARB");
208901e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 3);
209001e04c3fSmrg}
209101e04c3fSmrg
209201e04c3fSmrgvoid GLAPIENTRY
209301e04c3fSmrg_mesa_ProgramUniform4ui64vARB(GLuint program, GLint location,  GLsizei count, const GLuint64 *value)
209401e04c3fSmrg{
209501e04c3fSmrg   GET_CURRENT_CONTEXT(ctx);
209601e04c3fSmrg   struct gl_shader_program *shProg =
209701e04c3fSmrg      _mesa_lookup_shader_program_err(ctx, program,
209801e04c3fSmrg                                      "glProgramUniform4ui64vARB");
209901e04c3fSmrg   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 4);
21003464ebd5Sriastradh}
2101