Mesa (master): mesa: Simplify validate_shader_program after previous refactors

Ian Romanick idr at kemper.freedesktop.org
Fri Oct 7 16:41:05 PDT 2011


Module: Mesa
Branch: master
Commit: 5a4279f80d80fd30452ee6cc7cdfaffb12b1d605
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a4279f80d80fd30452ee6cc7cdfaffb12b1d605

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Sat Aug 20 16:05:43 2011 -0700

mesa: Simplify validate_shader_program after previous refactors

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/shaderapi.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 1583520..c3aabe4 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -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;



More information about the mesa-commit mailing list