[Mesa-dev] [PATCH 4/4] mesa: Arrange validate_uniform_parameters parameters to match call sites

Ian Romanick idr at freedesktop.org
Wed Jan 25 01:30:15 UTC 2017


From: Ian Romanick <ian.d.romanick at intel.com>

Saves a measly 20 bytes on IA32 and nothing 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
6670111	 228340	  22552	6921003	 699b2b	lib/i965_dri.so after
6342932	 293872	  29880	6666684	 65b9bc	lib64/i965_dri.so before
6342932	 293872	  29880	6666684	 65b9bc	lib64/i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/uniform_query.cpp | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index ef51571..418cfc9 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -156,11 +156,11 @@ _mesa_GetActiveUniformsiv(GLuint program,
 }
 
 static struct gl_uniform_storage *
-validate_uniform_parameters(struct gl_context *ctx,
-			    struct gl_shader_program *shProg,
-			    GLint location, GLsizei count,
-			    unsigned *array_index,
-			    const char *caller)
+validate_uniform_parameters(GLint location, GLsizei count,
+                            unsigned *array_index,
+                            struct gl_context *ctx,
+                            struct gl_shader_program *shProg,
+                            const char *caller)
 {
    if (shProg == NULL) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)", caller);
@@ -284,8 +284,8 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
    unsigned offset;
 
    struct gl_uniform_storage *const uni =
-      validate_uniform_parameters(ctx, shProg, location, 1,
-                                  &offset, "glGetUniform");
+      validate_uniform_parameters(location, 1, &offset,
+                                  ctx, shProg, "glGetUniform");
    if (uni == NULL) {
       /* For glGetUniform, page 264 (page 278 of the PDF) of the OpenGL 2.1
        * spec says:
@@ -779,8 +779,8 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
    int size_mul = glsl_base_type_is_64bit(basicType) ? 2 : 1;
 
    struct gl_uniform_storage *const uni =
-      validate_uniform_parameters(ctx, shProg, location, count,
-                                  &offset, "glUniform");
+      validate_uniform_parameters(location, count, &offset,
+                                  ctx, shProg, "glUniform");
    if (uni == NULL)
       return;
 
@@ -990,8 +990,8 @@ _mesa_uniform_matrix(GLint location, GLsizei count,
 {
    unsigned offset;
    struct gl_uniform_storage *const uni =
-      validate_uniform_parameters(ctx, shProg, location, count,
-                                  &offset, "glUniformMatrix");
+      validate_uniform_parameters(location, count, &offset,
+                                  ctx, shProg, "glUniformMatrix");
    if (uni == NULL)
       return;
 
-- 
2.7.4



More information about the mesa-dev mailing list