1) Don't propagate precision of built-in function arguments to return type when return type is bool (e.g., isnan).

2) Check an additional path for missing default precision qualification, except allow built-in declarations to pass the check.  

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22241 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-07-01 17:56:24 +00:00
parent 6c0928d924
commit 1fde51d3fb
6 changed files with 17 additions and 9 deletions

View file

@ -40,11 +40,11 @@
#include <stdarg.h>
#include <algorithm>
TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, int v, EProfile p, EShLanguage L, TInfoSink& is,
TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, bool pb, int v, EProfile p, EShLanguage L, TInfoSink& is,
bool fc, EShMessages m) :
intermediate(interm), symbolTable(symt), infoSink(is), language(L), treeRoot(0), linkage(0),
numErrors(0), lexAfterType(false), loopNestingLevel(0),
structNestingLevel(0), inTypeParen(false),
structNestingLevel(0), inTypeParen(false), parsingBuiltins(pb),
version(v), profile(p), forwardCompatible(fc), messages(m),
contextPragma(true, false)
{
@ -885,12 +885,17 @@ TPrecisionQualifier TParseContext::getDefaultPrecision(TPublicType& publicType)
void TParseContext::precisionQualifierCheck(int line, TPublicType& publicType)
{
if (profile != EEsProfile)
// Built-in symbols are allowed some ambiguous precisions, to be pinned down
// later by context.
if (profile != EEsProfile || parsingBuiltins)
return;
if (publicType.basicType == EbtFloat || publicType.basicType == EbtUint || publicType.basicType == EbtInt || publicType.basicType == EbtSampler) {
if (publicType.qualifier.precision == EpqNone)
if (publicType.qualifier.precision == EpqNone) {
error(line, "type requires declaration of default precision qualifier", TType::getBasicString(publicType.basicType), "");
publicType.qualifier.precision = EpqMedium;
defaultPrecision[publicType.basicType] = EpqMedium;
}
} else if (publicType.qualifier.precision != EpqNone)
error(line, "type cannot have precision qualifier", TType::getBasicString(publicType.basicType), "");
}