diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 389d4a9b..091158bf 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -836,8 +836,10 @@ bool TIntermBinary::promote(TInfoSink& infoSink) // Fix precision qualifiers if (right->getQualifier().precision > getQualifier().precision) getQualifier().precision = right->getQualifier().precision; - left->propagatePrecision(getQualifier().precision); - right->propagatePrecision(getQualifier().precision); + if (getQualifier().precision != EpqNone) { + left->propagatePrecision(getQualifier().precision); + right->propagatePrecision(getQualifier().precision); + } // // Array operations. @@ -1125,7 +1127,8 @@ void TIntermTyped::propagatePrecision(TPrecisionQualifier newPrecision) // comma operator: just through the last operand // ":?" and ",": where is this triggered? // built-in function calls: how much to propagate to arguments? - // performance: don't do this for desktop profiles + // length()? + // indexing? } bool CompareStructure(const TType& leftNodeType, constUnion* rightUnionArray, constUnion* leftUnionArray) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 13b3bc3d..5c748019 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -55,11 +55,7 @@ TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, EShLangu // Default precisions for version 110, to be overridden for // other versions/profiles/stage combinations for (int type = 0; type < EbtNumTypes; ++type) - defaultPrecision[type] = EpqHigh; - - defaultPrecision[EbtVoid] = EpqNone; - defaultPrecision[EbtDouble] = EpqNone; - defaultPrecision[EbtBool] = EpqNone; + defaultPrecision[type] = EpqNone; } // diff --git a/glslang/MachineIndependent/glslang.l b/glslang/MachineIndependent/glslang.l index 86bac745..cb9a0356 100644 --- a/glslang/MachineIndependent/glslang.l +++ b/glslang/MachineIndependent/glslang.l @@ -734,9 +734,6 @@ void SetVersion(int version) parseContext.version = version; if (version == 100 || version == 300) { - for (int type = 0; type < EbtNumTypes; ++type) - parseContext.defaultPrecision[type] = EpqNone; - if (parseContext.language == EShLangVertex) { parseContext.defaultPrecision[EbtInt] = EpqHigh; parseContext.defaultPrecision[EbtFloat] = EpqHigh; diff --git a/glslang/MachineIndependent/glslang.y b/glslang/MachineIndependent/glslang.y index 62635429..f10d0c7b 100644 --- a/glslang/MachineIndependent/glslang.y +++ b/glslang/MachineIndependent/glslang.y @@ -2442,17 +2442,20 @@ precision_qualifier : HIGH_PRECISION { parseContext.profileRequires($1.line, ENoProfile, 130, 0, "highp precision qualifier"); $$.init($1.line); - $$.qualifier.precision = EpqHigh; + if (parseContext.profile == EEsProfile) + $$.qualifier.precision = EpqHigh; } | MEDIUM_PRECISION { parseContext.profileRequires($1.line, ENoProfile, 130, 0, "mediump precision qualifier"); $$.init($1.line); - $$.qualifier.precision = EpqMedium; + if (parseContext.profile == EEsProfile) + $$.qualifier.precision = EpqMedium; } | LOW_PRECISION { parseContext.profileRequires($1.line, ENoProfile, 130, 0, "lowp precision qualifier"); $$.init($1.line); - $$.qualifier.precision = EpqLow; + if (parseContext.profile == EEsProfile) + $$.qualifier.precision = EpqLow; } ;