glsl: Remove bogus check on return value of link_uniform_blocks().
authorPaul Berry <stereotype441@gmail.com>
Sat, 27 Jul 2013 22:07:08 +0000 (15:07 -0700)
committerPaul Berry <stereotype441@gmail.com>
Tue, 30 Jul 2013 17:10:25 +0000 (10:10 -0700)
A comment in link_intrastage_shaders(), and an if-test that followed
it, seemed to indicate that link_uniform_blocks() would return a
negative value in the event of an error.  But this is not the
case--all error checking has already been performed by
validate_intrastage_interface_blocks(), and link_uniform_blocks() can
only return unsigned values.

So get rid of the if-test and change the return type of
link_intrastage_shaders() to clarify that it can only return unsigned
values.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/link_uniform_blocks.cpp
src/glsl/linker.cpp
src/glsl/linker.h

index c72d1d8f1de7f056b143376759cc1b0966d5cc31..1083653c7d6db27a1fab50104c2af3d78f938a48 100644 (file)
@@ -137,7 +137,7 @@ struct block {
    bool has_instance_name;
 };
 
-int
+unsigned
 link_uniform_blocks(void *mem_ctx,
                     struct gl_shader_program *prog,
                     struct gl_shader **shader_list,
index ac010cfbb6a84fa4230479402ce548807afc2038..4ffd40e6527e90aab470da724a5bcf12b3daf6e2 100644 (file)
@@ -964,12 +964,10 @@ link_intrastage_shaders(void *mem_ctx,
                                              num_shaders))
       return NULL;
 
-   /* Check that uniform blocks between shaders for a stage agree. */
-   const int num_uniform_blocks =
+   /* Link up uniform blocks defined within this stage. */
+   const unsigned num_uniform_blocks =
       link_uniform_blocks(mem_ctx, prog, shader_list, num_shaders,
                           &uniform_blocks);
-   if (num_uniform_blocks < 0)
-      return NULL;
 
    /* Check that there is only a single definition of each function signature
     * across all shaders.
index 2fe2410c220f18e9bdd2ee17b327f1a75a4fa595..85a6817d98d147a458d75f3cc21e46ae8b875ab4 100644 (file)
@@ -53,7 +53,7 @@ extern bool
 link_uniform_blocks_are_compatible(const gl_uniform_block *a,
                                   const gl_uniform_block *b);
 
-extern int
+extern unsigned
 link_uniform_blocks(void *mem_ctx,
                     struct gl_shader_program *prog,
                     struct gl_shader **shader_list,