[Mesa-dev] [PATCH v2 15/15] glsl linker: compare interface blocks during interstage linking
Jordan Justen
jordan.l.justen at intel.com
Mon Mar 18 16:35:12 PDT 2013
Verify that interface blocks match when linking separate shader
stages into a program.
Fixes piglit glsl-1.50 tests:
* linker/interface-blocks-vs-fs-member-count-mismatch.shader_test
* linker/interface-blocks-vs-fs-member-order-mismatch.shader_test
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/glsl/interface_blocks.cpp | 14 ++++++++++++++
src/glsl/interface_blocks.h | 3 +++
src/glsl/linker.cpp | 3 +++
3 files changed, 20 insertions(+)
diff --git a/src/glsl/interface_blocks.cpp b/src/glsl/interface_blocks.cpp
index f3daccf..4da40b0 100644
--- a/src/glsl/interface_blocks.cpp
+++ b/src/glsl/interface_blocks.cpp
@@ -88,3 +88,17 @@ cross_validate_interface_blocks(struct gl_shader **shader_list,
return ok;
}
+bool
+validate_program_interface_blocks(const struct gl_shader_program *prog)
+{
+ bool ok = true;
+ struct gl_shader *shader_list[2];
+
+ shader_list[0] = prog->_LinkedShaders[MESA_SHADER_VERTEX];
+ shader_list[1] = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
+
+ ok = cross_validate_interface_blocks((struct gl_shader **) &shader_list, 2);
+
+ return ok;
+}
+
diff --git a/src/glsl/interface_blocks.h b/src/glsl/interface_blocks.h
index 76ab725..fa4f873 100644
--- a/src/glsl/interface_blocks.h
+++ b/src/glsl/interface_blocks.h
@@ -29,4 +29,7 @@ bool
cross_validate_interface_blocks(struct gl_shader **shader_list,
unsigned num_shaders);
+bool
+validate_program_interface_blocks(const struct gl_shader_program *prog);
+
#endif /* GLSL_INTERFACE_BLOCKS_H */
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 5bc5132..45c60f6 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1724,6 +1724,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
sh);
}
+ if (!validate_program_interface_blocks(prog))
+ goto done;
+
/* Here begins the inter-stage linking phase. Some initial validation is
* performed, then locations are assigned for uniforms, attributes, and
* varyings.
--
1.7.10.4
More information about the mesa-dev
mailing list