Clean up HLSL constructor output
Split generating HLSL struct constructors from generating built-in
type constructors, as these didn't have much in common. Struct
constructors are now only generated when they are needed, as opposed
to before, when they were generated on any use of a struct.
This changes built-in constructor naming to include "_ctor" and gets
rid of having special built-in type names just for constructors.
This will make it easier to do changes to constructor output, for
example to add constructors for structs in std140 layout. This might
be needed to implement SSBOs efficiently.
This includes one bug fix for writing out struct declarations for
varyings.
Also improves const-correctness of accessing structs through TType
in general.
BUG=angleproject:2218
TEST=angle_unittests, angle_end2end_tests
Change-Id: If865fb56f86486b9c4a2c31e016ea16427f4a5fa
Reviewed-on: https://chromium-review.googlesource.com/753883
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index a2776e9..99dc04f 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -306,7 +306,7 @@
// Declare the struct if we have not done so already.
if (type.getBasicType() == EbtStruct && !structDeclared(type.getStruct()))
{
- TStructure *structure = type.getStruct();
+ const TStructure *structure = type.getStruct();
declareStruct(structure);