class TGlslangToSpvTraverser : public glslang::TIntermTraverser {
public:
TGlslangToSpvTraverser(const glslang::TIntermediate*, spv::SpvBuildLogger* logger);
- virtual ~TGlslangToSpvTraverser();
+ virtual ~TGlslangToSpvTraverser() { }
bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate*);
bool visitBinary(glslang::TVisit, glslang::TIntermBinary*);
bool visitLoop(glslang::TVisit, glslang::TIntermLoop*);
bool visitBranch(glslang::TVisit visit, glslang::TIntermBranch*);
+ void finishSpv();
void dumpSpv(std::vector<unsigned int>& out);
protected:
default:
break;
}
-
}
-// Finish everything and dump
-void TGlslangToSpvTraverser::dumpSpv(std::vector<unsigned int>& out)
+// Finish creating SPV, after the traversal is complete.
+void TGlslangToSpvTraverser::finishSpv()
{
+ if (! mainTerminated) {
+ builder.setBuildPoint(shaderEntry->getLastBlock());
+ builder.leaveFunction();
+ }
+
// finish off the entry-point SPV instruction by adding the Input/Output <id>
for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it)
entryPoint->addIdOperand(*it);
builder.eliminateDeadDecorations();
- builder.dump(out);
}
-TGlslangToSpvTraverser::~TGlslangToSpvTraverser()
+// Write the SPV into 'out'.
+void TGlslangToSpvTraverser::dumpSpv(std::vector<unsigned int>& out)
{
- if (! mainTerminated) {
- spv::Block* lastMainBlock = shaderEntry->getLastBlock();
- builder.setBuildPoint(lastMainBlock);
- builder.leaveFunction();
- }
+ builder.dump(out);
}
//
glslang::GetThreadPoolAllocator().push();
TGlslangToSpvTraverser it(&intermediate, logger);
-
root->traverse(&it);
-
+ it.finishSpv();
it.dumpSpv(spirv);
glslang::GetThreadPoolAllocator().pop();
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
-#define GLSLANG_REVISION "Overload400-PrecQual.1650"
-#define GLSLANG_DATE "14-Nov-2016"
+#define GLSLANG_REVISION "Overload400-PrecQual.1659"
+#define GLSLANG_DATE "26-Nov-2016"