Return shader variable information using GLenum values.
Instead of duplicating GL header define values, explictly return
GLenum for variable queries in the shader inspection API. This
reduces the duplicate defines in the shader compiler header.
BUG=angle:466
Change-Id: Iddaaff597b188251fa2e546f352bf77ab3ac43bc
Reviewed-on: https://chromium-review.googlesource.com/205860
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
diff --git a/src/compiler/translator/BuiltInFunctionEmulator.cpp b/src/compiler/translator/BuiltInFunctionEmulator.cpp
index afbc169..761e4ae 100644
--- a/src/compiler/translator/BuiltInFunctionEmulator.cpp
+++ b/src/compiler/translator/BuiltInFunctionEmulator.cpp
@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
+#include "angle_gl.h"
#include "compiler/translator/BuiltInFunctionEmulator.h"
-
#include "compiler/translator/SymbolTable.h"
namespace {
@@ -265,9 +265,9 @@
} // anonymous namepsace
-BuiltInFunctionEmulator::BuiltInFunctionEmulator(ShShaderType shaderType)
+BuiltInFunctionEmulator::BuiltInFunctionEmulator(sh::GLenum shaderType)
{
- if (shaderType == SH_FRAGMENT_SHADER) {
+ if (shaderType == GL_FRAGMENT_SHADER) {
mFunctionMask = kFunctionEmulationFragmentMask;
mFunctionSource = kFunctionEmulationFragmentSource;
} else {
diff --git a/src/compiler/translator/BuiltInFunctionEmulator.h b/src/compiler/translator/BuiltInFunctionEmulator.h
index 9367b55..926b6be 100644
--- a/src/compiler/translator/BuiltInFunctionEmulator.h
+++ b/src/compiler/translator/BuiltInFunctionEmulator.h
@@ -17,7 +17,7 @@
//
class BuiltInFunctionEmulator {
public:
- BuiltInFunctionEmulator(ShShaderType shaderType);
+ BuiltInFunctionEmulator(sh::GLenum shaderType);
// Records that a function is called by the shader and might needs to be
// emulated. If the function's group is not in mFunctionGroupFilter, this
// becomes an no-op.
diff --git a/src/compiler/translator/CodeGen.cpp b/src/compiler/translator/CodeGen.cpp
index c35dbdc..71056f4 100644
--- a/src/compiler/translator/CodeGen.cpp
+++ b/src/compiler/translator/CodeGen.cpp
@@ -14,7 +14,7 @@
// a subclass of TCompiler.
//
TCompiler* ConstructCompiler(
- ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
+ sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
{
switch (output) {
case SH_ESSL_OUTPUT:
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index 61c0c4e..898e3ef 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -22,6 +22,7 @@
#include "compiler/translator/timing/RestrictFragmentShaderTiming.h"
#include "compiler/translator/timing/RestrictVertexShaderTiming.h"
#include "third_party/compiler/ArrayBoundsClamper.h"
+#include "angle_gl.h"
bool IsWebGLBasedSpec(ShShaderSpec spec)
{
@@ -92,7 +93,7 @@
allocator.popAll();
}
-TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
+TCompiler::TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
: shaderType(type),
shaderSpec(spec),
outputType(output),
@@ -112,7 +113,7 @@
bool TCompiler::Init(const ShBuiltInResources& resources)
{
shaderVersion = 100;
- maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
+ maxUniformVectors = (shaderType == GL_VERTEX_SHADER) ?
resources.MaxVertexUniformVectors :
resources.MaxFragmentUniformVectors;
maxExpressionComplexity = resources.MaxExpressionComplexity;
@@ -187,7 +188,7 @@
if (success)
success = detectCallDepth(root, infoSink, (compileOptions & SH_LIMIT_CALL_STACK_DEPTH) != 0);
- if (success && shaderVersion == 300 && shaderType == SH_FRAGMENT_SHADER)
+ if (success && shaderVersion == 300 && shaderType == GL_FRAGMENT_SHADER)
success = validateOutputs(root);
if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
@@ -225,7 +226,7 @@
if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
- if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION))
+ if (success && shaderType == GL_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION))
initializeGLPosition(root);
if (success && (compileOptions & SH_UNFOLD_SHORT_CIRCUIT))
@@ -247,7 +248,7 @@
infoSink.info << "too many uniforms";
}
}
- if (success && shaderType == SH_VERTEX_SHADER &&
+ if (success && shaderType == GL_VERTEX_SHADER &&
(compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
initializeVaryingsWithoutStaticUse(root);
}
@@ -294,10 +295,10 @@
switch(shaderType)
{
- case SH_FRAGMENT_SHADER:
+ case GL_FRAGMENT_SHADER:
symbolTable.setDefaultPrecision(integer, EbpMedium);
break;
- case SH_VERTEX_SHADER:
+ case GL_VERTEX_SHADER:
symbolTable.setDefaultPrecision(integer, EbpHigh);
symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
break;
@@ -418,7 +419,7 @@
return false;
}
- if (shaderType == SH_FRAGMENT_SHADER)
+ if (shaderType == GL_FRAGMENT_SHADER)
{
TDependencyGraph graph(root);
@@ -512,26 +513,26 @@
unsigned char primarySize = 1, secondarySize = 1;
switch (varying.type)
{
- case SH_FLOAT:
+ case GL_FLOAT:
break;
- case SH_FLOAT_VEC2:
+ case GL_FLOAT_VEC2:
primarySize = 2;
break;
- case SH_FLOAT_VEC3:
+ case GL_FLOAT_VEC3:
primarySize = 3;
break;
- case SH_FLOAT_VEC4:
+ case GL_FLOAT_VEC4:
primarySize = 4;
break;
- case SH_FLOAT_MAT2:
+ case GL_FLOAT_MAT2:
primarySize = 2;
secondarySize = 2;
break;
- case SH_FLOAT_MAT3:
+ case GL_FLOAT_MAT3:
primarySize = 3;
secondarySize = 3;
break;
- case SH_FLOAT_MAT4:
+ case GL_FLOAT_MAT4:
primarySize = 4;
secondarySize = 4;
break;
diff --git a/src/compiler/translator/Compiler.h b/src/compiler/translator/Compiler.h
index af1bc98..5df556d 100644
--- a/src/compiler/translator/Compiler.h
+++ b/src/compiler/translator/Compiler.h
@@ -54,7 +54,7 @@
//
class TCompiler : public TShHandleBase {
public:
- TCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
+ TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
virtual ~TCompiler();
virtual TCompiler* getAsCompiler() { return this; }
@@ -78,7 +78,7 @@
std::string getBuiltInResourcesString() const { return builtInResourcesString; }
protected:
- ShShaderType getShaderType() const { return shaderType; }
+ sh::GLenum getShaderType() const { return shaderType; }
// Initialize symbol-table with built-in symbols.
bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
// Compute the string representation of the built-in resources
@@ -130,7 +130,7 @@
const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const;
private:
- ShShaderType shaderType;
+ sh::GLenum shaderType;
ShShaderSpec shaderSpec;
ShShaderOutput outputType;
@@ -174,7 +174,7 @@
// above machine independent information.
//
TCompiler* ConstructCompiler(
- ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
+ sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
void DeleteCompiler(TCompiler*);
#endif // _SHHANDLE_INCLUDED_
diff --git a/src/compiler/translator/Initialize.cpp b/src/compiler/translator/Initialize.cpp
index e542a3f..e91d64f 100644
--- a/src/compiler/translator/Initialize.cpp
+++ b/src/compiler/translator/Initialize.cpp
@@ -13,8 +13,9 @@
#include "compiler/translator/Initialize.h"
#include "compiler/translator/intermediate.h"
+#include "angle_gl.h"
-void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
+void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
{
TType *float1 = new TType(EbtFloat);
TType *float2 = new TType(EbtFloat, 2);
@@ -362,7 +363,7 @@
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeGradEXT", samplerCube, float3, float3, float3);
}
- if (type == SH_FRAGMENT_SHADER)
+ if (type == GL_FRAGMENT_SHADER)
{
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1);
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, float1);
@@ -396,7 +397,7 @@
}
}
- if(type == SH_VERTEX_SHADER)
+ if(type == GL_VERTEX_SHADER)
{
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, float1);
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, float1);
@@ -426,7 +427,7 @@
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1);
- if (type == SH_FRAGMENT_SHADER)
+ if (type == GL_FRAGMENT_SHADER)
{
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1);
@@ -447,7 +448,7 @@
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, float1);
- if (type == SH_FRAGMENT_SHADER)
+ if (type == GL_FRAGMENT_SHADER)
{
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, float1);
@@ -462,7 +463,7 @@
symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1);
- if(type == SH_FRAGMENT_SHADER)
+ if(type == GL_FRAGMENT_SHADER)
{
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "dFdx", float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, "dFdx", float2);
@@ -485,7 +486,7 @@
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2);
- if(type == SH_FRAGMENT_SHADER)
+ if(type == GL_FRAGMENT_SHADER)
{
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, float1);
@@ -498,7 +499,7 @@
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2);
- if(type == SH_FRAGMENT_SHADER)
+ if(type == GL_FRAGMENT_SHADER)
{
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2, float1);
@@ -594,7 +595,7 @@
symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", resources.MaxProgramTexelOffset);
}
-void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
+void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
const ShBuiltInResources &resources,
TSymbolTable &symbolTable)
{
@@ -603,7 +604,7 @@
// the built-in header files.
//
switch(type) {
- case SH_FRAGMENT_SHADER:
+ case GL_FRAGMENT_SHADER:
symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
@@ -626,7 +627,7 @@
break;
- case SH_VERTEX_SHADER:
+ case GL_VERTEX_SHADER:
symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
break;
@@ -694,9 +695,9 @@
// Map language-specific operators.
switch(type) {
- case SH_VERTEX_SHADER:
+ case GL_VERTEX_SHADER:
break;
- case SH_FRAGMENT_SHADER:
+ case GL_FRAGMENT_SHADER:
if (resources.OES_standard_derivatives)
{
symbolTable.relateToOperator(ESSL1_BUILTINS, "dFdx", EOpDFdx);
@@ -730,7 +731,7 @@
// Finally add resource-specific variables.
switch(type) {
- case SH_FRAGMENT_SHADER:
+ case GL_FRAGMENT_SHADER:
if (spec != SH_CSS_SHADERS_SPEC) {
// Set up gl_FragData. The array size.
TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
diff --git a/src/compiler/translator/Initialize.h b/src/compiler/translator/Initialize.h
index cf40697..cc1862c 100644
--- a/src/compiler/translator/Initialize.h
+++ b/src/compiler/translator/Initialize.h
@@ -11,9 +11,9 @@
#include "compiler/translator/Compiler.h"
#include "compiler/translator/SymbolTable.h"
-void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &table);
+void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &table);
-void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
+void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
const ShBuiltInResources& resources,
TSymbolTable& symbolTable);
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 5974afb..60201f6 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -142,7 +142,7 @@
if (mOutputType == SH_HLSL9_OUTPUT)
{
- if (mContext.shaderType == SH_FRAGMENT_SHADER)
+ if (mContext.shaderType == GL_FRAGMENT_SHADER)
{
// Reserve registers for dx_DepthRange, dx_ViewCoords and dx_DepthFront
mUniformHLSL->reserveUniformRegisters(3);
@@ -167,13 +167,13 @@
void OutputHLSL::output()
{
- mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
+ mContainsLoopDiscontinuity = mContext.shaderType == GL_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
const std::vector<TIntermTyped*> &flaggedStructs = FlagStd140ValueStructs(mContext.treeRoot);
makeFlaggedStructMaps(flaggedStructs);
// Work around D3D9 bug that would manifest in vertex shaders with selection blocks which
// use a vertex attribute as a condition, and some related computation in the else block.
- if (mOutputType == SH_HLSL9_OUTPUT && mContext.shaderType == SH_VERTEX_SHADER)
+ if (mOutputType == SH_HLSL9_OUTPUT && mContext.shaderType == GL_VERTEX_SHADER)
{
RewriteElseBlocks(mContext.treeRoot);
}
@@ -345,7 +345,7 @@
out << "#define ANGLE_USES_NESTED_BREAK" << "\n";
}
- if (mContext.shaderType == SH_FRAGMENT_SHADER)
+ if (mContext.shaderType == GL_FRAGMENT_SHADER)
{
TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
const bool usingMRTExtension = (iter != mContext.extensionBehavior().end() && (iter->second == EBhEnable || iter->second == EBhRequire));
@@ -2147,7 +2147,7 @@
bool bias = (arguments.size() > mandatoryArgumentCount); // Bias argument is optional
- if (lod0 || mContext.shaderType == SH_VERTEX_SHADER)
+ if (lod0 || mContext.shaderType == GL_VERTEX_SHADER)
{
if (bias)
{
diff --git a/src/compiler/translator/ParseContext.h b/src/compiler/translator/ParseContext.h
index fc51ac8..a402eec 100644
--- a/src/compiler/translator/ParseContext.h
+++ b/src/compiler/translator/ParseContext.h
@@ -25,7 +25,7 @@
// they can be passed to the parser without needing a global.
//
struct TParseContext {
- TParseContext(TSymbolTable& symt, TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, int options, bool checksPrecErrors, const char* sourcePath, TInfoSink& is) :
+ TParseContext(TSymbolTable& symt, TExtensionBehavior& ext, TIntermediate& interm, sh::GLenum type, ShShaderSpec spec, int options, bool checksPrecErrors, const char* sourcePath, TInfoSink& is) :
intermediate(interm),
symbolTable(symt),
shaderType(type),
@@ -47,7 +47,7 @@
scanner(NULL) { }
TIntermediate& intermediate; // to hold and build a parse tree
TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed
- ShShaderType shaderType; // vertex or fragment language (future: pack or unpack)
+ sh::GLenum shaderType; // vertex or fragment language (future: pack or unpack)
ShShaderSpec shaderSpec; // The language specification compiler conforms to - GLES2 or WebGL.
int shaderVersion;
int compileOptions;
diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp
index 121a68c..903a5fb 100644
--- a/src/compiler/translator/ShaderLang.cpp
+++ b/src/compiler/translator/ShaderLang.cpp
@@ -115,7 +115,7 @@
//
// Driver calls these to create and destroy compiler objects.
//
-ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
+ShHandle ShConstructCompiler(sh::GLenum type, ShShaderSpec spec,
ShShaderOutput output,
const ShBuiltInResources* resources)
{
@@ -293,7 +293,7 @@
int index,
size_t* length,
int* size,
- ShDataType* type,
+ sh::GLenum* type,
ShPrecisionType* precision,
int* staticUse,
char* name,
diff --git a/src/compiler/translator/TranslatorESSL.cpp b/src/compiler/translator/TranslatorESSL.cpp
index c956e29..5b99fea 100644
--- a/src/compiler/translator/TranslatorESSL.cpp
+++ b/src/compiler/translator/TranslatorESSL.cpp
@@ -7,8 +7,9 @@
#include "compiler/translator/TranslatorESSL.h"
#include "compiler/translator/OutputESSL.h"
+#include "angle_gl.h"
-TranslatorESSL::TranslatorESSL(ShShaderType type, ShShaderSpec spec)
+TranslatorESSL::TranslatorESSL(sh::GLenum type, ShShaderSpec spec)
: TCompiler(type, spec, SH_ESSL_OUTPUT) {
}
@@ -20,7 +21,7 @@
// Write emulated built-in functions if needed.
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
- sink, getShaderType() == SH_FRAGMENT_SHADER);
+ sink, getShaderType() == GL_FRAGMENT_SHADER);
// Write array bounds clamping emulation if needed.
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
diff --git a/src/compiler/translator/TranslatorESSL.h b/src/compiler/translator/TranslatorESSL.h
index 6e7ea65..5576682 100644
--- a/src/compiler/translator/TranslatorESSL.h
+++ b/src/compiler/translator/TranslatorESSL.h
@@ -11,7 +11,7 @@
class TranslatorESSL : public TCompiler {
public:
- TranslatorESSL(ShShaderType type, ShShaderSpec spec);
+ TranslatorESSL(sh::GLenum type, ShShaderSpec spec);
protected:
virtual void translate(TIntermNode* root);
diff --git a/src/compiler/translator/TranslatorGLSL.cpp b/src/compiler/translator/TranslatorGLSL.cpp
index 749d837..4b2aeca 100644
--- a/src/compiler/translator/TranslatorGLSL.cpp
+++ b/src/compiler/translator/TranslatorGLSL.cpp
@@ -9,7 +9,7 @@
#include "compiler/translator/OutputGLSL.h"
#include "compiler/translator/VersionGLSL.h"
-static void writeVersion(ShShaderType type, TIntermNode* root,
+static void writeVersion(sh::GLenum type, TIntermNode* root,
TInfoSinkBase& sink) {
TVersionGLSL versionGLSL(type);
root->traverse(&versionGLSL);
@@ -21,7 +21,7 @@
}
}
-TranslatorGLSL::TranslatorGLSL(ShShaderType type, ShShaderSpec spec)
+TranslatorGLSL::TranslatorGLSL(sh::GLenum type, ShShaderSpec spec)
: TCompiler(type, spec, SH_GLSL_OUTPUT) {
}
diff --git a/src/compiler/translator/TranslatorGLSL.h b/src/compiler/translator/TranslatorGLSL.h
index 301227e..3c6c2e4 100644
--- a/src/compiler/translator/TranslatorGLSL.h
+++ b/src/compiler/translator/TranslatorGLSL.h
@@ -11,7 +11,7 @@
class TranslatorGLSL : public TCompiler {
public:
- TranslatorGLSL(ShShaderType type, ShShaderSpec spec);
+ TranslatorGLSL(sh::GLenum type, ShShaderSpec spec);
protected:
virtual void translate(TIntermNode* root);
diff --git a/src/compiler/translator/TranslatorHLSL.cpp b/src/compiler/translator/TranslatorHLSL.cpp
index da6f980..b75725b 100644
--- a/src/compiler/translator/TranslatorHLSL.cpp
+++ b/src/compiler/translator/TranslatorHLSL.cpp
@@ -9,7 +9,7 @@
#include "compiler/translator/InitializeParseContext.h"
#include "compiler/translator/OutputHLSL.h"
-TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
+TranslatorHLSL::TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
: TCompiler(type, spec, output)
{
}
diff --git a/src/compiler/translator/TranslatorHLSL.h b/src/compiler/translator/TranslatorHLSL.h
index 46867b0..f9e771f 100644
--- a/src/compiler/translator/TranslatorHLSL.h
+++ b/src/compiler/translator/TranslatorHLSL.h
@@ -12,7 +12,7 @@
class TranslatorHLSL : public TCompiler {
public:
- TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
+ TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
const std::vector<sh::Uniform> &getUniforms() { return mActiveUniforms; }
diff --git a/src/compiler/translator/ValidateLimitations.cpp b/src/compiler/translator/ValidateLimitations.cpp
index e96a777..51f7ae0 100644
--- a/src/compiler/translator/ValidateLimitations.cpp
+++ b/src/compiler/translator/ValidateLimitations.cpp
@@ -8,6 +8,7 @@
#include "compiler/translator/InfoSink.h"
#include "compiler/translator/InitializeParseContext.h"
#include "compiler/translator/ParseContext.h"
+#include "angle_gl.h"
namespace
{
@@ -48,7 +49,7 @@
} // namespace anonymous
-ValidateLimitations::ValidateLimitations(ShShaderType shaderType,
+ValidateLimitations::ValidateLimitations(sh::GLenum shaderType,
TInfoSinkBase &sink)
: mShaderType(shaderType),
mSink(sink),
@@ -457,7 +458,7 @@
// The index expession must be a constant-index-expression unless
// the operand is a uniform in a vertex shader.
TIntermTyped *operand = node->getLeft();
- bool skip = (mShaderType == SH_VERTEX_SHADER) &&
+ bool skip = (mShaderType == GL_VERTEX_SHADER) &&
(operand->getQualifier() == EvqUniform);
if (!skip && !isConstIndexExpr(index))
{
diff --git a/src/compiler/translator/ValidateLimitations.h b/src/compiler/translator/ValidateLimitations.h
index f28995c..8c9ebf5 100644
--- a/src/compiler/translator/ValidateLimitations.h
+++ b/src/compiler/translator/ValidateLimitations.h
@@ -14,7 +14,7 @@
class ValidateLimitations : public TIntermTraverser
{
public:
- ValidateLimitations(ShShaderType shaderType, TInfoSinkBase &sink);
+ ValidateLimitations(sh::GLenum shaderType, TInfoSinkBase &sink);
int numErrors() const { return mNumErrors; }
@@ -47,7 +47,7 @@
bool isConstIndexExpr(TIntermNode *node);
bool validateIndexing(TIntermBinary *node);
- ShShaderType mShaderType;
+ sh::GLenum mShaderType;
TInfoSinkBase &mSink;
int mNumErrors;
TLoopStack mLoopStack;
diff --git a/src/compiler/translator/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
index d0b1990..536aa14 100644
--- a/src/compiler/translator/VariableInfo.cpp
+++ b/src/compiler/translator/VariableInfo.cpp
@@ -5,6 +5,7 @@
//
#include "compiler/translator/VariableInfo.h"
+#include "angle_gl.h"
namespace {
@@ -16,7 +17,7 @@
}
// Returns the data type for an attribute, uniform, or varying.
-ShDataType getVariableDataType(const TType& type)
+sh::GLenum getVariableDataType(const TType& type)
{
switch (type.getBasicType()) {
case EbtFloat:
@@ -26,97 +27,97 @@
case 2:
switch (type.getRows())
{
- case 2: return SH_FLOAT_MAT2;
- case 3: return SH_FLOAT_MAT2x3;
- case 4: return SH_FLOAT_MAT2x4;
+ case 2: return GL_FLOAT_MAT2;
+ case 3: return GL_FLOAT_MAT2x3;
+ case 4: return GL_FLOAT_MAT2x4;
default: UNREACHABLE();
}
case 3:
switch (type.getRows())
{
- case 2: return SH_FLOAT_MAT3x2;
- case 3: return SH_FLOAT_MAT3;
- case 4: return SH_FLOAT_MAT3x4;
+ case 2: return GL_FLOAT_MAT3x2;
+ case 3: return GL_FLOAT_MAT3;
+ case 4: return GL_FLOAT_MAT3x4;
default: UNREACHABLE();
}
case 4:
switch (type.getRows())
{
- case 2: return SH_FLOAT_MAT4x2;
- case 3: return SH_FLOAT_MAT4x3;
- case 4: return SH_FLOAT_MAT4;
+ case 2: return GL_FLOAT_MAT4x2;
+ case 3: return GL_FLOAT_MAT4x3;
+ case 4: return GL_FLOAT_MAT4;
default: UNREACHABLE();
}
}
} else if (type.isVector()) {
switch (type.getNominalSize()) {
- case 2: return SH_FLOAT_VEC2;
- case 3: return SH_FLOAT_VEC3;
- case 4: return SH_FLOAT_VEC4;
+ case 2: return GL_FLOAT_VEC2;
+ case 3: return GL_FLOAT_VEC3;
+ case 4: return GL_FLOAT_VEC4;
default: UNREACHABLE();
}
} else {
- return SH_FLOAT;
+ return GL_FLOAT;
}
case EbtInt:
if (type.isMatrix()) {
UNREACHABLE();
} else if (type.isVector()) {
switch (type.getNominalSize()) {
- case 2: return SH_INT_VEC2;
- case 3: return SH_INT_VEC3;
- case 4: return SH_INT_VEC4;
+ case 2: return GL_INT_VEC2;
+ case 3: return GL_INT_VEC3;
+ case 4: return GL_INT_VEC4;
default: UNREACHABLE();
}
} else {
- return SH_INT;
+ return GL_INT;
}
case EbtUInt:
if (type.isMatrix()) {
UNREACHABLE();
} else if (type.isVector()) {
switch (type.getNominalSize()) {
- case 2: return SH_UNSIGNED_INT_VEC2;
- case 3: return SH_UNSIGNED_INT_VEC3;
- case 4: return SH_UNSIGNED_INT_VEC4;
+ case 2: return GL_UNSIGNED_INT_VEC2;
+ case 3: return GL_UNSIGNED_INT_VEC3;
+ case 4: return GL_UNSIGNED_INT_VEC4;
default: UNREACHABLE();
}
} else {
- return SH_UNSIGNED_INT;
+ return GL_UNSIGNED_INT;
}
case EbtBool:
if (type.isMatrix()) {
UNREACHABLE();
} else if (type.isVector()) {
switch (type.getNominalSize()) {
- case 2: return SH_BOOL_VEC2;
- case 3: return SH_BOOL_VEC3;
- case 4: return SH_BOOL_VEC4;
+ case 2: return GL_BOOL_VEC2;
+ case 3: return GL_BOOL_VEC3;
+ case 4: return GL_BOOL_VEC4;
default: UNREACHABLE();
}
} else {
- return SH_BOOL;
+ return GL_BOOL;
}
- case EbtSampler2D: return SH_SAMPLER_2D;
- case EbtSampler3D: return SH_SAMPLER_3D;
- case EbtSamplerCube: return SH_SAMPLER_CUBE;
- case EbtSamplerExternalOES: return SH_SAMPLER_EXTERNAL_OES;
- case EbtSampler2DRect: return SH_SAMPLER_2D_RECT_ARB;
- case EbtSampler2DArray: return SH_SAMPLER_2D_ARRAY;
- case EbtISampler2D: return SH_INT_SAMPLER_2D;
- case EbtISampler3D: return SH_INT_SAMPLER_3D;
- case EbtISamplerCube: return SH_INT_SAMPLER_CUBE;
- case EbtISampler2DArray: return SH_INT_SAMPLER_2D_ARRAY;
- case EbtUSampler2D: return SH_UNSIGNED_INT_SAMPLER_2D;
- case EbtUSampler3D: return SH_UNSIGNED_INT_SAMPLER_3D;
- case EbtUSamplerCube: return SH_UNSIGNED_INT_SAMPLER_CUBE;
- case EbtUSampler2DArray: return SH_UNSIGNED_INT_SAMPLER_2D_ARRAY;
- case EbtSampler2DShadow: return SH_SAMPLER_2D_SHADOW;
- case EbtSamplerCubeShadow: return SH_SAMPLER_CUBE_SHADOW;
- case EbtSampler2DArrayShadow: return SH_SAMPLER_2D_ARRAY_SHADOW;
+ case EbtSampler2D: return GL_SAMPLER_2D;
+ case EbtSampler3D: return GL_SAMPLER_3D;
+ case EbtSamplerCube: return GL_SAMPLER_CUBE;
+ case EbtSamplerExternalOES: return GL_SAMPLER_EXTERNAL_OES;
+ case EbtSampler2DRect: return GL_SAMPLER_2D_RECT_ARB;
+ case EbtSampler2DArray: return GL_SAMPLER_2D_ARRAY;
+ case EbtISampler2D: return GL_INT_SAMPLER_2D;
+ case EbtISampler3D: return GL_INT_SAMPLER_3D;
+ case EbtISamplerCube: return GL_INT_SAMPLER_CUBE;
+ case EbtISampler2DArray: return GL_INT_SAMPLER_2D_ARRAY;
+ case EbtUSampler2D: return GL_UNSIGNED_INT_SAMPLER_2D;
+ case EbtUSampler3D: return GL_UNSIGNED_INT_SAMPLER_3D;
+ case EbtUSamplerCube: return GL_UNSIGNED_INT_SAMPLER_CUBE;
+ case EbtUSampler2DArray: return GL_UNSIGNED_INT_SAMPLER_2D_ARRAY;
+ case EbtSampler2DShadow: return GL_SAMPLER_2D_SHADOW;
+ case EbtSamplerCubeShadow: return GL_SAMPLER_CUBE_SHADOW;
+ case EbtSampler2DArrayShadow: return GL_SAMPLER_2D_ARRAY_SHADOW;
default: UNREACHABLE();
}
- return SH_NONE;
+ return GL_NONE;
}
void getBuiltInVariableInfo(const TType& type,
@@ -216,7 +217,7 @@
} // namespace anonymous
TVariableInfo::TVariableInfo()
- : type(SH_NONE),
+ : type(GL_NONE),
size(0),
isArray(false),
precision(EbpUndefined),
@@ -224,7 +225,7 @@
{
}
-TVariableInfo::TVariableInfo(ShDataType type, int size)
+TVariableInfo::TVariableInfo(sh::GLenum type, int size)
: type(type),
size(size),
isArray(false),
@@ -272,7 +273,7 @@
TVariableInfo info;
info.name = "gl_FragCoord";
info.mappedName = "gl_FragCoord";
- info.type = SH_FLOAT_VEC4;
+ info.type = GL_FLOAT_VEC4;
info.size = 1;
info.precision = EbpMedium; // Use mediump as it doesn't really matter.
info.staticUse = true;
@@ -285,7 +286,7 @@
TVariableInfo info;
info.name = "gl_FrontFacing";
info.mappedName = "gl_FrontFacing";
- info.type = SH_BOOL;
+ info.type = GL_BOOL;
info.size = 1;
info.precision = EbpUndefined;
info.staticUse = true;
@@ -298,7 +299,7 @@
TVariableInfo info;
info.name = "gl_PointCoord";
info.mappedName = "gl_PointCoord";
- info.type = SH_FLOAT_VEC2;
+ info.type = GL_FLOAT_VEC2;
info.size = 1;
info.precision = EbpMedium; // Use mediump as it doesn't really matter.
info.staticUse = true;
diff --git a/src/compiler/translator/VariableInfo.h b/src/compiler/translator/VariableInfo.h
index fc9e153..9bd4d53 100644
--- a/src/compiler/translator/VariableInfo.h
+++ b/src/compiler/translator/VariableInfo.h
@@ -12,12 +12,12 @@
// Provides information about a variable.
// It is currently being used to store info about active attribs and uniforms.
struct TVariableInfo {
- TVariableInfo(ShDataType type, int size);
+ TVariableInfo(sh::GLenum type, int size);
TVariableInfo();
TPersistString name;
TPersistString mappedName;
- ShDataType type;
+ sh::GLenum type;
int size;
bool isArray;
TPrecision precision;
diff --git a/src/compiler/translator/VariablePacker.cpp b/src/compiler/translator/VariablePacker.cpp
index da4436e..6cc7198 100644
--- a/src/compiler/translator/VariablePacker.cpp
+++ b/src/compiler/translator/VariablePacker.cpp
@@ -4,44 +4,45 @@
// found in the LICENSE file.
//
#include "compiler/translator/VariablePacker.h"
+#include "angle_gl.h"
#include <algorithm>
namespace {
-int GetSortOrder(ShDataType type)
+int GetSortOrder(sh::GLenum type)
{
switch (type) {
- case SH_FLOAT_MAT4:
- case SH_FLOAT_MAT2x4:
- case SH_FLOAT_MAT3x4:
- case SH_FLOAT_MAT4x2:
- case SH_FLOAT_MAT4x3:
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4x3:
return 0;
- case SH_FLOAT_MAT2:
+ case GL_FLOAT_MAT2:
return 1;
- case SH_FLOAT_VEC4:
- case SH_INT_VEC4:
- case SH_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC4:
return 2;
- case SH_FLOAT_MAT3:
- case SH_FLOAT_MAT2x3:
- case SH_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
return 3;
- case SH_FLOAT_VEC3:
- case SH_INT_VEC3:
- case SH_BOOL_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_BOOL_VEC3:
return 4;
- case SH_FLOAT_VEC2:
- case SH_INT_VEC2:
- case SH_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_BOOL_VEC2:
return 5;
- case SH_FLOAT:
- case SH_INT:
- case SH_BOOL:
- case SH_SAMPLER_2D:
- case SH_SAMPLER_CUBE:
- case SH_SAMPLER_EXTERNAL_OES:
- case SH_SAMPLER_2D_RECT_ARB:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_BOOL:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_RECT_ARB:
return 6;
default:
ASSERT(false);
@@ -50,37 +51,37 @@
}
} // namespace
-int VariablePacker::GetNumComponentsPerRow(ShDataType type)
+int VariablePacker::GetNumComponentsPerRow(sh::GLenum type)
{
switch (type) {
- case SH_FLOAT_MAT4:
- case SH_FLOAT_MAT2:
- case SH_FLOAT_MAT2x4:
- case SH_FLOAT_MAT3x4:
- case SH_FLOAT_MAT4x2:
- case SH_FLOAT_MAT4x3:
- case SH_FLOAT_VEC4:
- case SH_INT_VEC4:
- case SH_BOOL_VEC4:
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4x3:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC4:
return 4;
- case SH_FLOAT_MAT3:
- case SH_FLOAT_MAT2x3:
- case SH_FLOAT_MAT3x2:
- case SH_FLOAT_VEC3:
- case SH_INT_VEC3:
- case SH_BOOL_VEC3:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_BOOL_VEC3:
return 3;
- case SH_FLOAT_VEC2:
- case SH_INT_VEC2:
- case SH_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_BOOL_VEC2:
return 2;
- case SH_FLOAT:
- case SH_INT:
- case SH_BOOL:
- case SH_SAMPLER_2D:
- case SH_SAMPLER_CUBE:
- case SH_SAMPLER_EXTERNAL_OES:
- case SH_SAMPLER_2D_RECT_ARB:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_BOOL:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_RECT_ARB:
return 1;
default:
ASSERT(false);
@@ -88,37 +89,37 @@
}
}
-int VariablePacker::GetNumRows(ShDataType type)
+int VariablePacker::GetNumRows(sh::GLenum type)
{
switch (type) {
- case SH_FLOAT_MAT4:
- case SH_FLOAT_MAT2x4:
- case SH_FLOAT_MAT3x4:
- case SH_FLOAT_MAT4x3:
- case SH_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x3:
+ case GL_FLOAT_MAT4x2:
return 4;
- case SH_FLOAT_MAT3:
- case SH_FLOAT_MAT2x3:
- case SH_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
return 3;
- case SH_FLOAT_MAT2:
+ case GL_FLOAT_MAT2:
return 2;
- case SH_FLOAT_VEC4:
- case SH_INT_VEC4:
- case SH_BOOL_VEC4:
- case SH_FLOAT_VEC3:
- case SH_INT_VEC3:
- case SH_BOOL_VEC3:
- case SH_FLOAT_VEC2:
- case SH_INT_VEC2:
- case SH_BOOL_VEC2:
- case SH_FLOAT:
- case SH_INT:
- case SH_BOOL:
- case SH_SAMPLER_2D:
- case SH_SAMPLER_CUBE:
- case SH_SAMPLER_EXTERNAL_OES:
- case SH_SAMPLER_2D_RECT_ARB:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_BOOL_VEC2:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_BOOL:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_RECT_ARB:
return 1;
default:
ASSERT(false);
diff --git a/src/compiler/translator/VariablePacker.h b/src/compiler/translator/VariablePacker.h
index 2a92321..d66b0fc 100644
--- a/src/compiler/translator/VariablePacker.h
+++ b/src/compiler/translator/VariablePacker.h
@@ -19,10 +19,10 @@
const TVariableInfoList& in_variables);
// Gets how many components in a row a data type takes.
- static int GetNumComponentsPerRow(ShDataType type);
+ static int GetNumComponentsPerRow(sh::GLenum type);
// Gets how many rows a data type takes.
- static int GetNumRows(ShDataType type);
+ static int GetNumRows(sh::GLenum type);
private:
static const int kNumColumns = 4;
diff --git a/src/compiler/translator/VersionGLSL.cpp b/src/compiler/translator/VersionGLSL.cpp
index 3027a77..c03a543 100644
--- a/src/compiler/translator/VersionGLSL.cpp
+++ b/src/compiler/translator/VersionGLSL.cpp
@@ -35,7 +35,7 @@
// - invariant gl_Position;
// - varying vec3 color; invariant color;
//
-TVersionGLSL::TVersionGLSL(ShShaderType type)
+TVersionGLSL::TVersionGLSL(sh::GLenum type)
: mVersion(GLSL_VERSION_110)
{
}
diff --git a/src/compiler/translator/VersionGLSL.h b/src/compiler/translator/VersionGLSL.h
index d2fa21b..442e46d 100644
--- a/src/compiler/translator/VersionGLSL.h
+++ b/src/compiler/translator/VersionGLSL.h
@@ -26,7 +26,7 @@
// TODO: ES3 equivalent versions of GLSL
class TVersionGLSL : public TIntermTraverser {
public:
- TVersionGLSL(ShShaderType type);
+ TVersionGLSL(sh::GLenum type);
// Returns 120 if the following is used the shader:
// - "invariant",
diff --git a/src/compiler/translator/glslang.y b/src/compiler/translator/glslang.y
index 1680f79..556ba14 100644
--- a/src/compiler/translator/glslang.y
+++ b/src/compiler/translator/glslang.y
@@ -34,6 +34,7 @@
#pragma warning(disable: 4701)
#endif
+#include "angle_gl.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/ParseContext.h"
#include "GLSLANG/ShaderLang.h"
@@ -106,14 +107,14 @@
} while (0)
#define VERTEX_ONLY(S, L) { \
- if (context->shaderType != SH_VERTEX_SHADER) { \
+ if (context->shaderType != GL_VERTEX_SHADER) { \
context->error(L, " supported in vertex shaders only ", S); \
context->recover(); \
} \
}
#define FRAG_ONLY(S, L) { \
- if (context->shaderType != SH_FRAGMENT_SHADER) { \
+ if (context->shaderType != GL_FRAGMENT_SHADER) { \
context->error(L, " supported in fragment shaders only ", S); \
context->recover(); \
} \
@@ -820,7 +821,7 @@
$$ = $1.intermAggregate;
}
| PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
- if (($2 == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
+ if (($2 == EbpHigh) && (context->shaderType == GL_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
context->error(@1, "precision is not supported in fragment shader", "highp");
context->recover();
}
@@ -1162,7 +1163,7 @@
ES2_ONLY("varying", @1);
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "varying"))
context->recover();
- if (context->shaderType == SH_VERTEX_SHADER)
+ if (context->shaderType == GL_VERTEX_SHADER)
$$.setBasic(EbtVoid, EvqVaryingOut, @1);
else
$$.setBasic(EbtVoid, EvqVaryingIn, @1);
@@ -1171,7 +1172,7 @@
ES2_ONLY("varying", @1);
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
- if (context->shaderType == SH_VERTEX_SHADER)
+ if (context->shaderType == GL_VERTEX_SHADER)
$$.setBasic(EbtVoid, EvqInvariantVaryingOut, @1);
else
$$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1);
@@ -1210,29 +1211,29 @@
}
| IN_QUAL {
ES3_ONLY("in", @1, "storage qualifier");
- $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
+ $$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
}
| OUT_QUAL {
ES3_ONLY("out", @1, "storage qualifier");
- $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
+ $$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
}
| CENTROID IN_QUAL {
ES3_ONLY("centroid in", @1, "storage qualifier");
- if (context->shaderType == SH_VERTEX_SHADER)
+ if (context->shaderType == GL_VERTEX_SHADER)
{
context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
context->recover();
}
- $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
+ $$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
}
| CENTROID OUT_QUAL {
ES3_ONLY("centroid out", @1, "storage qualifier");
- if (context->shaderType == SH_FRAGMENT_SHADER)
+ if (context->shaderType == GL_FRAGMENT_SHADER)
{
context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
context->recover();
}
- $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
+ $$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
}
| UNIFORM {
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform"))
diff --git a/src/compiler/translator/glslang_tab.cpp b/src/compiler/translator/glslang_tab.cpp
index fc0169e..75b18ca 100644
--- a/src/compiler/translator/glslang_tab.cpp
+++ b/src/compiler/translator/glslang_tab.cpp
@@ -84,6 +84,7 @@
#pragma warning(disable: 4701)
#endif
+#include "angle_gl.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/ParseContext.h"
#include "GLSLANG/ShaderLang.h"
@@ -362,14 +363,14 @@
} while (0)
#define VERTEX_ONLY(S, L) { \
- if (context->shaderType != SH_VERTEX_SHADER) { \
+ if (context->shaderType != GL_VERTEX_SHADER) { \
context->error(L, " supported in vertex shaders only ", S); \
context->recover(); \
} \
}
#define FRAG_ONLY(S, L) { \
- if (context->shaderType != SH_FRAGMENT_SHADER) { \
+ if (context->shaderType != GL_FRAGMENT_SHADER) { \
context->error(L, " supported in fragment shaders only ", S); \
context->recover(); \
} \
@@ -3352,7 +3353,7 @@
case 76:
{
- if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
+ if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == GL_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
context->error((yylsp[(1) - (4)]), "precision is not supported in fragment shader", "highp");
context->recover();
}
@@ -3795,7 +3796,7 @@
ES2_ONLY("varying", (yylsp[(1) - (1)]));
if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "varying"))
context->recover();
- if (context->shaderType == SH_VERTEX_SHADER)
+ if (context->shaderType == GL_VERTEX_SHADER)
(yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[(1) - (1)]));
else
(yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[(1) - (1)]));
@@ -3808,7 +3809,7 @@
ES2_ONLY("varying", (yylsp[(1) - (2)]));
if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
- if (context->shaderType == SH_VERTEX_SHADER)
+ if (context->shaderType == GL_VERTEX_SHADER)
(yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[(1) - (2)]));
else
(yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[(1) - (2)]));
@@ -3872,7 +3873,7 @@
{
ES3_ONLY("in", (yylsp[(1) - (1)]), "storage qualifier");
- (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
+ (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
}
break;
@@ -3880,7 +3881,7 @@
{
ES3_ONLY("out", (yylsp[(1) - (1)]), "storage qualifier");
- (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
+ (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
}
break;
@@ -3888,12 +3889,12 @@
{
ES3_ONLY("centroid in", (yylsp[(1) - (2)]), "storage qualifier");
- if (context->shaderType == SH_VERTEX_SHADER)
+ if (context->shaderType == GL_VERTEX_SHADER)
{
context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
context->recover();
}
- (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
+ (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
}
break;
@@ -3901,12 +3902,12 @@
{
ES3_ONLY("centroid out", (yylsp[(1) - (2)]), "storage qualifier");
- if (context->shaderType == SH_FRAGMENT_SHADER)
+ if (context->shaderType == GL_FRAGMENT_SHADER)
{
context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
context->recover();
}
- (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
+ (yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
}
break;