Vulkan: Support struct initializers in shaders
Also adds a new test in GLSLTest to validate the initialization of
a struct on the same line as its declaration.
Bug: angleproject:2459
Change-Id: Ib37e20378f8ec76541db26392663bcba03390756
Reviewed-on: https://chromium-review.googlesource.com/1017340
Commit-Queue: Luc Ferron <lucferron@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index fd1958c..14140eb 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -314,11 +314,6 @@
const TStructure *structure = type.getStruct();
declareStruct(structure);
-
- if (structure->symbolType() != SymbolType::Empty)
- {
- mDeclaredStructs.insert(structure->uniqueId().get());
- }
}
else if (type.getBasicType() == EbtInterfaceBlock)
{
@@ -1180,6 +1175,11 @@
out << ";\n";
}
out << "}";
+
+ if (structure->symbolType() != SymbolType::Empty)
+ {
+ mDeclaredStructs.insert(structure->uniqueId().get());
+ }
}
void TOutputGLSLBase::declareInterfaceBlockLayout(const TInterfaceBlock *interfaceBlock)