Simplify the gl::Varying struct to be more like sh::Varying.
The subsequent patches will remove gl::Varying entirely.
TRAC #23746
Signed-off-by: Nicolas Capens
Signed-off-by: Shannon Woods
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index 972d10a..f5d3830 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -3643,18 +3643,42 @@
}
}
+InterpolationType getInterpolationType(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqFlatIn:
+ case EvqFlatOut:
+ return INTERPOLATION_FLAT;
+
+ case EvqSmoothIn:
+ case EvqSmoothOut:
+ case EvqVertexOut:
+ case EvqFragmentIn:
+ return INTERPOLATION_SMOOTH;
+
+ case EvqCentroidIn:
+ case EvqCentroidOut:
+ return INTERPOLATION_CENTROID;
+
+ default: UNREACHABLE();
+ return INTERPOLATION_SMOOTH;
+ }
+}
+
void OutputHLSL::declareVaryingToList(const TType &type, const TString &name, std::vector<Varying>& fieldsOut)
{
const TStructure *structure = type.getStruct();
+ InterpolationType interpolation = getInterpolationType(type.getQualifier());
if (!structure)
{
- Varying varying(glVariableType(type), glVariablePrecision(type), name.c_str(), (unsigned int)type.getArraySize());
+ Varying varying(glVariableType(type), glVariablePrecision(type), name.c_str(), (unsigned int)type.getArraySize(), interpolation);
fieldsOut.push_back(varying);
}
else
{
- Varying structVarying(GL_NONE, GL_NONE, name.c_str(), (unsigned int)type.getArraySize());
+ Varying structVarying(GL_NONE, GL_NONE, name.c_str(), (unsigned int)type.getArraySize(), interpolation);
const TFieldList &fields = structure->fields();
for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)