Track which extensions were enabled or required, in the intermediate representation, for reflection of the consumer.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@26155 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2014-03-31 22:20:47 +00:00
parent ea4ae7c3ad
commit b4ef9e0d56
119 changed files with 328 additions and 4 deletions

View File

@@ -457,6 +457,8 @@ void TParseContext::updateExtensionBehavior(const char* extension, const char* b
} else {
if (iter->second == EBhDisablePartial)
warn(getCurrentLoc(), "extension is only partially supported:", "#extension", extension);
if (behavior == EBhEnable || behavior == EBhRequire)
intermediate.addRequestedExtension(extension);
iter->second = behavior;
}
}

View File

@@ -579,6 +579,12 @@ bool TOutputTraverser::visitSwitch(TVisit /* visit */, TIntermSwitch* node)
//
void TIntermediate::output(TInfoSink& infoSink, bool tree)
{
infoSink.debug << "Shader version: " << version << "\n";
if (requestedExtensions.size() > 0) {
for (std::set<std::string>::const_iterator extIt = requestedExtensions.begin(); extIt != requestedExtensions.end(); ++extIt)
infoSink.debug << "Requested " << *extIt << "\n";
}
if (xfbMode)
infoSink.debug << "in xfb mode\n";

View File

@@ -131,11 +131,16 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
return;
if (treeRoot == 0) {
version = unit.version;
treeRoot = unit.treeRoot;
version = unit.version;
requestedExtensions = unit.requestedExtensions;
return;
} else
version = std::max(version, unit.version);
}
// Getting this far means we have two existing trees to merge...
version = std::max(version, unit.version);
requestedExtensions.insert(unit.requestedExtensions.begin(), unit.requestedExtensions.end());
// Get the top-level globals of each unit
TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence();

View File

@@ -127,6 +127,9 @@ public:
void setProfile(EProfile p) { profile = p; }
EProfile getProfile() const { return profile; }
EShLanguage getStage() const { return language; }
void addRequestedExtension(const char* extension) { requestedExtensions.insert(extension); }
const std::set<std::string>& getRequestedExtensions() const { return requestedExtensions; }
void setTreeRoot(TIntermNode* r) { treeRoot = r; }
TIntermNode* getTreeRoot() const { return treeRoot; }
void addMainCount() { ++numMains; }
@@ -255,11 +258,11 @@ protected:
bool userOutputUsed() const;
int getBaseAlignmentScalar(const TType&, int& size) const;
protected:
const EShLanguage language;
TIntermNode* treeRoot;
EProfile profile;
int version;
std::set<std::string> requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them
TBuiltInResource resources;
int numMains;
int numErrors;