Made the API of shader translator library consistent.
- We recently started using OpenGL-type enums. This CL makes all old enums consistent with the new scheme.
- Renamed TBuiltInResource to ShBuiltInResources to have a consistent prefix

BUG=46
Review URL: http://codereview.appspot.com/2328041

git-svn-id: https://angleproject.googlecode.com/svn/trunk@443 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/CodeGenGLSL.cpp b/src/compiler/CodeGenGLSL.cpp
index 855b092..d140b37 100644
--- a/src/compiler/CodeGenGLSL.cpp
+++ b/src/compiler/CodeGenGLSL.cpp
@@ -11,9 +11,9 @@
 // compile object used by higher level code.  It returns
 // a subclass of TCompiler.
 //
-TCompiler* ConstructCompiler(EShLanguage language, EShSpec spec)
+TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
 {
-    return new TranslatorGLSL(language, spec);
+    return new TranslatorGLSL(type, spec);
 }
 
 //
diff --git a/src/compiler/CodeGenHLSL.cpp b/src/compiler/CodeGenHLSL.cpp
index 4db771d..e04e789 100644
--- a/src/compiler/CodeGenHLSL.cpp
+++ b/src/compiler/CodeGenHLSL.cpp
@@ -11,9 +11,9 @@
 // compile object used by higher level code.  It returns
 // a subclass of TCompiler.
 //
-TCompiler* ConstructCompiler(EShLanguage language, EShSpec spec)
+TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec)
 {
-    return new TranslatorHLSL(language, spec);
+    return new TranslatorHLSL(type, spec);
 }
 
 //
diff --git a/src/compiler/Compiler.cpp b/src/compiler/Compiler.cpp
index c35d928..7e8a835 100644
--- a/src/compiler/Compiler.cpp
+++ b/src/compiler/Compiler.cpp
@@ -10,12 +10,12 @@
 
 static bool InitializeSymbolTable(
         const TBuiltInStrings& builtInStrings,
-        EShLanguage language, EShSpec spec, const TBuiltInResource& resources,
+        ShShaderType type, ShShaderSpec spec, const ShBuiltInResources& resources,
         TInfoSink& infoSink, TSymbolTable& symbolTable)
 {
     TIntermediate intermediate(infoSink);
     TExtensionBehavior extBehavior;
-    TParseContext parseContext(symbolTable, extBehavior, intermediate, language, spec, infoSink);
+    TParseContext parseContext(symbolTable, extBehavior, intermediate, type, spec, infoSink);
 
     GlobalParseContext = &parseContext;
 
@@ -53,7 +53,7 @@
         }
     }
 
-    IdentifyBuiltIns(language, spec, resources, symbolTable);
+    IdentifyBuiltIns(type, spec, resources, symbolTable);
 
     FinalizePreprocessor();
 
@@ -68,7 +68,17 @@
     }
 }
 
-bool TCompiler::Init(const TBuiltInResource& resources)
+TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
+    : shaderType(type),
+      shaderSpec(spec) 
+{
+}
+
+TCompiler::~TCompiler()
+{
+}
+
+bool TCompiler::Init(const ShBuiltInResources& resources)
 {
     // Generate built-in symbol table.
     if (!InitBuiltInSymbolTable(resources))
@@ -89,7 +99,7 @@
 
     TIntermediate intermediate(infoSink);
     TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
-                               language, spec, infoSink);
+                               shaderType, shaderSpec, infoSink);
     GlobalParseContext = &parseContext;
     setInitialState();
 
@@ -110,13 +120,13 @@
     if (success) {
         success = intermediate.postProcess(parseContext.treeRoot);
 
-        if (success && (compileOptions & EShOptIntermediateTree))
+        if (success && (compileOptions & SH_INTERMEDIATE_TREE))
             intermediate.outputTree(parseContext.treeRoot);
 
-        if (success && (compileOptions & EShOptObjectCode))
+        if (success && (compileOptions & SH_OBJECT_CODE))
             translate(parseContext.treeRoot);
 
-        if (success && (compileOptions & EShOptAttribsUniforms))
+        if (success && (compileOptions & SH_ATTRIBUTES_UNIFORMS))
             collectAttribsUniforms(parseContext.treeRoot);
     }
 
@@ -131,12 +141,13 @@
     return success;
 }
 
-bool TCompiler::InitBuiltInSymbolTable(const TBuiltInResource& resources)
+bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources& resources)
 {
     TBuiltIns builtIns;
 
-    builtIns.initialize(language, spec, resources);
-    return InitializeSymbolTable(builtIns.getBuiltInStrings(), language, spec, resources, infoSink, symbolTable);
+    builtIns.initialize(shaderType, shaderSpec, resources);
+    return InitializeSymbolTable(builtIns.getBuiltInStrings(),
+        shaderType, shaderSpec, resources, infoSink, symbolTable);
 }
 
 void TCompiler::clearResults()
diff --git a/src/compiler/Initialize.cpp b/src/compiler/Initialize.cpp
index a3d12fb..12b53fe 100644
--- a/src/compiler/Initialize.cpp
+++ b/src/compiler/Initialize.cpp
@@ -341,7 +341,7 @@
 // Prototypes for built-in functions seen by vertex shaders only.
 //
 //============================================================================
-static TString BuiltInFunctionsVertex(const TBuiltInResource& resources)
+static TString BuiltInFunctionsVertex(const ShBuiltInResources& resources)
 {
     TString s;
 
@@ -373,7 +373,7 @@
 // Prototypes for built-in functions seen by fragment shaders only.
 //
 //============================================================================
-static TString BuiltInFunctionsFragment(const TBuiltInResource& resources)
+static TString BuiltInFunctionsFragment(const ShBuiltInResources& resources)
 {
     TString s;
 
@@ -467,7 +467,7 @@
 // Implementation dependent built-in constants.
 //
 //============================================================================
-static TString BuiltInConstants(const TBuiltInResource &resources)
+static TString BuiltInConstants(const ShBuiltInResources &resources)
 {
     TStringStream s;
 
@@ -484,17 +484,18 @@
     return s.str();
 }
 
-void TBuiltIns::initialize(EShLanguage language, EShSpec spec, const TBuiltInResource& resources)
+void TBuiltIns::initialize(ShShaderType type, ShShaderSpec spec,
+                           const ShBuiltInResources& resources)
 {
-    switch (language) {
-    case EShLangFragment:
+    switch (type) {
+    case SH_FRAGMENT_SHADER:
         builtInStrings.push_back(DefaultPrecisionFragment());
         builtInStrings.push_back(BuiltInFunctionsCommon());
         builtInStrings.push_back(BuiltInFunctionsFragment(resources));
         builtInStrings.push_back(StandardUniforms());
         break;
 
-    case EShLangVertex:
+    case SH_VERTEX_SHADER:
         builtInStrings.push_back(DefaultPrecisionVertex());
         builtInStrings.push_back(BuiltInFunctionsCommon());
         builtInStrings.push_back(BuiltInFunctionsVertex(resources));
@@ -507,14 +508,16 @@
     builtInStrings.push_back(BuiltInConstants(resources));
 }
 
-void IdentifyBuiltIns(EShLanguage language, EShSpec spec, const TBuiltInResource& resources, TSymbolTable& symbolTable)
+void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
+                      const ShBuiltInResources& resources,
+                      TSymbolTable& symbolTable)
 {
     //
     // First, insert some special built-in variables that are not in 
     // the built-in header files.
     //
-    switch(language) {
-    case EShLangFragment:
+    switch(type) {
+    case SH_FRAGMENT_SHADER:
         symbolTable.insert(*new TVariable(NewPoolTString("gl_FragCoord"),                   TType(EbtFloat, EbpMedium, EvqFragCoord,   4)));
         symbolTable.insert(*new TVariable(NewPoolTString("gl_FrontFacing"),                 TType(EbtBool,  EbpUndefined, EvqFrontFacing, 1)));
         symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"),                   TType(EbtFloat, EbpMedium, EvqFragColor,   4)));
@@ -522,7 +525,7 @@
         symbolTable.insert(*new TVariable(NewPoolTString("gl_PointCoord"),                  TType(EbtFloat, EbpMedium, EvqPointCoord,  2)));
         break;
 
-    case EShLangVertex:
+    case SH_VERTEX_SHADER:
         symbolTable.insert(*new TVariable(NewPoolTString("gl_Position"),    TType(EbtFloat, EbpHigh, EvqPosition,    4)));
         symbolTable.insert(*new TVariable(NewPoolTString("gl_PointSize"),   TType(EbtFloat, EbpMedium, EvqPointSize,   1)));
         break;
@@ -590,10 +593,10 @@
     symbolTable.relateToOperator("all",          EOpAll);
 
     // Map language-specific operators.
-    switch(language) {
-    case EShLangVertex:
+    switch(type) {
+    case SH_VERTEX_SHADER:
         break;
-    case EShLangFragment:
+    case SH_FRAGMENT_SHADER:
         if (resources.OES_standard_derivatives) {
             symbolTable.relateToOperator("dFdx",   EOpDFdx);
             symbolTable.relateToOperator("dFdy",   EOpDFdy);
@@ -608,8 +611,8 @@
     }
 
     // Finally add resource-specific variables.
-    switch(language) {
-    case EShLangFragment: {
+    switch(type) {
+    case SH_FRAGMENT_SHADER: {
             // Set up gl_FragData.  The array size.
             TType fragData(EbtFloat, EbpMedium, EvqFragColor,   4, false, true);
             fragData.setArraySize(resources.MaxDrawBuffers);
@@ -620,7 +623,7 @@
     }
 }
 
-void InitExtensionBehavior(const TBuiltInResource& resources,
+void InitExtensionBehavior(const ShBuiltInResources& resources,
                            TExtensionBehavior& extBehavior)
 {
     if (resources.OES_standard_derivatives)
diff --git a/src/compiler/Initialize.h b/src/compiler/Initialize.h
index 19c3f1f..483ff48 100644
--- a/src/compiler/Initialize.h
+++ b/src/compiler/Initialize.h
@@ -17,17 +17,19 @@
 public:
     POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
 
-    void initialize(EShLanguage language, EShSpec spec, const TBuiltInResource& resources);
+    void initialize(ShShaderType type, ShShaderSpec spec,
+                    const ShBuiltInResources& resources);
     const TBuiltInStrings& getBuiltInStrings() { return builtInStrings; }
 
 protected:
     TBuiltInStrings builtInStrings;
 };
 
-void IdentifyBuiltIns(EShLanguage language, EShSpec spec, const TBuiltInResource& resources,
+void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
+                      const ShBuiltInResources& resources,
                       TSymbolTable& symbolTable);
 
-void InitExtensionBehavior(const TBuiltInResource& resources,
+void InitExtensionBehavior(const ShBuiltInResources& resources,
                            TExtensionBehavior& extensionBehavior);
 
 extern "C" int InitPreprocessor(void);
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index 0bb73d4..0e61d85 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -96,7 +96,7 @@
 
 void OutputHLSL::header()
 {
-    EShLanguage language = mContext.language;
+    ShShaderType shaderType = mContext.shaderType;
     TInfoSinkBase &out = mHeader;
 
     for (StructDeclarations::iterator structDeclaration = mStructDeclarations.begin(); structDeclaration != mStructDeclarations.end(); structDeclaration++)
@@ -109,7 +109,7 @@
         out << *constructor;
     }
 
-    if (language == EShLangFragment)
+    if (shaderType == SH_FRAGMENT_SHADER)
     {
         TString uniforms;
         TString varyings;
@@ -946,7 +946,7 @@
 
 bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
 {
-    EShLanguage language = mContext.language;
+    ShShaderType shaderType = mContext.shaderType;
     TInfoSinkBase &out = mBody;
 
     switch (node->getOp())
diff --git a/src/compiler/ParseHelper.cpp b/src/compiler/ParseHelper.cpp
index ef01c5a..574726a 100644
--- a/src/compiler/ParseHelper.cpp
+++ b/src/compiler/ParseHelper.cpp
@@ -415,7 +415,7 @@
             error(line, reservedErrMsg, "gl_", "");
             return true;
         }
-        if (spec == EShSpecWebGL) {
+        if (shaderSpec == SH_WEBGL_SPEC) {
             if (identifier.substr(0, 6) == TString("webgl_")) {
                 error(line, reservedErrMsg, "webgl_", "");
                 return true;
diff --git a/src/compiler/ParseHelper.h b/src/compiler/ParseHelper.h
index 27e85b4..cdc8676 100644
--- a/src/compiler/ParseHelper.h
+++ b/src/compiler/ParseHelper.h
@@ -30,16 +30,16 @@
 // they can be passed to the parser without needing a global.
 //
 struct TParseContext {
-    TParseContext(TSymbolTable& symt, const TExtensionBehavior& ext, TIntermediate& interm, EShLanguage l, EShSpec s, TInfoSink& is) :
-            intermediate(interm), symbolTable(symt), extensionBehavior(ext), infoSink(is), language(l), spec(s), treeRoot(0),
+    TParseContext(TSymbolTable& symt, const TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, TInfoSink& is) :
+            intermediate(interm), symbolTable(symt), extensionBehavior(ext), infoSink(is), shaderType(type), shaderSpec(spec), treeRoot(0),
             recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0),
             inTypeParen(false), contextPragma(true, false) {  }
     TIntermediate& intermediate; // to hold and build a parse tree
     TSymbolTable& symbolTable;   // symbol table that goes with the language currently being parsed
     TExtensionBehavior extensionBehavior;  // mapping between supported extensions and current behavior.
     TInfoSink& infoSink;
-    EShLanguage language;        // vertex or fragment language (future: pack or unpack)
-    EShSpec spec;                // The language specification compiler conforms to - GLES2 or WebGL.
+    ShShaderType shaderType;              // vertex or fragment language (future: pack or unpack)
+    ShShaderSpec shaderSpec;              // The language specification compiler conforms to - GLES2 or WebGL.
     TIntermNode* treeRoot;       // root of parse tree being created
     bool recoveredFromError;     // true if a parse error has occurred, but we continue to parse
     int numErrors;
diff --git a/src/compiler/ShHandle.h b/src/compiler/ShHandle.h
index 514eb59..e23f1a3 100644
--- a/src/compiler/ShHandle.h
+++ b/src/compiler/ShHandle.h
@@ -39,11 +39,11 @@
 //
 class TCompiler : public TShHandleBase {
 public:
-    TCompiler(EShLanguage l, EShSpec s) : language(l), spec(s) {}
-    virtual ~TCompiler() {}
+    TCompiler(ShShaderType type, ShShaderSpec spec);
+    virtual ~TCompiler();
     virtual TCompiler* getAsCompiler() { return this; }
 
-    bool Init(const TBuiltInResource& resources);
+    bool Init(const ShBuiltInResources& resources);
     bool compile(const char* const shaderStrings[],
                  const int numStrings,
                  int compileOptions);
@@ -55,7 +55,7 @@
 
 protected:
     // Initialize symbol-table with built-in symbols.
-    bool InitBuiltInSymbolTable(const TBuiltInResource& resources);
+    bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
     // Clears the results from the previous compilation.
     void clearResults();
     // Collect info for all attribs and uniforms.
@@ -64,8 +64,8 @@
     virtual void translate(TIntermNode* root) = 0;
 
 private:
-    EShLanguage language;
-    EShSpec spec;
+    ShShaderType shaderType;
+    ShShaderSpec shaderSpec;
 
     // Built-in symbol table for the given language, spec, and resources.
     // It is preserved from compile-to-compile.
@@ -88,7 +88,7 @@
 // destroy the machine dependent objects, which contain the
 // above machine independent information.
 //
-TCompiler* ConstructCompiler(EShLanguage, EShSpec);
+TCompiler* ConstructCompiler(ShShaderType type, ShShaderSpec spec);
 void DeleteCompiler(TCompiler*);
 
 #endif // _SHHANDLE_INCLUDED_
diff --git a/src/compiler/ShaderLang.cpp b/src/compiler/ShaderLang.cpp
index bab6423..c5eaf30 100644
--- a/src/compiler/ShaderLang.cpp
+++ b/src/compiler/ShaderLang.cpp
@@ -31,12 +31,12 @@
     return static_cast<int>(maxLen) + 1;
 }
 
-static void getVariableInfo(EShInfo varType,
+static void getVariableInfo(ShShaderInfo varType,
                             const ShHandle handle,
                             int index,
                             int* length,
                             int* size,
-                            EShDataType* type,
+                            ShDataType* type,
                             char* name)
 {
     if (!handle || !size || !type || !name)
@@ -87,7 +87,7 @@
 //
 // Initialize built-in resources with minimum expected values.
 //
-void ShInitBuiltInResource(TBuiltInResource* resources)
+void ShInitBuiltInResources(ShBuiltInResources* resources)
 {
     // Constants.
     resources->MaxVertexAttribs = 8;
@@ -106,12 +106,13 @@
 //
 // Driver calls these to create and destroy compiler objects.
 //
-ShHandle ShConstructCompiler(EShLanguage language, EShSpec spec, const TBuiltInResource* resources)
+ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
+                             const ShBuiltInResources* resources)
 {
     if (!InitThread())
         return 0;
 
-    TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(language, spec));
+    TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(type, spec));
     TCompiler* compiler = base->getAsCompiler();
     if (compiler == 0)
         return 0;
@@ -172,7 +173,7 @@
     return success ? 1 : 0;
 }
 
-void ShGetInfo(const ShHandle handle, EShInfo pname, int* params)
+void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params)
 {
     if (!handle || !params)
         return;
@@ -242,7 +243,7 @@
                        int index,
                        int* length,
                        int* size,
-                       EShDataType* type,
+                       ShDataType* type,
                        char* name)
 {
     getVariableInfo(SH_ACTIVE_ATTRIBUTES,
@@ -253,7 +254,7 @@
                         int index,
                         int* length,
                         int* size,
-                        EShDataType* type,
+                        ShDataType* type,
                         char* name)
 {
     getVariableInfo(SH_ACTIVE_UNIFORMS,
diff --git a/src/compiler/TranslatorGLSL.cpp b/src/compiler/TranslatorGLSL.cpp
index 190b10f..2453334 100644
--- a/src/compiler/TranslatorGLSL.cpp
+++ b/src/compiler/TranslatorGLSL.cpp
@@ -8,8 +8,8 @@
 
 #include "compiler/OutputGLSL.h"
 
-TranslatorGLSL::TranslatorGLSL(EShLanguage lang, EShSpec spec)
-    : TCompiler(lang, spec) {
+TranslatorGLSL::TranslatorGLSL(ShShaderType type, ShShaderSpec spec)
+    : TCompiler(type, spec) {
 }
 
 void TranslatorGLSL::translate(TIntermNode* root) {
diff --git a/src/compiler/TranslatorGLSL.h b/src/compiler/TranslatorGLSL.h
index c5e4d34..c2ce06d 100644
--- a/src/compiler/TranslatorGLSL.h
+++ b/src/compiler/TranslatorGLSL.h
@@ -11,7 +11,7 @@
 
 class TranslatorGLSL : public TCompiler {
 public:
-    TranslatorGLSL(EShLanguage lang, EShSpec spec);
+    TranslatorGLSL(ShShaderType type, ShShaderSpec spec);
 
 protected:
     virtual void translate(TIntermNode* root);
diff --git a/src/compiler/TranslatorHLSL.cpp b/src/compiler/TranslatorHLSL.cpp
index d51ae90..96d7f10 100644
--- a/src/compiler/TranslatorHLSL.cpp
+++ b/src/compiler/TranslatorHLSL.cpp
@@ -8,8 +8,8 @@
 
 #include "compiler/OutputHLSL.h"
 
-TranslatorHLSL::TranslatorHLSL(EShLanguage lang, EShSpec spec)
-    : TCompiler(lang, spec)
+TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec)
+    : TCompiler(type, spec)
 {
 }
 
diff --git a/src/compiler/TranslatorHLSL.h b/src/compiler/TranslatorHLSL.h
index ebe1cb3..c3f672b 100644
--- a/src/compiler/TranslatorHLSL.h
+++ b/src/compiler/TranslatorHLSL.h
@@ -11,7 +11,7 @@
 
 class TranslatorHLSL : public TCompiler {
 public:
-    TranslatorHLSL(EShLanguage lang, EShSpec spec);
+    TranslatorHLSL(ShShaderType type, ShShaderSpec spec);
 
 protected:
     virtual void translate(TIntermNode* root);
diff --git a/src/compiler/VariableInfo.cpp b/src/compiler/VariableInfo.cpp
index 75cdbf9..ad2e08f 100644
--- a/src/compiler/VariableInfo.cpp
+++ b/src/compiler/VariableInfo.cpp
@@ -14,7 +14,7 @@
 }
 
 // Returns the data type for an attribute or uniform.
-static EShDataType getVariableDataType(const TType& type)
+static ShDataType getVariableDataType(const TType& type)
 {
     switch (type.getBasicType()) {
       case EbtFloat:
diff --git a/src/compiler/VariableInfo.h b/src/compiler/VariableInfo.h
index f7804b4..15a5c57 100644
--- a/src/compiler/VariableInfo.h
+++ b/src/compiler/VariableInfo.h
@@ -11,7 +11,7 @@
 // It is currently being used to store info about active attribs and uniforms.
 struct TVariableInfo {
     TPersistString name;
-    EShDataType type;
+    ShDataType type;
     int size;
 };
 typedef std::vector<TVariableInfo> TVariableInfoList;
diff --git a/src/compiler/glslang.y b/src/compiler/glslang.y
index c96b8d8..d0370d7 100644
--- a/src/compiler/glslang.y
+++ b/src/compiler/glslang.y
@@ -40,48 +40,26 @@
 #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
 extern void yyerror(const char*);
 
-#define FRAG_VERT_ONLY(S, L) {                                                  \
-    if (parseContext->language != EShLangFragment &&                             \
-        parseContext->language != EShLangVertex) {                               \
-        parseContext->error(L, " supported in vertex/fragment shaders only ", S, "", "");   \
-        parseContext->recover();                                                            \
-    }                                                                           \
+#define FRAG_VERT_ONLY(S, L) {  \
+    if (parseContext->shaderType != SH_FRAGMENT_SHADER &&  \
+        parseContext->shaderType != SH_VERTEX_SHADER) {  \
+        parseContext->error(L, " supported in vertex/fragment shaders only ", S, "", "");  \
+        parseContext->recover();  \
+    }  \
 }
 
-#define VERTEX_ONLY(S, L) {                                                     \
-    if (parseContext->language != EShLangVertex) {                               \
-        parseContext->error(L, " supported in vertex shaders only ", S, "", "");            \
-        parseContext->recover();                                                            \
-    }                                                                           \
+#define VERTEX_ONLY(S, L) {  \
+    if (parseContext->shaderType != SH_VERTEX_SHADER) {  \
+        parseContext->error(L, " supported in vertex shaders only ", S, "", "");  \
+        parseContext->recover();  \
+    }  \
 }
 
-#define FRAG_ONLY(S, L) {                                                       \
-    if (parseContext->language != EShLangFragment) {                             \
-        parseContext->error(L, " supported in fragment shaders only ", S, "", "");          \
-        parseContext->recover();                                                            \
-    }                                                                           \
-}
-
-#define PACK_ONLY(S, L) {                                                       \
-    if (parseContext->language != EShLangPack) {                                 \
-        parseContext->error(L, " supported in pack shaders only ", S, "", "");              \
-        parseContext->recover();                                                            \
-    }                                                                           \
-}
-
-#define UNPACK_ONLY(S, L) {                                                     \
-    if (parseContext->language != EShLangUnpack) {                               \
-        parseContext->error(L, " supported in unpack shaders only ", S, "", "");            \
-        parseContext->recover();                                                            \
-    }                                                                           \
-}
-
-#define PACK_UNPACK_ONLY(S, L) {                                                \
-    if (parseContext->language != EShLangUnpack &&                               \
-        parseContext->language != EShLangPack) {                                 \
-        parseContext->error(L, " supported in pack/unpack shaders only ", S, "", "");       \
-        parseContext->recover();                                                            \
-    }                                                                           \
+#define FRAG_ONLY(S, L) {  \
+    if (parseContext->shaderType != SH_FRAGMENT_SHADER) {  \
+        parseContext->error(L, " supported in fragment shaders only ", S, "", "");  \
+        parseContext->recover();  \
+    }  \
 }
 %}
 %union {
@@ -1498,7 +1476,7 @@
     | VARYING {
         if (parseContext->globalErrorCheck($1.line, parseContext->symbolTable.atGlobalLevel(), "varying"))
             parseContext->recover();
-        if (parseContext->language == EShLangVertex)
+        if (parseContext->shaderType == SH_VERTEX_SHADER)
             $$.setBasic(EbtVoid, EvqVaryingOut, $1.line);
         else
             $$.setBasic(EbtVoid, EvqVaryingIn, $1.line);
@@ -1506,7 +1484,7 @@
     | INVARIANT VARYING {
         if (parseContext->globalErrorCheck($1.line, parseContext->symbolTable.atGlobalLevel(), "invariant varying"))
             parseContext->recover();
-        if (parseContext->language == EShLangVertex)
+        if (parseContext->shaderType == SH_VERTEX_SHADER)
             $$.setBasic(EbtVoid, EvqInvariantVaryingOut, $1.line);
         else
             $$.setBasic(EbtVoid, EvqInvariantVaryingIn, $1.line);