+/**
+ * Connect a piece of driver storage with a part of a uniform
+ *
+ * \param uni The uniform with which the storage will be associated
+ * \param element_stride Byte-stride between array elements.
+ * \sa gl_uniform_driver_storage::element_stride.
+ * \param vector_stride Byte-stride between vectors (in a matrix).
+ * \sa gl_uniform_driver_storage::vector_stride.
+ * \param format Conversion from native format to driver format
+ * required by the driver.
+ * \param data Location to dump the data.
+ */
+void
+_mesa_uniform_attach_driver_storage(struct gl_uniform_storage *uni,
+ unsigned element_stride,
+ unsigned vector_stride,
+ enum gl_uniform_driver_format format,
+ void *data)
+{
+ uni->driver_storage =
+ realloc(uni->driver_storage,
+ sizeof(struct gl_uniform_driver_storage)
+ * (uni->num_driver_storage + 1));
+
+ uni->driver_storage[uni->num_driver_storage].element_stride = element_stride;
+ uni->driver_storage[uni->num_driver_storage].vector_stride = vector_stride;
+ uni->driver_storage[uni->num_driver_storage].format = format;
+ uni->driver_storage[uni->num_driver_storage].data = data;
+
+ uni->num_driver_storage++;
+}
+
+/**
+ * Sever all connections with all pieces of driver storage for all uniforms
+ *
+ * \warning
+ * This function does \b not release any of the \c data pointers
+ * previously passed in to \c _mesa_uniform_attach_driver_stoarge.
+ */
+void
+_mesa_uniform_detach_all_driver_storage(struct gl_uniform_storage *uni)
+{
+ free(uni->driver_storage);
+ uni->driver_storage = NULL;
+ uni->num_driver_storage = 0;
+}
+
+void GLAPIENTRY
+_mesa_Uniform1f(GLint location, GLfloat v0)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_FLOAT, 1);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2f(GLint location, GLfloat v0, GLfloat v1)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat v[2];
+ v[0] = v0;
+ v[1] = v1;
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat v[3];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
+ GLfloat v3)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat v[4];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 4);
+}
+
+void GLAPIENTRY
+_mesa_Uniform1i(GLint location, GLint v0)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_INT, 1);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2i(GLint location, GLint v0, GLint v1)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint v[2];
+ v[0] = v0;
+ v[1] = v1;
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3i(GLint location, GLint v0, GLint v1, GLint v2)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint v[3];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint v[4];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 4);
+}
+
+void GLAPIENTRY
+_mesa_Uniform1fv(GLint location, GLsizei count, const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 1);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2fv(GLint location, GLsizei count, const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3fv(GLint location, GLsizei count, const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4fv(GLint location, GLsizei count, const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 4);
+}
+
+void GLAPIENTRY
+_mesa_Uniform1iv(GLint location, GLsizei count, const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 1);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2iv(GLint location, GLsizei count, const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3iv(GLint location, GLsizei count, const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4iv(GLint location, GLsizei count, const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 4);
+}
+
+/** Same as above with direct state access **/
+void GLAPIENTRY
+_mesa_ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform1f");
+ _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_FLOAT, 1);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat v[2];
+ struct gl_shader_program *shProg;
+ v[0] = v0;
+ v[1] = v1;
+ shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2f");
+ _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_FLOAT, 2);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1,
+ GLfloat v2)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat v[3];
+ struct gl_shader_program *shProg;
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3f");
+ _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_FLOAT, 3);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1,
+ GLfloat v2, GLfloat v3)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat v[4];
+ struct gl_shader_program *shProg;
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
+ shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4f");
+ _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_FLOAT, 4);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform1i(GLuint program, GLint location, GLint v0)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform1i");
+ _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_INT, 1);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint v[2];
+ struct gl_shader_program *shProg;
+ v[0] = v0;
+ v[1] = v1;
+ shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2i");
+ _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT, 2);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1,
+ GLint v2)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint v[3];
+ struct gl_shader_program *shProg;
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3i");
+ _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT, 3);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1,
+ GLint v2, GLint v3)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint v[4];
+ struct gl_shader_program *shProg;
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
+ shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4i");
+ _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT, 4);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform1fv(GLuint program, GLint location, GLsizei count,
+ const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform1fv");
+ _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 1);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform2fv(GLuint program, GLint location, GLsizei count,
+ const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform2fv");
+ _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 2);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform3fv(GLuint program, GLint location, GLsizei count,
+ const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform3fv");
+ _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 3);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform4fv(GLuint program, GLint location, GLsizei count,
+ const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform4fv");
+ _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 4);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform1iv(GLuint program, GLint location, GLsizei count,
+ const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform1iv");
+ _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 1);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform2iv(GLuint program, GLint location, GLsizei count,
+ const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform2iv");
+ _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 2);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform3iv(GLuint program, GLint location, GLsizei count,
+ const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform3iv");
+ _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 3);
+}
+
+void GLAPIENTRY
+_mesa_ProgramUniform4iv(GLuint program, GLint location, GLsizei count,
+ const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program,
+ "glProgramUniform4iv");
+ _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 4);
+}
+
+
+/** OpenGL 3.0 GLuint-valued functions **/
+void GLAPIENTRY
+_mesa_Uniform1ui(GLint location, GLuint v0)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_UINT, 1);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint v[2];
+ v[0] = v0;
+ v[1] = v1;
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint v[3];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint v[4];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 4);
+}
+
+void GLAPIENTRY
+_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 1);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 4);
+}
+
+