Commit 94599669 by Jamie Madill

Ensure struct varyings maintain the proper interpolation qualifier for the child fields.

TRAC #23749 Signed-off-by: Geoff Lang Signed-off-by: Nicolas Capens
parent 86a97a1a
......@@ -635,7 +635,7 @@ void OutputHLSL::header()
varyings += "static " + interpolationString(type.getQualifier()) + " " + typeString(type) + " " +
decorate(name) + arrayString(type) + " = " + initializer(type) + ";\n";
declareVaryingToList(type, name, mActiveVaryings);
declareVaryingToList(type, type.getQualifier(), name, mActiveVaryings);
}
for (ReferencedSymbols::const_iterator attribute = mReferencedAttributes.begin(); attribute != mReferencedAttributes.end(); attribute++)
......@@ -3646,11 +3646,11 @@ InterpolationType getInterpolationType(TQualifier qualifier)
}
}
void OutputHLSL::declareVaryingToList(const TType &type, const TString &name, std::vector<Varying>& fieldsOut)
void OutputHLSL::declareVaryingToList(const TType &type, TQualifier baseTypeQualifier, const TString &name, std::vector<Varying>& fieldsOut)
{
const TStructure *structure = type.getStruct();
InterpolationType interpolation = getInterpolationType(type.getQualifier());
InterpolationType interpolation = getInterpolationType(baseTypeQualifier);
if (!structure)
{
Varying varying(glVariableType(type), glVariablePrecision(type), name.c_str(), (unsigned int)type.getArraySize(), interpolation);
......@@ -3664,7 +3664,7 @@ void OutputHLSL::declareVaryingToList(const TType &type, const TString &name, st
for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
{
const TField &field = *fields[fieldIndex];
declareVaryingToList(*field.type(), field.name(), structVarying.fields);
declareVaryingToList(*field.type(), baseTypeQualifier, field.name(), structVarying.fields);
}
fieldsOut.push_back(structVarying);
......
......@@ -180,7 +180,7 @@ class OutputHLSL : public TIntermTraverser
void declareInterfaceBlockField(const TType &type, const TString &name, std::vector<InterfaceBlockField>& output);
Uniform declareUniformToList(const TType &type, const TString &name, int registerIndex, std::vector<Uniform>& output);
void declareUniform(const TType &type, const TString &name, int index);
void declareVaryingToList(const TType &type, const TString &name, std::vector<Varying>& fieldsOut);
void declareVaryingToList(const TType &type, TQualifier baseTypeQualifier, const TString &name, std::vector<Varying>& fieldsOut);
// Returns the uniform's register index
int declareUniformAndAssignRegister(const TType &type, const TString &name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment