summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp')
-rw-r--r--src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp74
1 files changed, 10 insertions, 64 deletions
diff --git a/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
index 1bf1181af0..a5ea71599d 100644
--- a/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
+++ b/src/3rdparty/angle/src/compiler/translator/OutputHLSL.cpp
@@ -21,6 +21,7 @@
#include "compiler/translator/util.h"
#include "compiler/translator/UniformHLSL.h"
#include "compiler/translator/StructureHLSL.h"
+#include "compiler/translator/TranslatorHLSL.h"
#include <algorithm>
#include <cfloat>
@@ -93,8 +94,10 @@ bool OutputHLSL::TextureFunction::operator<(const TextureFunction &rhs) const
return false;
}
-OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resources, ShShaderOutput outputType)
- : TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
+OutputHLSL::OutputHLSL(TParseContext &context, TranslatorHLSL *parentTranslator)
+ : TIntermTraverser(true, true, true),
+ mContext(context),
+ mOutputType(parentTranslator->getOutputType())
{
mUnfoldShortCircuit = new UnfoldShortCircuit(context, this);
mInsideFunction = false;
@@ -126,6 +129,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
mUsesDiscardRewriting = false;
mUsesNestedBreak = false;
+ const ShBuiltInResources &resources = parentTranslator->getResources();
mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
mUniqueIndex = 0;
@@ -138,7 +142,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
mExcessiveLoopIndex = NULL;
mStructureHLSL = new StructureHLSL;
- mUniformHLSL = new UniformHLSL(mStructureHLSL, mOutputType);
+ mUniformHLSL = new UniformHLSL(mStructureHLSL, parentTranslator);
if (mOutputType == SH_HLSL9_OUTPUT)
{
@@ -212,31 +216,6 @@ TInfoSinkBase &OutputHLSL::getBodyStream()
return mBody;
}
-const std::vector<sh::Uniform> &OutputHLSL::getUniforms()
-{
- return mUniformHLSL->getUniforms();
-}
-
-const std::vector<sh::InterfaceBlock> &OutputHLSL::getInterfaceBlocks() const
-{
- return mUniformHLSL->getInterfaceBlocks();
-}
-
-const std::vector<sh::Attribute> &OutputHLSL::getOutputVariables() const
-{
- return mActiveOutputVariables;
-}
-
-const std::vector<sh::Attribute> &OutputHLSL::getAttributes() const
-{
- return mActiveAttributes;
-}
-
-const std::vector<sh::Varying> &OutputHLSL::getVaryings() const
-{
- return mActiveVaryings;
-}
-
const std::map<std::string, unsigned int> &OutputHLSL::getInterfaceBlockRegisterMap() const
{
return mUniformHLSL->getInterfaceBlockRegisterMap();
@@ -324,8 +303,6 @@ void OutputHLSL::header()
// Program linking depends on this exact format
varyings += "static " + InterpolationString(type.getQualifier()) + " " + TypeString(type) + " " +
Decorate(name) + ArrayString(type) + " = " + initializer(type) + ";\n";
-
- declareVaryingToList(type, type.getQualifier(), name, mActiveVaryings);
}
for (ReferencedSymbols::const_iterator attribute = mReferencedAttributes.begin(); attribute != mReferencedAttributes.end(); attribute++)
@@ -334,10 +311,6 @@ void OutputHLSL::header()
const TString &name = attribute->second->getSymbol();
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);
- mActiveAttributes.push_back(attributeVar);
}
out << mStructureHLSL->structsHeader();
@@ -370,14 +343,9 @@ void OutputHLSL::header()
{
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);
- mActiveOutputVariables.push_back(outputVar);
}
}
else
@@ -1951,6 +1919,9 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
out << ", ";
}
break;
+ case EOpInvariantDeclaration:
+ // Do not do any translation
+ return false;
case EOpPrototype:
if (visit == PreVisit)
{
@@ -2910,29 +2881,4 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con
return constUnion;
}
-class DeclareVaryingTraverser : public GetVariableTraverser<Varying>
-{
- public:
- DeclareVaryingTraverser(std::vector<Varying> *output,
- InterpolationType interpolation)
- : GetVariableTraverser(output),
- mInterpolation(interpolation)
- {}
-
- private:
- void visitVariable(Varying *varying)
- {
- varying->interpolation = mInterpolation;
- }
-
- InterpolationType mInterpolation;
-};
-
-void OutputHLSL::declareVaryingToList(const TType &type, TQualifier baseTypeQualifier,
- const TString &name, std::vector<Varying> &fieldsOut)
-{
- DeclareVaryingTraverser traverser(&fieldsOut, GetInterpolationType(baseTypeQualifier));
- traverser.traverse(type, name);
-}
-
}