diff --git a/src/compiler/translator/Types.cpp b/src/compiler/translator/Types.cpp index c0882da9b1..77d4ff9b8b 100644 --- a/src/compiler/translator/Types.cpp +++ b/src/compiler/translator/Types.cpp @@ -472,12 +472,21 @@ const char *TType::buildMangledName() const { mangledName += mStructure->name().data(); } + // Separator between the user-chosen struct name and the mangled + // field list. The field-list mangling alphabet ([0-9A-F][01][A-Za-z]) + // is a subset of the GLSL identifier alphabet, so without a + // separator two structurally distinct structs can produce the + // same mangled name (e.g. struct A00B{vec4 y;} vs + // struct A{float x;vec4 y;}). ';' is not a valid GLSL identifier + // character and is not produced by any other mangling routine. + mangledName += ';'; mangledName += mStructure->mangledFieldList(); mangledName += '}'; break; case EbtInterfaceBlock: mangledName += "{i"; mangledName += mInterfaceBlock->name().data(); + mangledName += ';'; mangledName += mInterfaceBlock->mangledFieldList(); mangledName += '}'; break;