[Mesa-dev] [PATCH 10/12] glsl linker: cross validate interface block types between stages

Jordan Justen jordan.l.justen at intel.com
Tue Mar 12 13:35:48 PDT 2013


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/glsl/linker.cpp |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 57e7a9a..b33df37 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -478,6 +478,7 @@ cross_validate_globals(struct gl_shader_program *prog,
     * them.
     */
    glsl_symbol_table variables;
+   glsl_symbol_table interfaces;
    for (unsigned i = 0; i < num_shaders; i++) {
       if (shader_list[i] == NULL)
 	 continue;
@@ -488,6 +489,18 @@ cross_validate_globals(struct gl_shader_program *prog,
 	 if (var == NULL)
 	    continue;
 
+         if (var->is_in_uniform_block()) {
+            const glsl_type *type = interfaces.get_type(var->interface_type->name);
+            if (type == NULL) {
+               interfaces.add_type(var->interface_type->name, var->interface_type);
+            } else if (type != var->interface_type) {
+               linker_error(prog, "interface block `%s' is inconsistent "
+                            "between shader stages\n",
+                            type->name);
+               return false;
+            }
+         }
+
 	 if (uniforms_only && (var->mode != ir_var_uniform))
 	    continue;
 
-- 
1.7.10.4



More information about the mesa-dev mailing list