Commit c311d355 by John Kessenich

Fix default precision check for formal parameters; it was one level too deep. …

Fix default precision check for formal parameters; it was one level too deep. This will accept more fragment shaders with no default precision before declaring functions. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@29281 e7fa87d3-cd2b-0410-9028-fcbf551c1848
parent 33a5423f
...@@ -2266,27 +2266,27 @@ TPrecisionQualifier TParseContext::getDefaultPrecision(TPublicType& publicType) ...@@ -2266,27 +2266,27 @@ TPrecisionQualifier TParseContext::getDefaultPrecision(TPublicType& publicType)
return defaultPrecision[publicType.basicType]; return defaultPrecision[publicType.basicType];
} }
void TParseContext::precisionQualifierCheck(TSourceLoc loc, TPublicType& publicType) void TParseContext::precisionQualifierCheck(TSourceLoc loc, TBasicType baseType, TQualifier& qualifier)
{ {
// Built-in symbols are allowed some ambiguous precisions, to be pinned down // Built-in symbols are allowed some ambiguous precisions, to be pinned down
// later by context. // later by context.
if (profile != EEsProfile || parsingBuiltins) if (profile != EEsProfile || parsingBuiltins)
return; return;
if (publicType.basicType == EbtAtomicUint && publicType.qualifier.precision != EpqNone && publicType.qualifier.precision != EpqHigh) if (baseType == EbtAtomicUint && qualifier.precision != EpqNone && qualifier.precision != EpqHigh)
error(loc, "atomic counters can only be highp", "atomic_uint", ""); error(loc, "atomic counters can only be highp", "atomic_uint", "");
if (publicType.basicType == EbtFloat || publicType.basicType == EbtUint || publicType.basicType == EbtInt || publicType.basicType == EbtSampler || publicType.basicType == EbtAtomicUint) { if (baseType == EbtFloat || baseType == EbtUint || baseType == EbtInt || baseType == EbtSampler || baseType == EbtAtomicUint) {
if (publicType.qualifier.precision == EpqNone) { if (qualifier.precision == EpqNone) {
if (messages & EShMsgRelaxedErrors) if (messages & EShMsgRelaxedErrors)
warn(loc, "type requires declaration of default precision qualifier", TType::getBasicString(publicType.basicType), "substituting 'mediump'"); warn(loc, "type requires declaration of default precision qualifier", TType::getBasicString(baseType), "substituting 'mediump'");
else else
error(loc, "type requires declaration of default precision qualifier", TType::getBasicString(publicType.basicType), ""); error(loc, "type requires declaration of default precision qualifier", TType::getBasicString(baseType), "");
publicType.qualifier.precision = EpqMedium; qualifier.precision = EpqMedium;
defaultPrecision[publicType.basicType] = EpqMedium; defaultPrecision[baseType] = EpqMedium;
} }
} else if (publicType.qualifier.precision != EpqNone) } else if (qualifier.precision != EpqNone)
error(loc, "type cannot have precision qualifier", TType::getBasicString(publicType.basicType), ""); error(loc, "type cannot have precision qualifier", TType::getBasicString(baseType), "");
} }
void TParseContext::parameterTypeCheck(TSourceLoc loc, TStorageQualifier qualifier, const TType& type) void TParseContext::parameterTypeCheck(TSourceLoc loc, TStorageQualifier qualifier, const TType& type)
......
...@@ -138,7 +138,7 @@ public: ...@@ -138,7 +138,7 @@ public:
void setDefaultPrecision(TSourceLoc, TPublicType&, TPrecisionQualifier); void setDefaultPrecision(TSourceLoc, TPublicType&, TPrecisionQualifier);
int computeSamplerTypeIndex(TSampler&); int computeSamplerTypeIndex(TSampler&);
TPrecisionQualifier getDefaultPrecision(TPublicType&); TPrecisionQualifier getDefaultPrecision(TPublicType&);
void precisionQualifierCheck(TSourceLoc, TPublicType&); void precisionQualifierCheck(TSourceLoc, TBasicType, TQualifier&);
void parameterTypeCheck(TSourceLoc, TStorageQualifier qualifier, const TType& type); void parameterTypeCheck(TSourceLoc, TStorageQualifier qualifier, const TType& type);
bool containsFieldWithBasicType(const TType& type ,TBasicType basicType); bool containsFieldWithBasicType(const TType& type ,TBasicType basicType);
TSymbol* redeclareBuiltinVariable(TSourceLoc, const TString&, const TQualifier&, const TShaderQualifiers&, bool& newDeclaration); TSymbol* redeclareBuiltinVariable(TSourceLoc, const TString&, const TQualifier&, const TShaderQualifiers&, bool& newDeclaration);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment