Fix nameless struct handling.
BUG=401296
The addition of layout qualifier handling in es3 development inadvertently
broke handling of nameless structs.
Change-Id: I805bab7a981d1f7f6227ae043720296fc3454662
Reviewed-on: https://chromium-review.googlesource.com/211860
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/compiler/translator/UniformHLSL.cpp b/src/compiler/translator/UniformHLSL.cpp
index 59829bd..1c0af19 100644
--- a/src/compiler/translator/UniformHLSL.cpp
+++ b/src/compiler/translator/UniformHLSL.cpp
@@ -137,7 +137,12 @@
else
{
const TStructure *structure = type.getStruct();
- const TString &typeName = (structure ? QualifiedStructNameString(*structure, false, false) : TypeString(type));
+ // If this is a nameless struct, we need to use its full definition, rather than its (empty) name.
+ // TypeString() will invoke defineNameless in this case, but layout qualifiers will not be taken into
+ // account in this case.
+ // TODO: handle nameless structs with layout qualifiers.
+ const TString &typeName = ((structure && !structure->name().empty()) ?
+ QualifiedStructNameString(*structure, false, false) : TypeString(type));
const TString ®isterString = TString("register(") + UniformRegisterPrefix(type) + str(registerIndex) + ")";