[Mesa-dev] [PATCH 2/2] glsl: match unnamed record types across stages

f.josef at email.cz f.josef at email.cz
Thu Nov 28 14:14:41 PST 2013


Hello Grigori,
works perfectly - thank you very much!

Kind regards,




Michal


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

uniform struct { ... } a;

if defined in both vertex and fragment shader, will result in two
separate types of different name. 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.
---
src/glsl/linker.cpp | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 1366077..c60753c 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",
-- 
1.8.1.2

_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131128/5185f9f6/attachment.html>


More information about the mesa-dev mailing list