Update non-default constructors in shadervars.h.
Most of these constructors are unused. Remove the unused ones,
and change the usage of existing constructors to be consistent.
BUG=angle:466,697
Change-Id: I455dd314036e1dfcb8c4690bab577b81dd0e060c
Reviewed-on: https://chromium-review.googlesource.com/208355
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 1bf1181..ed082c9 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -29,6 +29,18 @@
namespace sh
{
+static sh::Attribute MakeAttributeFromType(const TType &type, const TString &name)
+{
+ sh::Attribute attributeVar;
+ attributeVar.type = GLVariableType(type);
+ attributeVar.precision = GLVariablePrecision(type);
+ attributeVar.name = name.c_str();
+ attributeVar.arraySize = static_cast<unsigned int>(type.getArraySize());
+ attributeVar.location = type.getLayoutQualifier().location;
+
+ return attributeVar;
+}
+
TString OutputHLSL::TextureFunction::name() const
{
TString name = "gl_texture";
@@ -335,8 +347,7 @@
attributes += "static " + TypeString(type) + " " + Decorate(name) + ArrayString(type) + " = " + initializer(type) + ";\n";
- sh::Attribute attributeVar(GLVariableType(type), GLVariablePrecision(type), name.c_str(),
- (unsigned int)type.getArraySize(), type.getLayoutQualifier().location);
+ sh::Attribute attributeVar = MakeAttributeFromType(type, name);
mActiveAttributes.push_back(attributeVar);
}
@@ -370,13 +381,11 @@
{
const TString &variableName = outputVariableIt->first;
const TType &variableType = outputVariableIt->second->getType();
- const TLayoutQualifier &layoutQualifier = variableType.getLayoutQualifier();
out << "static " + TypeString(variableType) + " out_" + variableName + ArrayString(variableType) +
" = " + initializer(variableType) + ";\n";
- sh::Attribute outputVar(GLVariableType(variableType), GLVariablePrecision(variableType), variableName.c_str(),
- (unsigned int)variableType.getArraySize(), layoutQualifier.location);
+ sh::Attribute outputVar = MakeAttributeFromType(variableType, variableName);
mActiveOutputVariables.push_back(outputVar);
}
}
diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp
index 6a801ea..db04d88 100644
--- a/src/compiler/translator/ShaderLang.cpp
+++ b/src/compiler/translator/ShaderLang.cpp
@@ -468,7 +468,7 @@
std::vector<sh::ShaderVariable> variables;
for (size_t ii = 0; ii < varInfoArraySize; ++ii)
{
- sh::ShaderVariable var(varInfoArray[ii].type, (sh::GLenum)0, "", varInfoArray[ii].size);
+ sh::ShaderVariable var(varInfoArray[ii].type, varInfoArray[ii].size);
variables.push_back(var);
}
VariablePacker packer;
diff --git a/src/compiler/translator/UniformHLSL.cpp b/src/compiler/translator/UniformHLSL.cpp
index 41a7d2c..59829bd 100644
--- a/src/compiler/translator/UniformHLSL.cpp
+++ b/src/compiler/translator/UniformHLSL.cpp
@@ -162,7 +162,10 @@
unsigned int arraySize = static_cast<unsigned int>(interfaceBlock.arraySize());
unsigned int activeRegister = mInterfaceBlockRegister;
- InterfaceBlock activeBlock(interfaceBlock.name().c_str(), arraySize);
+ InterfaceBlock activeBlock;
+ activeBlock.name = interfaceBlock.name().c_str();
+ activeBlock.arraySize = arraySize;
+
for (unsigned int typeIndex = 0; typeIndex < fieldList.size(); typeIndex++)
{
const TField &field = *fieldList[typeIndex];