Option rationalization and minor clean up.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22907 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
8700e9e6d1
commit
94a81fbd31
7 changed files with 74 additions and 66 deletions
|
|
@ -198,9 +198,10 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
|
|||
newConstArray = new TConstUnion[objectSize];
|
||||
for (int i = 0; i < objectSize; i++) {
|
||||
switch (getType().getBasicType()) {
|
||||
case EbtDouble:
|
||||
case EbtFloat:
|
||||
newConstArray[i].setDConst(unionArray[i].getDConst() / rightUnionArray[i].getDConst());
|
||||
break;
|
||||
break;
|
||||
|
||||
case EbtInt:
|
||||
if (rightUnionArray[i] == 0) {
|
||||
|
|
@ -438,6 +439,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType,
|
|||
switch (op) {
|
||||
case EOpNegative:
|
||||
switch (getType().getBasicType()) {
|
||||
case EbtDouble:
|
||||
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
|
||||
case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
|
||||
case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,20 @@ void RemoveConstantUnion(TIntermConstantUnion* node, TIntermTraverser*)
|
|||
delete node;
|
||||
}
|
||||
|
||||
bool RemoveLoop(bool /*preVisit*/ , TIntermLoop* node, TIntermTraverser*)
|
||||
{
|
||||
delete node;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RemoveBranch(bool /*preVisit*/ , TIntermBranch* node, TIntermTraverser*)
|
||||
{
|
||||
delete node;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// Entry point.
|
||||
//
|
||||
|
|
@ -95,12 +109,14 @@ void RemoveAllTreeNodes(TIntermNode* root)
|
|||
{
|
||||
TIntermTraverser it;
|
||||
|
||||
it.visitAggregate = RemoveAggregate;
|
||||
it.visitBinary = RemoveBinary;
|
||||
it.visitConstantUnion = RemoveConstantUnion;
|
||||
it.visitSelection = RemoveSelection;
|
||||
it.visitSymbol = RemoveSymbol;
|
||||
it.visitConstantUnion = RemoveConstantUnion;
|
||||
it.visitBinary = RemoveBinary;
|
||||
it.visitUnary = RemoveUnary;
|
||||
it.visitAggregate = RemoveAggregate;
|
||||
it.visitSelection = RemoveSelection;
|
||||
it.visitLoop = RemoveLoop;
|
||||
it.visitBranch = RemoveBranch;
|
||||
it.visitSwitch = RemoveSwitch;
|
||||
|
||||
it.preVisit = false;
|
||||
|
|
|
|||
|
|
@ -413,10 +413,10 @@ int ShCompile(
|
|||
const int* inputLengths,
|
||||
const EShOptimizationLevel optLevel,
|
||||
const TBuiltInResource* resources,
|
||||
int debugOptions,
|
||||
int debugOptions, // currently unused
|
||||
int defaultVersion, // use 100 for ES environment, 110 for desktop
|
||||
bool forwardCompatible, // give errors for use of deprecated features
|
||||
EShMessages messages // warnings/errors
|
||||
EShMessages messages // warnings/errors/AST; things to print out
|
||||
)
|
||||
{
|
||||
if (! InitThread())
|
||||
|
|
@ -513,6 +513,10 @@ int ShCompile(
|
|||
success = false;
|
||||
intermediate.addSymbolLinkageNodes(parseContext.treeRoot, parseContext.linkage, parseContext.language, symbolTable);
|
||||
|
||||
// Clean up the symbol table before deallocating the pool memory it used.
|
||||
// The AST is self-sufficient now, so it can be done before the rest of compilation/linking.
|
||||
delete symbolTableMemory;
|
||||
|
||||
if (success && parseContext.treeRoot) {
|
||||
if (optLevel == EShOptNoGeneration)
|
||||
parseContext.infoSink.info.message(EPrefixNone, "No errors. No code generation or linking was requested.");
|
||||
|
|
@ -520,7 +524,7 @@ int ShCompile(
|
|||
success = intermediate.postProcess(parseContext.treeRoot, parseContext.language);
|
||||
|
||||
if (success) {
|
||||
if (debugOptions & EDebugOpIntermediate)
|
||||
if (messages & EShMsgAST)
|
||||
intermediate.outputTree(parseContext.treeRoot);
|
||||
|
||||
//
|
||||
|
|
@ -534,15 +538,11 @@ int ShCompile(
|
|||
parseContext.infoSink.info.prefix(EPrefixError);
|
||||
parseContext.infoSink.info << parseContext.numErrors << " compilation errors. No code generated.\n\n";
|
||||
success = false;
|
||||
if (debugOptions & EDebugOpIntermediate)
|
||||
if (messages & EShMsgAST)
|
||||
intermediate.outputTree(parseContext.treeRoot);
|
||||
}
|
||||
|
||||
intermediate.remove(parseContext.treeRoot);
|
||||
|
||||
// Clean up the symbol table before deallocating the pool memory it used.
|
||||
delete symbolTableMemory;
|
||||
|
||||
//
|
||||
// Throw away all the temporary memory used by the compilation process.
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue