mesa: Arrange _mesa_uniform parameters to match the call sites

By putting the parameters first that match the parameters to the call
site, 4 (of 14) instructions are saved at _mesa_Uniform4fv on x64.  On
IA32, the details of the instructions change, but it is the same count
and mix of instructions.

Before:

0000000000000830 <_mesa_Uniform4fv>:
     830:       48 83 ec 10             sub    $0x10,%rsp
     834:       49 89 d0                mov    %rdx,%r8
     837:       48 8b 15 00 00 00 00    mov    0x0(%rip),%rdx        # 83e <_mesa_Uniform4fv+0xe>
     83e:       89 f8                   mov    %edi,%eax
     840:       89 f1                   mov    %esi,%ecx
     842:       41 b9 02 00 00 00       mov    $0x2,%r9d
     848:       64 48 8b 3a             mov    %fs:(%rdx),%rdi
     84c:       48 8b 97 c8 01 02 00    mov    0x201c8(%rdi),%rdx
     853:       48 8b 72 70             mov    0x70(%rdx),%rsi
     857:       6a 04                   pushq  $0x4
     859:       89 c2                   mov    %eax,%edx
     85b:       e8 00 00 00 00          callq  860 <_mesa_Uniform4fv+0x30>
     860:       48 83 c4 18             add    $0x18,%rsp
     864:       c3                      retq

After:

00000000000007f0 <_mesa_Uniform4fv>:
     7f0:       48 83 ec 10             sub    $0x10,%rsp
     7f4:       48 8b 05 00 00 00 00    mov    0x0(%rip),%rax        # 7fb <_mesa_Uniform4fv+0xb>
     7fb:       41 b9 02 00 00 00       mov    $0x2,%r9d
     801:       64 48 8b 08             mov    %fs:(%rax),%rcx
     805:       48 8b 81 c8 01 02 00    mov    0x201c8(%rcx),%rax
     80c:       6a 04                   pushq  $0x4
     80e:       4c 8b 40 70             mov    0x70(%rax),%r8
     812:       e8 00 00 00 00          callq  817 <_mesa_Uniform4fv+0x27>
     817:       48 83 c4 18             add    $0x18,%rsp
     81b:       c3                      retq

Saves a measly 416 bytes of text on x64.  Depending on exactly when this
is applied, a lot of variation is possible due to function alignment.

   text	   data	    bss	    dec	    hex	filename
6670131	 228340	  22552	6921023	 699b3f	lib/i965_dri.so before
6670131	 228340	  22552	6921023	 699b3f	lib/i965_dri.so after
6343348	 293872	  29880	6667100	 65bb5c	lib64/i965_dri.so before
6342932	 293872	  29880	6666684	 65b9bc	lib64/i965_dri.so after

There is likely to be no performance change with just this patch.
_mesa_uniform immediately calls validate_uniform_parameters with
parameters in the "wrong" (different from the call site) order.

v2: Rebase on GL_ARB_gpu_shader_fp64.

v3: Rebase on GL_ARB_gpu_shader_int64.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 0275e4f..ef51571 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -771,11 +771,9 @@
  * Called via glUniform*() functions.
  */
 extern "C" void
-_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
-	      GLint location, GLsizei count,
-              const GLvoid *values,
-              enum glsl_base_type basicType,
-              unsigned src_components)
+_mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
+              struct gl_context *ctx, struct gl_shader_program *shProg,
+              enum glsl_base_type basicType, unsigned src_components)
 {
    unsigned offset;
    int size_mul = glsl_base_type_is_64bit(basicType) ? 2 : 1;
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index c1d951a..a954055 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -150,7 +150,7 @@
 _mesa_Uniform1f(GLint location, GLfloat v0)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_FLOAT, 1);
+   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 1);
 }
 
 void GLAPIENTRY
@@ -160,7 +160,7 @@
    GLfloat v[2];
    v[0] = v0;
    v[1] = v1;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 2);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 2);
 }
 
 void GLAPIENTRY
@@ -171,7 +171,7 @@
    v[0] = v0;
    v[1] = v1;
    v[2] = v2;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 3);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_FLOAT, 3);
 }
 
 void GLAPIENTRY
@@ -184,14 +184,14 @@
    v[1] = v1;
    v[2] = v2;
    v[3] = v3;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 4);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 1);
 }
 
 void GLAPIENTRY
@@ -201,7 +201,7 @@
    GLint v[2];
    v[0] = v0;
    v[1] = v1;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 2);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 2);
 }
 
 void GLAPIENTRY
@@ -212,7 +212,7 @@
    v[0] = v0;
    v[1] = v1;
    v[2] = v2;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 3);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 3);
 }
 
 void GLAPIENTRY
@@ -224,63 +224,63 @@
    v[1] = v1;
    v[2] = v2;
    v[3] = v3;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 4);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT, 4);
 }
 
 /** Same as above with direct state access **/
@@ -291,7 +291,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform1f");
-   _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_FLOAT, 1);
+   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_FLOAT, 1);
 }
 
 void GLAPIENTRY
@@ -303,7 +303,7 @@
    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);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 2);
 }
 
 void GLAPIENTRY
@@ -317,7 +317,7 @@
    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);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 3);
 }
 
 void GLAPIENTRY
@@ -332,7 +332,7 @@
    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);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_FLOAT, 4);
 }
 
 void GLAPIENTRY
@@ -342,7 +342,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform1i");
-   _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_INT, 1);
+   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_INT, 1);
 }
 
 void GLAPIENTRY
@@ -354,7 +354,7 @@
    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);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 2);
 }
 
 void GLAPIENTRY
@@ -368,7 +368,7 @@
    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);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 3);
 }
 
 void GLAPIENTRY
@@ -383,7 +383,7 @@
    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);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT, 4);
 }
 
 void GLAPIENTRY
@@ -394,7 +394,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform1fv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 1);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 1);
 }
 
 void GLAPIENTRY
@@ -405,7 +405,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform2fv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 2);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 2);
 }
 
 void GLAPIENTRY
@@ -416,7 +416,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform3fv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 3);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 3);
 }
 
 void GLAPIENTRY
@@ -427,7 +427,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform4fv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 4);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_FLOAT, 4);
 }
 
 void GLAPIENTRY
@@ -438,7 +438,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform1iv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 1);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 1);
 }
 
 void GLAPIENTRY
@@ -449,7 +449,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform2iv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 2);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 2);
 }
 
 void GLAPIENTRY
@@ -460,7 +460,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform3iv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 3);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 3);
 }
 
 void GLAPIENTRY
@@ -471,7 +471,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform4iv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 4);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT, 4);
 }
 
 
@@ -480,7 +480,7 @@
 _mesa_Uniform1ui(GLint location, GLuint v0)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_UINT, 1);
+   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 1);
 }
 
 void GLAPIENTRY
@@ -490,7 +490,7 @@
    GLuint v[2];
    v[0] = v0;
    v[1] = v1;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 2);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 2);
 }
 
 void GLAPIENTRY
@@ -501,7 +501,7 @@
    v[0] = v0;
    v[1] = v1;
    v[2] = v2;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 3);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 3);
 }
 
 void GLAPIENTRY
@@ -513,35 +513,35 @@
    v[1] = v1;
    v[2] = v2;
    v[3] = v3;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 4);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, 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);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT, 4);
 }
 
 
@@ -582,7 +582,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform1ui");
-   _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_UINT, 1);
+   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_UINT, 1);
 }
 
 void GLAPIENTRY
@@ -595,7 +595,7 @@
    v[1] = v1;
    shProg = _mesa_lookup_shader_program_err(ctx, program,
                                             "glProgramUniform2ui");
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT, 2);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 2);
 }
 
 void GLAPIENTRY
@@ -610,7 +610,7 @@
    v[2] = v2;
    shProg = _mesa_lookup_shader_program_err(ctx, program,
                                             "glProgramUniform3ui");
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT, 3);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 3);
 }
 
 void GLAPIENTRY
@@ -625,7 +625,7 @@
    v[2] = v2;
    v[3] = v3;
    shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4ui");
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT, 4);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT, 4);
 }
 
 void GLAPIENTRY
@@ -636,7 +636,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform1uiv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 1);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 1);
 }
 
 void GLAPIENTRY
@@ -647,7 +647,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform2uiv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 2);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 2);
 }
 
 void GLAPIENTRY
@@ -658,7 +658,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform3uiv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 3);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 3);
 }
 
 void GLAPIENTRY
@@ -669,7 +669,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform4uiv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 4);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT, 4);
 }
 
 
@@ -1299,7 +1299,7 @@
 _mesa_Uniform1d(GLint location, GLdouble v0)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_DOUBLE, 1);
+   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 1);
 }
 
 void GLAPIENTRY
@@ -1309,7 +1309,7 @@
    GLdouble v[2];
    v[0] = v0;
    v[1] = v1;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_DOUBLE, 2);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 2);
 }
 
 void GLAPIENTRY
@@ -1320,7 +1320,7 @@
    v[0] = v0;
    v[1] = v1;
    v[2] = v2;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_DOUBLE, 3);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 3);
 }
 
 void GLAPIENTRY
@@ -1333,35 +1333,35 @@
    v[1] = v1;
    v[2] = v2;
    v[3] = v3;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_DOUBLE, 4);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 4);
 }
 
 void GLAPIENTRY
 _mesa_Uniform1dv(GLint location, GLsizei count, const GLdouble * value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_DOUBLE, 1);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 1);
 }
 
 void GLAPIENTRY
 _mesa_Uniform2dv(GLint location, GLsizei count, const GLdouble * value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_DOUBLE, 2);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 2);
 }
 
 void GLAPIENTRY
 _mesa_Uniform3dv(GLint location, GLsizei count, const GLdouble * value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_DOUBLE, 3);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 3);
 }
 
 void GLAPIENTRY
 _mesa_Uniform4dv(GLint location, GLsizei count, const GLdouble * value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_DOUBLE, 4);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_DOUBLE, 4);
 }
 
 void GLAPIENTRY
@@ -1452,7 +1452,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform1d");
-   _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_DOUBLE, 1);
+   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_DOUBLE, 1);
 }
 
 void GLAPIENTRY
@@ -1464,7 +1464,7 @@
    v[0] = v0;
    v[1] = v1;
    shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2d");
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_DOUBLE, 2);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 2);
 }
 
 void GLAPIENTRY
@@ -1478,7 +1478,7 @@
    v[1] = v1;
    v[2] = v2;
    shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3d");
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_DOUBLE, 3);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 3);
 }
 
 void GLAPIENTRY
@@ -1493,7 +1493,7 @@
    v[2] = v2;
    v[3] = v3;
    shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4d");
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_DOUBLE, 4);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_DOUBLE, 4);
 }
 
 void GLAPIENTRY
@@ -1504,7 +1504,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform1dv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_DOUBLE, 1);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 1);
 }
 
 void GLAPIENTRY
@@ -1515,7 +1515,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform2dv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_DOUBLE, 2);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 2);
 }
 
 void GLAPIENTRY
@@ -1526,7 +1526,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform3dv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_DOUBLE, 3);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 3);
 }
 
 void GLAPIENTRY
@@ -1537,7 +1537,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform4dv");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_DOUBLE, 4);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_DOUBLE, 4);
 }
 
 void GLAPIENTRY
@@ -1652,7 +1652,7 @@
 _mesa_Uniform1i64ARB(GLint location, GLint64 v0)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_INT64, 1);
+   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 1);
 }
 
 void GLAPIENTRY
@@ -1662,7 +1662,7 @@
    int64_t v[2];
    v[0] = v0;
    v[1] = v1;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT64, 2);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 2);
 }
 
 void GLAPIENTRY
@@ -1673,7 +1673,7 @@
    v[0] = v0;
    v[1] = v1;
    v[2] = v2;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT64, 3);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 3);
 }
 
 void GLAPIENTRY
@@ -1685,42 +1685,42 @@
    v[1] = v1;
    v[2] = v2;
    v[3] = v3;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT64, 4);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 4);
 }
 
 void GLAPIENTRY
 _mesa_Uniform1i64vARB(GLint location, GLsizei count, const GLint64 *value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT64, 1);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 1);
 }
 
 void GLAPIENTRY
 _mesa_Uniform2i64vARB(GLint location,  GLsizei count, const GLint64 *value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT64, 2);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 2);
 }
 
 void GLAPIENTRY
 _mesa_Uniform3i64vARB(GLint location,  GLsizei count, const GLint64 *value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT64, 3);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 3);
 }
 
 void GLAPIENTRY
 _mesa_Uniform4i64vARB(GLint location,  GLsizei count, const GLint64 *value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT64, 4);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_INT64, 4);
 }
 
 void GLAPIENTRY
 _mesa_Uniform1ui64ARB(GLint location,  GLuint64 v0)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_UINT64, 1);
+   _mesa_uniform(location, 1, &v0, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 1);
 }
 
 void GLAPIENTRY
@@ -1730,7 +1730,7 @@
    uint64_t v[2];
    v[0] = v0;
    v[1] = v1;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT64, 2);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 2);
 }
 
 void GLAPIENTRY
@@ -1741,7 +1741,7 @@
    v[0] = v0;
    v[1] = v1;
    v[2] = v2;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT64, 3);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 3);
 }
 
 void GLAPIENTRY
@@ -1753,35 +1753,35 @@
    v[1] = v1;
    v[2] = v2;
    v[3] = v3;
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT64, 4);
+   _mesa_uniform(location, 1, v, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 4);
 }
 
 void GLAPIENTRY
 _mesa_Uniform1ui64vARB(GLint location,  GLsizei count, const GLuint64 *value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT64, 1);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 1);
 }
 
 void GLAPIENTRY
 _mesa_Uniform2ui64vARB(GLint location,  GLsizei count, const GLuint64 *value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT64, 2);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 2);
 }
 
 void GLAPIENTRY
 _mesa_Uniform3ui64vARB(GLint location,  GLsizei count, const GLuint64 *value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT64, 3);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 3);
 }
 
 void GLAPIENTRY
 _mesa_Uniform4ui64vARB(GLint location,  GLsizei count, const GLuint64 *value)
 {
    GET_CURRENT_CONTEXT(ctx);
-   _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT64, 4);
+   _mesa_uniform(location, count, value, ctx, ctx->_Shader->ActiveProgram, GLSL_TYPE_UINT64, 4);
 }
 
 /* DSA entrypoints */
@@ -1792,7 +1792,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
             "glProgramUniform1i64ARB");
-   _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_INT64, 1);
+   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_INT64, 1);
 }
 
 void GLAPIENTRY
@@ -1805,7 +1805,7 @@
    int64_t v[2];
    v[0] = v0;
    v[1] = v1;
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT64, 2);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 2);
 }
 
 void GLAPIENTRY
@@ -1819,7 +1819,7 @@
    v[0] = v0;
    v[1] = v1;
    v[2] = v2;
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT64, 3);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 3);
 }
 
 void GLAPIENTRY
@@ -1834,7 +1834,7 @@
    v[1] = v1;
    v[2] = v2;
    v[3] = v3;
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT64, 4);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_INT64, 4);
 }
 
 void GLAPIENTRY
@@ -1844,7 +1844,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
                                       "glProgramUniform1i64vARB");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT64, 1);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 1);
 }
 
 void GLAPIENTRY
@@ -1854,7 +1854,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
                                       "glProgramUniform2i64vARB");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT64, 2);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 2);
 }
 
 void GLAPIENTRY
@@ -1864,7 +1864,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
                                       "glProgramUniform3i64vARB");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT64, 3);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 3);
 }
 
 void GLAPIENTRY
@@ -1874,7 +1874,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
                                       "glProgramUniform4i64vARB");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT64, 4);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_INT64, 4);
 }
 
 void GLAPIENTRY
@@ -1884,7 +1884,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
                                       "glProgramUniform1ui64ARB");
-   _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_UINT64, 1);
+   _mesa_uniform(location, 1, &v0, ctx, shProg, GLSL_TYPE_UINT64, 1);
 }
 
 void GLAPIENTRY
@@ -1897,7 +1897,7 @@
    uint64_t v[2];
    v[0] = v0;
    v[1] = v1;
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT64, 2);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 2);
 }
 
 void GLAPIENTRY
@@ -1911,7 +1911,7 @@
    v[0] = v0;
    v[1] = v1;
    v[2] = v2;
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT64, 3);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 3);
 }
 
 void GLAPIENTRY
@@ -1926,7 +1926,7 @@
    v[1] = v1;
    v[2] = v2;
    v[3] = v3;
-   _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT64, 4);
+   _mesa_uniform(location, 1, v, ctx, shProg, GLSL_TYPE_UINT64, 4);
 }
 
 void GLAPIENTRY
@@ -1936,7 +1936,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
                                       "glProgramUniform1ui64vARB");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT64, 1);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 1);
 }
 
 void GLAPIENTRY
@@ -1946,7 +1946,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
                                       "glProgramUniform2ui64vARB");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT64, 2);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 2);
 }
 
 void GLAPIENTRY
@@ -1956,7 +1956,7 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
                                       "glProgramUniform3ui64vARB");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT64, 3);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 3);
 }
 
 void GLAPIENTRY
@@ -1966,5 +1966,5 @@
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program,
                                       "glProgramUniform4ui64vARB");
-   _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT64, 4);
+   _mesa_uniform(location, count, value, ctx, shProg, GLSL_TYPE_UINT64, 4);
 }
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index 2859ad0..0656b3a 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -430,11 +430,9 @@
 _mesa_ProgramUniform4ui64vARB(GLuint, GLint, GLsizei, const GLuint64 *);
 
 void
-_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program,
-	      GLint location, GLsizei count,
-              const GLvoid *values,
-              enum glsl_base_type basicType,
-              unsigned src_components);
+_mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
+              struct gl_context *, struct gl_shader_program *,
+              enum glsl_base_type basicType, unsigned src_components);
 
 void
 _mesa_uniform_matrix(GLint location, GLsizei count,