Remove most of the remaining logic from glslang.y
Move most of the logic in glslang.y to ParseContext. This will make it
easier to change the code in the future.
Only a few specific bits of logic are kept in glslang.y:
* Disabling a parsing rule when a given shading language version is
being parsed. This makes it easier to check the grammar against the
grammar in the GLSL ES specs.
* Scoping calls that need to be paired with another call. It's much
easier to check these for correctness when the paired calls are next
to each other.
BUG=angleproject:911
TEST=angle_unittests
Change-Id: I52f42a1fc0f28463ca4b237dc6e88345e5173064
Reviewed-on: https://chromium-review.googlesource.com/539640
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index 909bb96..80755af 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -569,24 +569,18 @@
symbolTable.push(); // ESSL3_BUILTINS
symbolTable.push(); // ESSL3_1_BUILTINS
- TPublicType integer;
- integer.initializeBasicType(EbtInt);
-
- TPublicType floatingPoint;
- floatingPoint.initializeBasicType(EbtFloat);
-
switch (shaderType)
{
case GL_FRAGMENT_SHADER:
- symbolTable.setDefaultPrecision(integer, EbpMedium);
+ symbolTable.setDefaultPrecision(EbtInt, EbpMedium);
break;
case GL_VERTEX_SHADER:
- symbolTable.setDefaultPrecision(integer, EbpHigh);
- symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
+ symbolTable.setDefaultPrecision(EbtInt, EbpHigh);
+ symbolTable.setDefaultPrecision(EbtFloat, EbpHigh);
break;
case GL_COMPUTE_SHADER:
- symbolTable.setDefaultPrecision(integer, EbpHigh);
- symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
+ symbolTable.setDefaultPrecision(EbtInt, EbpHigh);
+ symbolTable.setDefaultPrecision(EbtFloat, EbpHigh);
break;
default:
assert(false && "Language not supported");
@@ -603,9 +597,7 @@
// It isn't specified whether Sampler2DRect has default precision.
initSamplerDefaultPrecision(EbtSampler2DRect);
- TPublicType atomicCounter;
- atomicCounter.initializeBasicType(EbtAtomicCounter);
- symbolTable.setDefaultPrecision(atomicCounter, EbpHigh);
+ symbolTable.setDefaultPrecision(EbtAtomicCounter, EbpHigh);
InsertBuiltInFunctions(shaderType, shaderSpec, resources, symbolTable);
@@ -617,9 +609,7 @@
void TCompiler::initSamplerDefaultPrecision(TBasicType samplerType)
{
ASSERT(samplerType > EbtGuardSamplerBegin && samplerType < EbtGuardSamplerEnd);
- TPublicType sampler;
- sampler.initializeBasicType(samplerType);
- symbolTable.setDefaultPrecision(sampler, EbpLow);
+ symbolTable.setDefaultPrecision(samplerType, EbpLow);
}
void TCompiler::setResourceString()