Mesa (master): glsl: report correct number of allowed vertex inputs and fragment outputs

Iago Toral Quiroga itoral at kemper.freedesktop.org
Thu Mar 10 07:51:25 UTC 2016


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

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Wed Mar  9 11:48:25 2016 +0100

glsl: report correct number of allowed vertex inputs and fragment outputs

Before we would always report 16 for both and we would only fail if either
one exceeded 16. Now we fail if the maximum for each is exceeded, even if
it is smaller than 16 and we report the correct maximum.

Also, expand the size of to_assign[] to 32. There is code at the top
of the function handling max_index up to 32, so this just makes the
code more consistent.

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>

---

 src/compiler/glsl/linker.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 4cec107..76b700d 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2417,7 +2417,8 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
 	 /* Reversed because we want a descending order sort below. */
 	 return r->slots - l->slots;
       }
-   } to_assign[16];
+   } to_assign[32];
+   assert(max_index <= 32);
 
    unsigned num_attr = 0;
 
@@ -2625,11 +2626,11 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
 	 continue;
       }
 
-      if (num_attr >= ARRAY_SIZE(to_assign)) {
+      if (num_attr >= max_index) {
          linker_error(prog, "too many %s (max %u)",
                       target_index == MESA_SHADER_VERTEX ?
                       "vertex shader inputs" : "fragment shader outputs",
-                      (unsigned)ARRAY_SIZE(to_assign));
+                      max_index);
          return false;
       }
       to_assign[num_attr].slots = slots;




More information about the mesa-commit mailing list