Mesa (master): glsl: Match unnamed record types across stages.

Matt Turner mattst88 at kemper.freedesktop.org
Tue Jan 21 22:01:17 UTC 2014


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

Author: Grigori Goronzy <greg at chown.ath.cx>
Date:   Wed Nov 27 00:15:06 2013 +0100

glsl: Match unnamed record types across stages.

Unnamed record types are assigned to separate types per stage, e.g. if

uniform struct { ... } a;

is defined in both vertex and fragment shader, two separate types will
result with different names. When linking the shader, this results in a
type conflict. However, there is no reason why this should not be
allowed according to GLSL specifications. Compare and match record types
when linking shader stages to avoid this conflict.

Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/glsl/linker.cpp |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 85a4d38..38a6560 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -609,6 +609,10 @@ cross_validate_globals(struct gl_shader_program *prog,
 		  if (var->type->length != 0) {
 		     existing->type = var->type;
 		  }
+               } else if (var->type->is_record()
+		   && existing->type->is_record()
+		   && existing->type->record_compare(var->type)) {
+		  existing->type = var->type;
 	       } else {
 		  linker_error(prog, "%s `%s' declared as type "
 			       "`%s' and type `%s'\n",




More information about the mesa-commit mailing list