mesa: Simplify validate_shader_program after previous refactors
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 20 Aug 2011 23:05:43 +0000 (16:05 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 7 Oct 2011 23:39:51 +0000 (16:39 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/shaderapi.c

index 1583520391dde93ad31f03c97c8eebed0ec34b0e..c3aabe43f8b21c08c1b7dd36d63a3a4ba5fe2f2a 100644 (file)
@@ -966,9 +966,7 @@ static GLboolean
 validate_shader_program(const struct gl_shader_program *shProg,
                         char *errMsg)
 {
-   const struct gl_shader *vs = shProg->_LinkedShaders[MESA_SHADER_VERTEX];
-   const struct gl_shader *gs = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY];
-   const struct gl_shader *fs = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT];
+   unsigned i;
 
    if (!shProg->LinkStatus) {
       return GL_FALSE;
@@ -994,14 +992,11 @@ validate_shader_program(const struct gl_shader_program *shProg,
     * Check: any two active samplers in the current program object are of
     * different types, but refer to the same texture image unit,
     */
-   if (vs && !validate_samplers(vs->Program, errMsg)) {
-      return GL_FALSE;
-   }
-   if (gs && !validate_samplers(gs->Program, errMsg)) {
-      return GL_FALSE;
-   }
-   if (fs && !validate_samplers(fs->Program, errMsg)) {
-      return GL_FALSE;
+   for (i = 0; i < Elements(shProg->_LinkedShaders); i++) {
+      if (shProg->_LinkedShaders[i]
+         && !validate_samplers(shProg->_LinkedShaders[i]->Program, errMsg)) {
+        return GL_FALSE;
+      }
    }
 
    return GL_TRUE;