Store builtin symbols as const pointers
To do this we need two types of symbol table levels: A level for
built-ins and a level for user-defined symbols. User-defined symbols
are non-const because function symbols created based on function
prototypes are changed when the function definition is parsed. On the
other hand, we want to make built-in symbols constexpr, so we should
only handle them through const pointers.
This also gets rid of extra empty precision stack levels. Only one
level is needed to store predefined precisions.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I9f14b24c2cfce272f22c16e7a8dfb653b849cbeb
Reviewed-on: https://chromium-review.googlesource.com/892879
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index dc09f54..674b1e8 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -336,7 +336,8 @@
// We preserve symbols at the built-in level from compile-to-compile.
// Start pushing the user-defined symbols at global level.
- TScopedSymbolTableLevel scopedSymbolLevel(&symbolTable);
+ TScopedSymbolTableLevel globalLevel(&symbolTable);
+ ASSERT(symbolTable.atGlobalLevel());
// Parse shader.
if (PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], nullptr,