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>
Conflicts:
src/compiler/translator/UniformHLSL.cpp
Change-Id: I2f9fca71cef383c1a48c9bcdbe1083ac3222fac0
Reviewed-on: https://chromium-review.googlesource.com/212153
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 5520c86..5cc2c14 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -582,7 +582,11 @@
else
{
const TStructure *structure = type.getStruct();
- const TString &typeName = (structure ? structureTypeName(*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, if relevant, will not
+ // be taken into account.
+ const TString &typeName = ((structure && !structure->name().empty()) ?
+ structureTypeName(*structure, false, false) : typeString(type));
const TString ®isterString = TString("register(") + RegisterPrefix(type) + str(registerIndex) + ")";