Commit ce505553 by Jamie Madill

Revert "Return variable type queries using GLenum values."

Breaks the FYI bots until we get Chromium patched. BUG=angle:466 This reverts commit 53221f5a. Change-Id: Ib28548df5c10a6f76f46e4cf8f2013dca5cf0ee2 Reviewed-on: https://chromium-review.googlesource.com/205850Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 53221f5a
...@@ -31,19 +31,24 @@ ...@@ -31,19 +31,24 @@
// and the shading language compiler. // and the shading language compiler.
// //
namespace sh
{
// GLenum alias
typedef unsigned int GLenum;
}
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
// Version number for shader translation API. // Version number for shader translation API.
// It is incremented every time the API changes. // It is incremented every time the API changes.
#define ANGLE_SH_VERSION 126 #define ANGLE_SH_VERSION 125
//
// The names of the following enums have been derived by replacing GL prefix
// with SH. For example, SH_INFO_LOG_LENGTH is equivalent to GL_INFO_LOG_LENGTH.
// The enum values are also equal to the values of their GL counterpart. This
// is done to make it easier for applications to use the shader library.
//
typedef enum {
SH_FRAGMENT_SHADER = 0x8B30,
SH_VERTEX_SHADER = 0x8B31
} ShShaderType;
typedef enum { typedef enum {
SH_GLES2_SPEC = 0x8B40, SH_GLES2_SPEC = 0x8B40,
...@@ -81,6 +86,52 @@ typedef enum { ...@@ -81,6 +86,52 @@ typedef enum {
} ShShaderOutput; } ShShaderOutput;
typedef enum { typedef enum {
SH_NONE = 0,
SH_INT = 0x1404,
SH_UNSIGNED_INT = 0x1405,
SH_FLOAT = 0x1406,
SH_FLOAT_VEC2 = 0x8B50,
SH_FLOAT_VEC3 = 0x8B51,
SH_FLOAT_VEC4 = 0x8B52,
SH_INT_VEC2 = 0x8B53,
SH_INT_VEC3 = 0x8B54,
SH_INT_VEC4 = 0x8B55,
SH_UNSIGNED_INT_VEC2 = 0x8DC6,
SH_UNSIGNED_INT_VEC3 = 0x8DC7,
SH_UNSIGNED_INT_VEC4 = 0x8DC8,
SH_BOOL = 0x8B56,
SH_BOOL_VEC2 = 0x8B57,
SH_BOOL_VEC3 = 0x8B58,
SH_BOOL_VEC4 = 0x8B59,
SH_FLOAT_MAT2 = 0x8B5A,
SH_FLOAT_MAT3 = 0x8B5B,
SH_FLOAT_MAT4 = 0x8B5C,
SH_FLOAT_MAT2x3 = 0x8B65,
SH_FLOAT_MAT2x4 = 0x8B66,
SH_FLOAT_MAT3x2 = 0x8B67,
SH_FLOAT_MAT3x4 = 0x8B68,
SH_FLOAT_MAT4x2 = 0x8B69,
SH_FLOAT_MAT4x3 = 0x8B6A,
SH_SAMPLER_2D = 0x8B5E,
SH_SAMPLER_3D = 0x8B5F,
SH_SAMPLER_CUBE = 0x8B60,
SH_SAMPLER_2D_RECT_ARB = 0x8B63,
SH_SAMPLER_EXTERNAL_OES = 0x8D66,
SH_SAMPLER_2D_ARRAY = 0x8DC1,
SH_INT_SAMPLER_2D = 0x8DCA,
SH_INT_SAMPLER_3D = 0x8DCB,
SH_INT_SAMPLER_CUBE = 0x8DCC,
SH_INT_SAMPLER_2D_ARRAY = 0x8DCF,
SH_UNSIGNED_INT_SAMPLER_2D = 0x8DD2,
SH_UNSIGNED_INT_SAMPLER_3D = 0x8DD3,
SH_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4,
SH_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7,
SH_SAMPLER_2D_SHADOW = 0x8B62,
SH_SAMPLER_CUBE_SHADOW = 0x8DC5,
SH_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4
} ShDataType;
typedef enum {
SH_PRECISION_HIGHP = 0x5001, SH_PRECISION_HIGHP = 0x5001,
SH_PRECISION_MEDIUMP = 0x5002, SH_PRECISION_MEDIUMP = 0x5002,
SH_PRECISION_LOWP = 0x5003, SH_PRECISION_LOWP = 0x5003,
...@@ -142,7 +193,7 @@ typedef enum { ...@@ -142,7 +193,7 @@ typedef enum {
// This flag only has an effect if all of the following are true: // This flag only has an effect if all of the following are true:
// - The shader spec is SH_WEBGL_SPEC. // - The shader spec is SH_WEBGL_SPEC.
// - The compile options contain the SH_TIMING_RESTRICTIONS flag. // - The compile options contain the SH_TIMING_RESTRICTIONS flag.
// - The shader type is GL_FRAGMENT_SHADER. // - The shader type is SH_FRAGMENT_SHADER.
SH_DEPENDENCY_GRAPH = 0x0400, SH_DEPENDENCY_GRAPH = 0x0400,
// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions. // Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
...@@ -294,14 +345,14 @@ COMPILER_EXPORT void ShGetBuiltInResourcesString(const ShHandle handle, size_t o ...@@ -294,14 +345,14 @@ COMPILER_EXPORT void ShGetBuiltInResourcesString(const ShHandle handle, size_t o
// Returns the handle of constructed compiler, null if the requested compiler is // Returns the handle of constructed compiler, null if the requested compiler is
// not supported. // not supported.
// Parameters: // Parameters:
// type: Specifies the type of shader - GL_FRAGMENT_SHADER or GL_VERTEX_SHADER. // type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER.
// spec: Specifies the language spec the compiler must conform to - // spec: Specifies the language spec the compiler must conform to -
// SH_GLES2_SPEC or SH_WEBGL_SPEC. // SH_GLES2_SPEC or SH_WEBGL_SPEC.
// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT, // output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
// SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT. // SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT.
// resources: Specifies the built-in resources. // resources: Specifies the built-in resources.
COMPILER_EXPORT ShHandle ShConstructCompiler( COMPILER_EXPORT ShHandle ShConstructCompiler(
sh::GLenum type, ShShaderType type,
ShShaderSpec spec, ShShaderSpec spec,
ShShaderOutput output, ShShaderOutput output,
const ShBuiltInResources* resources); const ShBuiltInResources* resources);
...@@ -425,7 +476,7 @@ COMPILER_EXPORT void ShGetVariableInfo(const ShHandle handle, ...@@ -425,7 +476,7 @@ COMPILER_EXPORT void ShGetVariableInfo(const ShHandle handle,
int index, int index,
size_t* length, size_t* length,
int* size, int* size,
sh::GLenum* type, ShDataType* type,
ShPrecisionType* precision, ShPrecisionType* precision,
int* staticUse, int* staticUse,
char* name, char* name,
...@@ -463,7 +514,7 @@ COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle, ...@@ -463,7 +514,7 @@ COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle,
typedef struct typedef struct
{ {
sh::GLenum type; ShDataType type;
int size; int size;
} ShVariableInfo; } ShVariableInfo;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <vector> #include <vector>
#include "angle_gl.h"
// //
// Return codes from main. // Return codes from main.
...@@ -25,7 +24,7 @@ enum TFailCode { ...@@ -25,7 +24,7 @@ enum TFailCode {
}; };
static void usage(); static void usage();
static sh::GLenum FindShaderType(const char* fileName); static ShShaderType FindShaderType(const char* fileName);
static bool CompileFile(char* fileName, ShHandle compiler, int compileOptions); static bool CompileFile(char* fileName, ShHandle compiler, int compileOptions);
static void LogMsg(const char* msg, const char* name, const int num, const char* logName); static void LogMsg(const char* msg, const char* name, const int num, const char* logName);
static void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType); static void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType);
...@@ -138,16 +137,16 @@ int main(int argc, char* argv[]) ...@@ -138,16 +137,16 @@ int main(int argc, char* argv[])
} else { } else {
ShHandle compiler = 0; ShHandle compiler = 0;
switch (FindShaderType(argv[0])) { switch (FindShaderType(argv[0])) {
case GL_VERTEX_SHADER: case SH_VERTEX_SHADER:
if (vertexCompiler == 0) if (vertexCompiler == 0)
vertexCompiler = ShConstructCompiler( vertexCompiler = ShConstructCompiler(
GL_VERTEX_SHADER, spec, output, &resources); SH_VERTEX_SHADER, spec, output, &resources);
compiler = vertexCompiler; compiler = vertexCompiler;
break; break;
case GL_FRAGMENT_SHADER: case SH_FRAGMENT_SHADER:
if (fragmentCompiler == 0) if (fragmentCompiler == 0)
fragmentCompiler = ShConstructCompiler( fragmentCompiler = ShConstructCompiler(
GL_FRAGMENT_SHADER, spec, output, &resources); SH_FRAGMENT_SHADER, spec, output, &resources);
compiler = fragmentCompiler; compiler = fragmentCompiler;
break; break;
default: break; default: break;
...@@ -243,7 +242,7 @@ void usage() ...@@ -243,7 +242,7 @@ void usage()
// .frag* = fragment shader // .frag* = fragment shader
// .vert* = vertex shader // .vert* = vertex shader
// //
sh::GLenum FindShaderType(const char* fileName) ShShaderType FindShaderType(const char* fileName)
{ {
assert(fileName); assert(fileName);
...@@ -254,11 +253,11 @@ sh::GLenum FindShaderType(const char* fileName) ...@@ -254,11 +253,11 @@ sh::GLenum FindShaderType(const char* fileName)
ext = strrchr(fileName, '.'); ext = strrchr(fileName, '.');
if (ext) { if (ext) {
if (strncmp(ext, ".frag", 4) == 0) return GL_FRAGMENT_SHADER; if (strncmp(ext, ".frag", 4) == 0) return SH_FRAGMENT_SHADER;
if (strncmp(ext, ".vert", 4) == 0) return GL_VERTEX_SHADER; if (strncmp(ext, ".vert", 4) == 0) return SH_VERTEX_SHADER;
} }
return GL_FRAGMENT_SHADER; return SH_FRAGMENT_SHADER;
} }
// //
...@@ -298,7 +297,7 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType) ...@@ -298,7 +297,7 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType)
size_t activeVars = 0; size_t activeVars = 0;
int size = 0; int size = 0;
sh::GLenum type = GL_NONE; ShDataType type = SH_NONE;
ShPrecisionType precision = SH_PRECISION_UNDEFINED; ShPrecisionType precision = SH_PRECISION_UNDEFINED;
int staticUse = 0; int staticUse = 0;
const char* typeName = NULL; const char* typeName = NULL;
...@@ -314,34 +313,34 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType) ...@@ -314,34 +313,34 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType)
default: assert(0); default: assert(0);
} }
switch (type) { switch (type) {
case GL_FLOAT: typeName = "GL_FLOAT"; break; case SH_FLOAT: typeName = "GL_FLOAT"; break;
case GL_FLOAT_VEC2: typeName = "GL_FLOAT_VEC2"; break; case SH_FLOAT_VEC2: typeName = "GL_FLOAT_VEC2"; break;
case GL_FLOAT_VEC3: typeName = "GL_FLOAT_VEC3"; break; case SH_FLOAT_VEC3: typeName = "GL_FLOAT_VEC3"; break;
case GL_FLOAT_VEC4: typeName = "GL_FLOAT_VEC4"; break; case SH_FLOAT_VEC4: typeName = "GL_FLOAT_VEC4"; break;
case GL_INT: typeName = "GL_INT"; break; case SH_INT: typeName = "GL_INT"; break;
case GL_INT_VEC2: typeName = "GL_INT_VEC2"; break; case SH_INT_VEC2: typeName = "GL_INT_VEC2"; break;
case GL_INT_VEC3: typeName = "GL_INT_VEC3"; break; case SH_INT_VEC3: typeName = "GL_INT_VEC3"; break;
case GL_INT_VEC4: typeName = "GL_INT_VEC4"; break; case SH_INT_VEC4: typeName = "GL_INT_VEC4"; break;
case GL_UNSIGNED_INT: typeName = "GL_UNSIGNED_INT"; break; case SH_UNSIGNED_INT: typeName = "GL_UNSIGNED_INT"; break;
case GL_UNSIGNED_INT_VEC2: typeName = "GL_UNSIGNED_INT_VEC2"; break; case SH_UNSIGNED_INT_VEC2: typeName = "GL_UNSIGNED_INT_VEC2"; break;
case GL_UNSIGNED_INT_VEC3: typeName = "GL_UNSIGNED_INT_VEC3"; break; case SH_UNSIGNED_INT_VEC3: typeName = "GL_UNSIGNED_INT_VEC3"; break;
case GL_UNSIGNED_INT_VEC4: typeName = "GL_UNSIGNED_INT_VEC4"; break; case SH_UNSIGNED_INT_VEC4: typeName = "GL_UNSIGNED_INT_VEC4"; break;
case GL_BOOL: typeName = "GL_BOOL"; break; case SH_BOOL: typeName = "GL_BOOL"; break;
case GL_BOOL_VEC2: typeName = "GL_BOOL_VEC2"; break; case SH_BOOL_VEC2: typeName = "GL_BOOL_VEC2"; break;
case GL_BOOL_VEC3: typeName = "GL_BOOL_VEC3"; break; case SH_BOOL_VEC3: typeName = "GL_BOOL_VEC3"; break;
case GL_BOOL_VEC4: typeName = "GL_BOOL_VEC4"; break; case SH_BOOL_VEC4: typeName = "GL_BOOL_VEC4"; break;
case GL_FLOAT_MAT2: typeName = "GL_FLOAT_MAT2"; break; case SH_FLOAT_MAT2: typeName = "GL_FLOAT_MAT2"; break;
case GL_FLOAT_MAT3: typeName = "GL_FLOAT_MAT3"; break; case SH_FLOAT_MAT3: typeName = "GL_FLOAT_MAT3"; break;
case GL_FLOAT_MAT4: typeName = "GL_FLOAT_MAT4"; break; case SH_FLOAT_MAT4: typeName = "GL_FLOAT_MAT4"; break;
case GL_FLOAT_MAT2x3: typeName = "GL_FLOAT_MAT2x3"; break; case SH_FLOAT_MAT2x3: typeName = "GL_FLOAT_MAT2x3"; break;
case GL_FLOAT_MAT3x2: typeName = "GL_FLOAT_MAT3x2"; break; case SH_FLOAT_MAT3x2: typeName = "GL_FLOAT_MAT3x2"; break;
case GL_FLOAT_MAT4x2: typeName = "GL_FLOAT_MAT4x2"; break; case SH_FLOAT_MAT4x2: typeName = "GL_FLOAT_MAT4x2"; break;
case GL_FLOAT_MAT2x4: typeName = "GL_FLOAT_MAT2x4"; break; case SH_FLOAT_MAT2x4: typeName = "GL_FLOAT_MAT2x4"; break;
case GL_FLOAT_MAT3x4: typeName = "GL_FLOAT_MAT3x4"; break; case SH_FLOAT_MAT3x4: typeName = "GL_FLOAT_MAT3x4"; break;
case GL_FLOAT_MAT4x3: typeName = "GL_FLOAT_MAT4x3"; break; case SH_FLOAT_MAT4x3: typeName = "GL_FLOAT_MAT4x3"; break;
case GL_SAMPLER_2D: typeName = "GL_SAMPLER_2D"; break; case SH_SAMPLER_2D: typeName = "GL_SAMPLER_2D"; break;
case GL_SAMPLER_CUBE: typeName = "GL_SAMPLER_CUBE"; break; case SH_SAMPLER_CUBE: typeName = "GL_SAMPLER_CUBE"; break;
case GL_SAMPLER_EXTERNAL_OES: typeName = "GL_SAMPLER_EXTERNAL_OES"; break; case SH_SAMPLER_EXTERNAL_OES: typeName = "GL_SAMPLER_EXTERNAL_OES"; break;
default: assert(0); default: assert(0);
} }
printf("%lu: name:%s type:%s size:%d\n", i, name, typeName, size); printf("%lu: name:%s type:%s size:%d\n", i, name, typeName, size);
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
namespace sh namespace sh
{ {
// GLenum alias
typedef unsigned int GLenum;
// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec // Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
enum InterpolationType enum InterpolationType
{ {
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "compiler/translator/BuiltInFunctionEmulator.h" #include "compiler/translator/BuiltInFunctionEmulator.h"
#include "compiler/translator/SymbolTable.h" #include "compiler/translator/SymbolTable.h"
#include "angle_gl.h"
namespace { namespace {
...@@ -266,9 +265,9 @@ private: ...@@ -266,9 +265,9 @@ private:
} // anonymous namepsace } // anonymous namepsace
BuiltInFunctionEmulator::BuiltInFunctionEmulator(sh::GLenum shaderType) BuiltInFunctionEmulator::BuiltInFunctionEmulator(ShShaderType shaderType)
{ {
if (shaderType == GL_FRAGMENT_SHADER) { if (shaderType == SH_FRAGMENT_SHADER) {
mFunctionMask = kFunctionEmulationFragmentMask; mFunctionMask = kFunctionEmulationFragmentMask;
mFunctionSource = kFunctionEmulationFragmentSource; mFunctionSource = kFunctionEmulationFragmentSource;
} else { } else {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
// //
class BuiltInFunctionEmulator { class BuiltInFunctionEmulator {
public: public:
BuiltInFunctionEmulator(sh::GLenum shaderType); BuiltInFunctionEmulator(ShShaderType shaderType);
// Records that a function is called by the shader and might needs to be // 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 // emulated. If the function's group is not in mFunctionGroupFilter, this
// becomes an no-op. // becomes an no-op.
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
// a subclass of TCompiler. // a subclass of TCompiler.
// //
TCompiler* ConstructCompiler( TCompiler* ConstructCompiler(
sh::GLenum type, ShShaderSpec spec, ShShaderOutput output) ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
{ {
switch (output) { switch (output) {
case SH_ESSL_OUTPUT: case SH_ESSL_OUTPUT:
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "compiler/translator/timing/RestrictFragmentShaderTiming.h" #include "compiler/translator/timing/RestrictFragmentShaderTiming.h"
#include "compiler/translator/timing/RestrictVertexShaderTiming.h" #include "compiler/translator/timing/RestrictVertexShaderTiming.h"
#include "third_party/compiler/ArrayBoundsClamper.h" #include "third_party/compiler/ArrayBoundsClamper.h"
#include "angle_gl.h"
bool IsWebGLBasedSpec(ShShaderSpec spec) bool IsWebGLBasedSpec(ShShaderSpec spec)
{ {
...@@ -93,7 +92,7 @@ TShHandleBase::~TShHandleBase() ...@@ -93,7 +92,7 @@ TShHandleBase::~TShHandleBase()
allocator.popAll(); allocator.popAll();
} }
TCompiler::TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output) TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
: shaderType(type), : shaderType(type),
shaderSpec(spec), shaderSpec(spec),
outputType(output), outputType(output),
...@@ -113,7 +112,7 @@ TCompiler::~TCompiler() ...@@ -113,7 +112,7 @@ TCompiler::~TCompiler()
bool TCompiler::Init(const ShBuiltInResources& resources) bool TCompiler::Init(const ShBuiltInResources& resources)
{ {
shaderVersion = 100; shaderVersion = 100;
maxUniformVectors = (shaderType == GL_VERTEX_SHADER) ? maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
resources.MaxVertexUniformVectors : resources.MaxVertexUniformVectors :
resources.MaxFragmentUniformVectors; resources.MaxFragmentUniformVectors;
maxExpressionComplexity = resources.MaxExpressionComplexity; maxExpressionComplexity = resources.MaxExpressionComplexity;
...@@ -188,7 +187,7 @@ bool TCompiler::compile(const char* const shaderStrings[], ...@@ -188,7 +187,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (success) if (success)
success = detectCallDepth(root, infoSink, (compileOptions & SH_LIMIT_CALL_STACK_DEPTH) != 0); success = detectCallDepth(root, infoSink, (compileOptions & SH_LIMIT_CALL_STACK_DEPTH) != 0);
if (success && shaderVersion == 300 && shaderType == GL_FRAGMENT_SHADER) if (success && shaderVersion == 300 && shaderType == SH_FRAGMENT_SHADER)
success = validateOutputs(root); success = validateOutputs(root);
if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING)) if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
...@@ -226,7 +225,7 @@ bool TCompiler::compile(const char* const shaderStrings[], ...@@ -226,7 +225,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS)) if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root); arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
if (success && shaderType == GL_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION)) if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION))
initializeGLPosition(root); initializeGLPosition(root);
if (success && (compileOptions & SH_UNFOLD_SHORT_CIRCUIT)) if (success && (compileOptions & SH_UNFOLD_SHORT_CIRCUIT))
...@@ -248,7 +247,7 @@ bool TCompiler::compile(const char* const shaderStrings[], ...@@ -248,7 +247,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
infoSink.info << "too many uniforms"; infoSink.info << "too many uniforms";
} }
} }
if (success && shaderType == GL_VERTEX_SHADER && if (success && shaderType == SH_VERTEX_SHADER &&
(compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE)) (compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
initializeVaryingsWithoutStaticUse(root); initializeVaryingsWithoutStaticUse(root);
} }
...@@ -295,10 +294,10 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources) ...@@ -295,10 +294,10 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
switch(shaderType) switch(shaderType)
{ {
case GL_FRAGMENT_SHADER: case SH_FRAGMENT_SHADER:
symbolTable.setDefaultPrecision(integer, EbpMedium); symbolTable.setDefaultPrecision(integer, EbpMedium);
break; break;
case GL_VERTEX_SHADER: case SH_VERTEX_SHADER:
symbolTable.setDefaultPrecision(integer, EbpHigh); symbolTable.setDefaultPrecision(integer, EbpHigh);
symbolTable.setDefaultPrecision(floatingPoint, EbpHigh); symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
break; break;
...@@ -419,7 +418,7 @@ bool TCompiler::enforceTimingRestrictions(TIntermNode* root, bool outputGraph) ...@@ -419,7 +418,7 @@ bool TCompiler::enforceTimingRestrictions(TIntermNode* root, bool outputGraph)
return false; return false;
} }
if (shaderType == GL_FRAGMENT_SHADER) if (shaderType == SH_FRAGMENT_SHADER)
{ {
TDependencyGraph graph(root); TDependencyGraph graph(root);
...@@ -513,26 +512,26 @@ void TCompiler::initializeVaryingsWithoutStaticUse(TIntermNode* root) ...@@ -513,26 +512,26 @@ void TCompiler::initializeVaryingsWithoutStaticUse(TIntermNode* root)
unsigned char primarySize = 1, secondarySize = 1; unsigned char primarySize = 1, secondarySize = 1;
switch (varying.type) switch (varying.type)
{ {
case GL_FLOAT: case SH_FLOAT:
break; break;
case GL_FLOAT_VEC2: case SH_FLOAT_VEC2:
primarySize = 2; primarySize = 2;
break; break;
case GL_FLOAT_VEC3: case SH_FLOAT_VEC3:
primarySize = 3; primarySize = 3;
break; break;
case GL_FLOAT_VEC4: case SH_FLOAT_VEC4:
primarySize = 4; primarySize = 4;
break; break;
case GL_FLOAT_MAT2: case SH_FLOAT_MAT2:
primarySize = 2; primarySize = 2;
secondarySize = 2; secondarySize = 2;
break; break;
case GL_FLOAT_MAT3: case SH_FLOAT_MAT3:
primarySize = 3; primarySize = 3;
secondarySize = 3; secondarySize = 3;
break; break;
case GL_FLOAT_MAT4: case SH_FLOAT_MAT4:
primarySize = 4; primarySize = 4;
secondarySize = 4; secondarySize = 4;
break; break;
......
...@@ -54,7 +54,7 @@ protected: ...@@ -54,7 +54,7 @@ protected:
// //
class TCompiler : public TShHandleBase { class TCompiler : public TShHandleBase {
public: public:
TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output); TCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
virtual ~TCompiler(); virtual ~TCompiler();
virtual TCompiler* getAsCompiler() { return this; } virtual TCompiler* getAsCompiler() { return this; }
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
std::string getBuiltInResourcesString() const { return builtInResourcesString; } std::string getBuiltInResourcesString() const { return builtInResourcesString; }
protected: protected:
sh::GLenum getShaderType() const { return shaderType; } ShShaderType getShaderType() const { return shaderType; }
// Initialize symbol-table with built-in symbols. // Initialize symbol-table with built-in symbols.
bool InitBuiltInSymbolTable(const ShBuiltInResources& resources); bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
// Compute the string representation of the built-in resources // Compute the string representation of the built-in resources
...@@ -130,7 +130,7 @@ protected: ...@@ -130,7 +130,7 @@ protected:
const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const; const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const;
private: private:
sh::GLenum shaderType; ShShaderType shaderType;
ShShaderSpec shaderSpec; ShShaderSpec shaderSpec;
ShShaderOutput outputType; ShShaderOutput outputType;
...@@ -174,7 +174,7 @@ private: ...@@ -174,7 +174,7 @@ private:
// above machine independent information. // above machine independent information.
// //
TCompiler* ConstructCompiler( TCompiler* ConstructCompiler(
sh::GLenum type, ShShaderSpec spec, ShShaderOutput output); ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
void DeleteCompiler(TCompiler*); void DeleteCompiler(TCompiler*);
#endif // _SHHANDLE_INCLUDED_ #endif // _SHHANDLE_INCLUDED_
...@@ -13,9 +13,8 @@ ...@@ -13,9 +13,8 @@
#include "compiler/translator/Initialize.h" #include "compiler/translator/Initialize.h"
#include "compiler/translator/intermediate.h" #include "compiler/translator/intermediate.h"
#include "angle_gl.h"
void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable) void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
{ {
TType *float1 = new TType(EbtFloat); TType *float1 = new TType(EbtFloat);
TType *float2 = new TType(EbtFloat, 2); TType *float2 = new TType(EbtFloat, 2);
...@@ -363,7 +362,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR ...@@ -363,7 +362,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeGradEXT", samplerCube, float3, float3, float3); symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeGradEXT", samplerCube, float3, float3, float3);
} }
if (type == GL_FRAGMENT_SHADER) if (type == SH_FRAGMENT_SHADER)
{ {
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1); symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1);
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, float1); symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, float1);
...@@ -397,7 +396,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR ...@@ -397,7 +396,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
} }
} }
if(type == GL_VERTEX_SHADER) if(type == SH_VERTEX_SHADER)
{ {
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, float1); symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, float1);
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, float1); symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, float1);
...@@ -427,7 +426,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR ...@@ -427,7 +426,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1);
if (type == GL_FRAGMENT_SHADER) if (type == SH_FRAGMENT_SHADER)
{ {
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1);
...@@ -448,7 +447,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR ...@@ -448,7 +447,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4); symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, float1);
if (type == GL_FRAGMENT_SHADER) if (type == SH_FRAGMENT_SHADER)
{ {
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, float1);
...@@ -463,7 +462,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR ...@@ -463,7 +462,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1);
if(type == GL_FRAGMENT_SHADER) if(type == SH_FRAGMENT_SHADER)
{ {
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "dFdx", float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "dFdx", float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, "dFdx", float2); symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, "dFdx", float2);
...@@ -486,7 +485,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR ...@@ -486,7 +485,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2); symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2);
if(type == GL_FRAGMENT_SHADER) if(type == SH_FRAGMENT_SHADER)
{ {
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, float1);
...@@ -499,7 +498,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR ...@@ -499,7 +498,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2); symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2);
if(type == GL_FRAGMENT_SHADER) if(type == SH_FRAGMENT_SHADER)
{ {
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2, float1); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2, float1);
...@@ -595,7 +594,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR ...@@ -595,7 +594,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", resources.MaxProgramTexelOffset); symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", resources.MaxProgramTexelOffset);
} }
void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec, void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
const ShBuiltInResources &resources, const ShBuiltInResources &resources,
TSymbolTable &symbolTable) TSymbolTable &symbolTable)
{ {
...@@ -604,7 +603,7 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec, ...@@ -604,7 +603,7 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
// the built-in header files. // the built-in header files.
// //
switch(type) { switch(type) {
case GL_FRAGMENT_SHADER: case SH_FRAGMENT_SHADER:
symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4))); 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_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2))); symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
...@@ -627,7 +626,7 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec, ...@@ -627,7 +626,7 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
break; break;
case GL_VERTEX_SHADER: case SH_VERTEX_SHADER:
symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4))); 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))); symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
break; break;
...@@ -695,9 +694,9 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec, ...@@ -695,9 +694,9 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
// Map language-specific operators. // Map language-specific operators.
switch(type) { switch(type) {
case GL_VERTEX_SHADER: case SH_VERTEX_SHADER:
break; break;
case GL_FRAGMENT_SHADER: case SH_FRAGMENT_SHADER:
if (resources.OES_standard_derivatives) if (resources.OES_standard_derivatives)
{ {
symbolTable.relateToOperator(ESSL1_BUILTINS, "dFdx", EOpDFdx); symbolTable.relateToOperator(ESSL1_BUILTINS, "dFdx", EOpDFdx);
...@@ -731,7 +730,7 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec, ...@@ -731,7 +730,7 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
// Finally add resource-specific variables. // Finally add resource-specific variables.
switch(type) { switch(type) {
case GL_FRAGMENT_SHADER: case SH_FRAGMENT_SHADER:
if (spec != SH_CSS_SHADERS_SPEC) { if (spec != SH_CSS_SHADERS_SPEC) {
// Set up gl_FragData. The array size. // Set up gl_FragData. The array size.
TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true); TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#include "compiler/translator/Compiler.h" #include "compiler/translator/Compiler.h"
#include "compiler/translator/SymbolTable.h" #include "compiler/translator/SymbolTable.h"
void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &table); void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &resources, TSymbolTable &table);
void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec, void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
const ShBuiltInResources& resources, const ShBuiltInResources& resources,
TSymbolTable& symbolTable); TSymbolTable& symbolTable);
......
...@@ -142,7 +142,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc ...@@ -142,7 +142,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
if (mOutputType == SH_HLSL9_OUTPUT) if (mOutputType == SH_HLSL9_OUTPUT)
{ {
if (mContext.shaderType == GL_FRAGMENT_SHADER) if (mContext.shaderType == SH_FRAGMENT_SHADER)
{ {
// Reserve registers for dx_DepthRange, dx_ViewCoords and dx_DepthFront // Reserve registers for dx_DepthRange, dx_ViewCoords and dx_DepthFront
mUniformHLSL->reserveUniformRegisters(3); mUniformHLSL->reserveUniformRegisters(3);
...@@ -167,13 +167,13 @@ OutputHLSL::~OutputHLSL() ...@@ -167,13 +167,13 @@ OutputHLSL::~OutputHLSL()
void OutputHLSL::output() void OutputHLSL::output()
{ {
mContainsLoopDiscontinuity = mContext.shaderType == GL_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot); mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER && containsLoopDiscontinuity(mContext.treeRoot);
const std::vector<TIntermTyped*> &flaggedStructs = FlagStd140ValueStructs(mContext.treeRoot); const std::vector<TIntermTyped*> &flaggedStructs = FlagStd140ValueStructs(mContext.treeRoot);
makeFlaggedStructMaps(flaggedStructs); makeFlaggedStructMaps(flaggedStructs);
// Work around D3D9 bug that would manifest in vertex shaders with selection blocks which // 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. // use a vertex attribute as a condition, and some related computation in the else block.
if (mOutputType == SH_HLSL9_OUTPUT && mContext.shaderType == GL_VERTEX_SHADER) if (mOutputType == SH_HLSL9_OUTPUT && mContext.shaderType == SH_VERTEX_SHADER)
{ {
RewriteElseBlocks(mContext.treeRoot); RewriteElseBlocks(mContext.treeRoot);
} }
...@@ -345,7 +345,7 @@ void OutputHLSL::header() ...@@ -345,7 +345,7 @@ void OutputHLSL::header()
out << "#define ANGLE_USES_NESTED_BREAK" << "\n"; out << "#define ANGLE_USES_NESTED_BREAK" << "\n";
} }
if (mContext.shaderType == GL_FRAGMENT_SHADER) if (mContext.shaderType == SH_FRAGMENT_SHADER)
{ {
TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers"); TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
const bool usingMRTExtension = (iter != mContext.extensionBehavior().end() && (iter->second == EBhEnable || iter->second == EBhRequire)); const bool usingMRTExtension = (iter != mContext.extensionBehavior().end() && (iter->second == EBhEnable || iter->second == EBhRequire));
...@@ -2147,7 +2147,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -2147,7 +2147,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
bool bias = (arguments.size() > mandatoryArgumentCount); // Bias argument is optional bool bias = (arguments.size() > mandatoryArgumentCount); // Bias argument is optional
if (lod0 || mContext.shaderType == GL_VERTEX_SHADER) if (lod0 || mContext.shaderType == SH_VERTEX_SHADER)
{ {
if (bias) if (bias)
{ {
......
...@@ -25,7 +25,7 @@ struct TMatrixFields { ...@@ -25,7 +25,7 @@ struct TMatrixFields {
// they can be passed to the parser without needing a global. // they can be passed to the parser without needing a global.
// //
struct TParseContext { struct TParseContext {
TParseContext(TSymbolTable& symt, TExtensionBehavior& ext, TIntermediate& interm, sh::GLenum type, ShShaderSpec spec, int options, bool checksPrecErrors, const char* sourcePath, TInfoSink& is) : TParseContext(TSymbolTable& symt, TExtensionBehavior& ext, TIntermediate& interm, ShShaderType type, ShShaderSpec spec, int options, bool checksPrecErrors, const char* sourcePath, TInfoSink& is) :
intermediate(interm), intermediate(interm),
symbolTable(symt), symbolTable(symt),
shaderType(type), shaderType(type),
...@@ -47,7 +47,7 @@ struct TParseContext { ...@@ -47,7 +47,7 @@ struct TParseContext {
scanner(NULL) { } scanner(NULL) { }
TIntermediate& intermediate; // to hold and build a parse tree TIntermediate& intermediate; // to hold and build a parse tree
TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed
sh::GLenum shaderType; // vertex or fragment language (future: pack or unpack) ShShaderType shaderType; // vertex or fragment language (future: pack or unpack)
ShShaderSpec shaderSpec; // The language specification compiler conforms to - GLES2 or WebGL. ShShaderSpec shaderSpec; // The language specification compiler conforms to - GLES2 or WebGL.
int shaderVersion; int shaderVersion;
int compileOptions; int compileOptions;
......
...@@ -115,7 +115,7 @@ void ShInitBuiltInResources(ShBuiltInResources* resources) ...@@ -115,7 +115,7 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
// //
// Driver calls these to create and destroy compiler objects. // Driver calls these to create and destroy compiler objects.
// //
ShHandle ShConstructCompiler(sh::GLenum type, ShShaderSpec spec, ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
ShShaderOutput output, ShShaderOutput output,
const ShBuiltInResources* resources) const ShBuiltInResources* resources)
{ {
...@@ -293,7 +293,7 @@ void ShGetVariableInfo(const ShHandle handle, ...@@ -293,7 +293,7 @@ void ShGetVariableInfo(const ShHandle handle,
int index, int index,
size_t* length, size_t* length,
int* size, int* size,
sh::GLenum* type, ShDataType* type,
ShPrecisionType* precision, ShPrecisionType* precision,
int* staticUse, int* staticUse,
char* name, char* name,
......
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
#include "compiler/translator/TranslatorESSL.h" #include "compiler/translator/TranslatorESSL.h"
#include "compiler/translator/OutputESSL.h" #include "compiler/translator/OutputESSL.h"
#include "angle_gl.h"
TranslatorESSL::TranslatorESSL(sh::GLenum type, ShShaderSpec spec) TranslatorESSL::TranslatorESSL(ShShaderType type, ShShaderSpec spec)
: TCompiler(type, spec, SH_ESSL_OUTPUT) { : TCompiler(type, spec, SH_ESSL_OUTPUT) {
} }
...@@ -21,7 +20,7 @@ void TranslatorESSL::translate(TIntermNode* root) { ...@@ -21,7 +20,7 @@ void TranslatorESSL::translate(TIntermNode* root) {
// Write emulated built-in functions if needed. // Write emulated built-in functions if needed.
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition( getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
sink, getShaderType() == GL_FRAGMENT_SHADER); sink, getShaderType() == SH_FRAGMENT_SHADER);
// Write array bounds clamping emulation if needed. // Write array bounds clamping emulation if needed.
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink); getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
class TranslatorESSL : public TCompiler { class TranslatorESSL : public TCompiler {
public: public:
TranslatorESSL(sh::GLenum type, ShShaderSpec spec); TranslatorESSL(ShShaderType type, ShShaderSpec spec);
protected: protected:
virtual void translate(TIntermNode* root); virtual void translate(TIntermNode* root);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "compiler/translator/OutputGLSL.h" #include "compiler/translator/OutputGLSL.h"
#include "compiler/translator/VersionGLSL.h" #include "compiler/translator/VersionGLSL.h"
static void writeVersion(sh::GLenum type, TIntermNode* root, static void writeVersion(ShShaderType type, TIntermNode* root,
TInfoSinkBase& sink) { TInfoSinkBase& sink) {
TVersionGLSL versionGLSL(type); TVersionGLSL versionGLSL(type);
root->traverse(&versionGLSL); root->traverse(&versionGLSL);
...@@ -21,7 +21,7 @@ static void writeVersion(sh::GLenum type, TIntermNode* root, ...@@ -21,7 +21,7 @@ static void writeVersion(sh::GLenum type, TIntermNode* root,
} }
} }
TranslatorGLSL::TranslatorGLSL(sh::GLenum type, ShShaderSpec spec) TranslatorGLSL::TranslatorGLSL(ShShaderType type, ShShaderSpec spec)
: TCompiler(type, spec, SH_GLSL_OUTPUT) { : TCompiler(type, spec, SH_GLSL_OUTPUT) {
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
class TranslatorGLSL : public TCompiler { class TranslatorGLSL : public TCompiler {
public: public:
TranslatorGLSL(sh::GLenum type, ShShaderSpec spec); TranslatorGLSL(ShShaderType type, ShShaderSpec spec);
protected: protected:
virtual void translate(TIntermNode* root); virtual void translate(TIntermNode* root);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "compiler/translator/InitializeParseContext.h" #include "compiler/translator/InitializeParseContext.h"
#include "compiler/translator/OutputHLSL.h" #include "compiler/translator/OutputHLSL.h"
TranslatorHLSL::TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output) TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
: TCompiler(type, spec, output) : TCompiler(type, spec, output)
{ {
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
class TranslatorHLSL : public TCompiler { class TranslatorHLSL : public TCompiler {
public: public:
TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output); TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; } virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
const std::vector<sh::Uniform> &getUniforms() { return mActiveUniforms; } const std::vector<sh::Uniform> &getUniforms() { return mActiveUniforms; }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "compiler/translator/InfoSink.h" #include "compiler/translator/InfoSink.h"
#include "compiler/translator/InitializeParseContext.h" #include "compiler/translator/InitializeParseContext.h"
#include "compiler/translator/ParseContext.h" #include "compiler/translator/ParseContext.h"
#include "angle_gl.h"
namespace namespace
{ {
...@@ -49,7 +48,7 @@ class ValidateConstIndexExpr : public TIntermTraverser ...@@ -49,7 +48,7 @@ class ValidateConstIndexExpr : public TIntermTraverser
} // namespace anonymous } // namespace anonymous
ValidateLimitations::ValidateLimitations(sh::GLenum shaderType, ValidateLimitations::ValidateLimitations(ShShaderType shaderType,
TInfoSinkBase &sink) TInfoSinkBase &sink)
: mShaderType(shaderType), : mShaderType(shaderType),
mSink(sink), mSink(sink),
...@@ -458,7 +457,7 @@ bool ValidateLimitations::validateIndexing(TIntermBinary *node) ...@@ -458,7 +457,7 @@ bool ValidateLimitations::validateIndexing(TIntermBinary *node)
// The index expession must be a constant-index-expression unless // The index expession must be a constant-index-expression unless
// the operand is a uniform in a vertex shader. // the operand is a uniform in a vertex shader.
TIntermTyped *operand = node->getLeft(); TIntermTyped *operand = node->getLeft();
bool skip = (mShaderType == GL_VERTEX_SHADER) && bool skip = (mShaderType == SH_VERTEX_SHADER) &&
(operand->getQualifier() == EvqUniform); (operand->getQualifier() == EvqUniform);
if (!skip && !isConstIndexExpr(index)) if (!skip && !isConstIndexExpr(index))
{ {
......
...@@ -14,7 +14,7 @@ class TInfoSinkBase; ...@@ -14,7 +14,7 @@ class TInfoSinkBase;
class ValidateLimitations : public TIntermTraverser class ValidateLimitations : public TIntermTraverser
{ {
public: public:
ValidateLimitations(sh::GLenum shaderType, TInfoSinkBase &sink); ValidateLimitations(ShShaderType shaderType, TInfoSinkBase &sink);
int numErrors() const { return mNumErrors; } int numErrors() const { return mNumErrors; }
...@@ -47,7 +47,7 @@ class ValidateLimitations : public TIntermTraverser ...@@ -47,7 +47,7 @@ class ValidateLimitations : public TIntermTraverser
bool isConstIndexExpr(TIntermNode *node); bool isConstIndexExpr(TIntermNode *node);
bool validateIndexing(TIntermBinary *node); bool validateIndexing(TIntermBinary *node);
sh::GLenum mShaderType; ShShaderType mShaderType;
TInfoSinkBase &mSink; TInfoSinkBase &mSink;
int mNumErrors; int mNumErrors;
TLoopStack mLoopStack; TLoopStack mLoopStack;
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
// //
#include "compiler/translator/VariableInfo.h" #include "compiler/translator/VariableInfo.h"
#include "angle_gl.h"
namespace { namespace {
...@@ -17,7 +16,7 @@ TString arrayBrackets(int index) ...@@ -17,7 +16,7 @@ TString arrayBrackets(int index)
} }
// Returns the data type for an attribute, uniform, or varying. // Returns the data type for an attribute, uniform, or varying.
sh::GLenum getVariableDataType(const TType& type) ShDataType getVariableDataType(const TType& type)
{ {
switch (type.getBasicType()) { switch (type.getBasicType()) {
case EbtFloat: case EbtFloat:
...@@ -27,97 +26,97 @@ sh::GLenum getVariableDataType(const TType& type) ...@@ -27,97 +26,97 @@ sh::GLenum getVariableDataType(const TType& type)
case 2: case 2:
switch (type.getRows()) switch (type.getRows())
{ {
case 2: return GL_FLOAT_MAT2; case 2: return SH_FLOAT_MAT2;
case 3: return GL_FLOAT_MAT2x3; case 3: return SH_FLOAT_MAT2x3;
case 4: return GL_FLOAT_MAT2x4; case 4: return SH_FLOAT_MAT2x4;
default: UNREACHABLE(); default: UNREACHABLE();
} }
case 3: case 3:
switch (type.getRows()) switch (type.getRows())
{ {
case 2: return GL_FLOAT_MAT3x2; case 2: return SH_FLOAT_MAT3x2;
case 3: return GL_FLOAT_MAT3; case 3: return SH_FLOAT_MAT3;
case 4: return GL_FLOAT_MAT3x4; case 4: return SH_FLOAT_MAT3x4;
default: UNREACHABLE(); default: UNREACHABLE();
} }
case 4: case 4:
switch (type.getRows()) switch (type.getRows())
{ {
case 2: return GL_FLOAT_MAT4x2; case 2: return SH_FLOAT_MAT4x2;
case 3: return GL_FLOAT_MAT4x3; case 3: return SH_FLOAT_MAT4x3;
case 4: return GL_FLOAT_MAT4; case 4: return SH_FLOAT_MAT4;
default: UNREACHABLE(); default: UNREACHABLE();
} }
} }
} else if (type.isVector()) { } else if (type.isVector()) {
switch (type.getNominalSize()) { switch (type.getNominalSize()) {
case 2: return GL_FLOAT_VEC2; case 2: return SH_FLOAT_VEC2;
case 3: return GL_FLOAT_VEC3; case 3: return SH_FLOAT_VEC3;
case 4: return GL_FLOAT_VEC4; case 4: return SH_FLOAT_VEC4;
default: UNREACHABLE(); default: UNREACHABLE();
} }
} else { } else {
return GL_FLOAT; return SH_FLOAT;
} }
case EbtInt: case EbtInt:
if (type.isMatrix()) { if (type.isMatrix()) {
UNREACHABLE(); UNREACHABLE();
} else if (type.isVector()) { } else if (type.isVector()) {
switch (type.getNominalSize()) { switch (type.getNominalSize()) {
case 2: return GL_INT_VEC2; case 2: return SH_INT_VEC2;
case 3: return GL_INT_VEC3; case 3: return SH_INT_VEC3;
case 4: return GL_INT_VEC4; case 4: return SH_INT_VEC4;
default: UNREACHABLE(); default: UNREACHABLE();
} }
} else { } else {
return GL_INT; return SH_INT;
} }
case EbtUInt: case EbtUInt:
if (type.isMatrix()) { if (type.isMatrix()) {
UNREACHABLE(); UNREACHABLE();
} else if (type.isVector()) { } else if (type.isVector()) {
switch (type.getNominalSize()) { switch (type.getNominalSize()) {
case 2: return GL_UNSIGNED_INT_VEC2; case 2: return SH_UNSIGNED_INT_VEC2;
case 3: return GL_UNSIGNED_INT_VEC3; case 3: return SH_UNSIGNED_INT_VEC3;
case 4: return GL_UNSIGNED_INT_VEC4; case 4: return SH_UNSIGNED_INT_VEC4;
default: UNREACHABLE(); default: UNREACHABLE();
} }
} else { } else {
return GL_UNSIGNED_INT; return SH_UNSIGNED_INT;
} }
case EbtBool: case EbtBool:
if (type.isMatrix()) { if (type.isMatrix()) {
UNREACHABLE(); UNREACHABLE();
} else if (type.isVector()) { } else if (type.isVector()) {
switch (type.getNominalSize()) { switch (type.getNominalSize()) {
case 2: return GL_BOOL_VEC2; case 2: return SH_BOOL_VEC2;
case 3: return GL_BOOL_VEC3; case 3: return SH_BOOL_VEC3;
case 4: return GL_BOOL_VEC4; case 4: return SH_BOOL_VEC4;
default: UNREACHABLE(); default: UNREACHABLE();
} }
} else { } else {
return GL_BOOL; return SH_BOOL;
} }
case EbtSampler2D: return GL_SAMPLER_2D; case EbtSampler2D: return SH_SAMPLER_2D;
case EbtSampler3D: return GL_SAMPLER_3D; case EbtSampler3D: return SH_SAMPLER_3D;
case EbtSamplerCube: return GL_SAMPLER_CUBE; case EbtSamplerCube: return SH_SAMPLER_CUBE;
case EbtSamplerExternalOES: return GL_SAMPLER_EXTERNAL_OES; case EbtSamplerExternalOES: return SH_SAMPLER_EXTERNAL_OES;
case EbtSampler2DRect: return GL_SAMPLER_2D_RECT_ARB; case EbtSampler2DRect: return SH_SAMPLER_2D_RECT_ARB;
case EbtSampler2DArray: return GL_SAMPLER_2D_ARRAY; case EbtSampler2DArray: return SH_SAMPLER_2D_ARRAY;
case EbtISampler2D: return GL_INT_SAMPLER_2D; case EbtISampler2D: return SH_INT_SAMPLER_2D;
case EbtISampler3D: return GL_INT_SAMPLER_3D; case EbtISampler3D: return SH_INT_SAMPLER_3D;
case EbtISamplerCube: return GL_INT_SAMPLER_CUBE; case EbtISamplerCube: return SH_INT_SAMPLER_CUBE;
case EbtISampler2DArray: return GL_INT_SAMPLER_2D_ARRAY; case EbtISampler2DArray: return SH_INT_SAMPLER_2D_ARRAY;
case EbtUSampler2D: return GL_UNSIGNED_INT_SAMPLER_2D; case EbtUSampler2D: return SH_UNSIGNED_INT_SAMPLER_2D;
case EbtUSampler3D: return GL_UNSIGNED_INT_SAMPLER_3D; case EbtUSampler3D: return SH_UNSIGNED_INT_SAMPLER_3D;
case EbtUSamplerCube: return GL_UNSIGNED_INT_SAMPLER_CUBE; case EbtUSamplerCube: return SH_UNSIGNED_INT_SAMPLER_CUBE;
case EbtUSampler2DArray: return GL_UNSIGNED_INT_SAMPLER_2D_ARRAY; case EbtUSampler2DArray: return SH_UNSIGNED_INT_SAMPLER_2D_ARRAY;
case EbtSampler2DShadow: return GL_SAMPLER_2D_SHADOW; case EbtSampler2DShadow: return SH_SAMPLER_2D_SHADOW;
case EbtSamplerCubeShadow: return GL_SAMPLER_CUBE_SHADOW; case EbtSamplerCubeShadow: return SH_SAMPLER_CUBE_SHADOW;
case EbtSampler2DArrayShadow: return GL_SAMPLER_2D_ARRAY_SHADOW; case EbtSampler2DArrayShadow: return SH_SAMPLER_2D_ARRAY_SHADOW;
default: UNREACHABLE(); default: UNREACHABLE();
} }
return GL_NONE; return SH_NONE;
} }
void getBuiltInVariableInfo(const TType& type, void getBuiltInVariableInfo(const TType& type,
...@@ -217,7 +216,7 @@ TVariableInfo* findVariable(const TType& type, ...@@ -217,7 +216,7 @@ TVariableInfo* findVariable(const TType& type,
} // namespace anonymous } // namespace anonymous
TVariableInfo::TVariableInfo() TVariableInfo::TVariableInfo()
: type(GL_NONE), : type(SH_NONE),
size(0), size(0),
isArray(false), isArray(false),
precision(EbpUndefined), precision(EbpUndefined),
...@@ -225,7 +224,7 @@ TVariableInfo::TVariableInfo() ...@@ -225,7 +224,7 @@ TVariableInfo::TVariableInfo()
{ {
} }
TVariableInfo::TVariableInfo(sh::GLenum type, int size) TVariableInfo::TVariableInfo(ShDataType type, int size)
: type(type), : type(type),
size(size), size(size),
isArray(false), isArray(false),
...@@ -273,7 +272,7 @@ void CollectVariables::visitSymbol(TIntermSymbol* symbol) ...@@ -273,7 +272,7 @@ void CollectVariables::visitSymbol(TIntermSymbol* symbol)
TVariableInfo info; TVariableInfo info;
info.name = "gl_FragCoord"; info.name = "gl_FragCoord";
info.mappedName = "gl_FragCoord"; info.mappedName = "gl_FragCoord";
info.type = GL_FLOAT_VEC4; info.type = SH_FLOAT_VEC4;
info.size = 1; info.size = 1;
info.precision = EbpMedium; // Use mediump as it doesn't really matter. info.precision = EbpMedium; // Use mediump as it doesn't really matter.
info.staticUse = true; info.staticUse = true;
...@@ -286,7 +285,7 @@ void CollectVariables::visitSymbol(TIntermSymbol* symbol) ...@@ -286,7 +285,7 @@ void CollectVariables::visitSymbol(TIntermSymbol* symbol)
TVariableInfo info; TVariableInfo info;
info.name = "gl_FrontFacing"; info.name = "gl_FrontFacing";
info.mappedName = "gl_FrontFacing"; info.mappedName = "gl_FrontFacing";
info.type = GL_BOOL; info.type = SH_BOOL;
info.size = 1; info.size = 1;
info.precision = EbpUndefined; info.precision = EbpUndefined;
info.staticUse = true; info.staticUse = true;
...@@ -299,7 +298,7 @@ void CollectVariables::visitSymbol(TIntermSymbol* symbol) ...@@ -299,7 +298,7 @@ void CollectVariables::visitSymbol(TIntermSymbol* symbol)
TVariableInfo info; TVariableInfo info;
info.name = "gl_PointCoord"; info.name = "gl_PointCoord";
info.mappedName = "gl_PointCoord"; info.mappedName = "gl_PointCoord";
info.type = GL_FLOAT_VEC2; info.type = SH_FLOAT_VEC2;
info.size = 1; info.size = 1;
info.precision = EbpMedium; // Use mediump as it doesn't really matter. info.precision = EbpMedium; // Use mediump as it doesn't really matter.
info.staticUse = true; info.staticUse = true;
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
// Provides information about a variable. // Provides information about a variable.
// It is currently being used to store info about active attribs and uniforms. // It is currently being used to store info about active attribs and uniforms.
struct TVariableInfo { struct TVariableInfo {
TVariableInfo(sh::GLenum type, int size); TVariableInfo(ShDataType type, int size);
TVariableInfo(); TVariableInfo();
TPersistString name; TPersistString name;
TPersistString mappedName; TPersistString mappedName;
sh::GLenum type; ShDataType type;
int size; int size;
bool isArray; bool isArray;
TPrecision precision; TPrecision precision;
......
...@@ -4,45 +4,44 @@ ...@@ -4,45 +4,44 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
#include "compiler/translator/VariablePacker.h" #include "compiler/translator/VariablePacker.h"
#include "angle_gl.h"
#include <algorithm> #include <algorithm>
namespace { namespace {
int GetSortOrder(sh::GLenum type) int GetSortOrder(ShDataType type)
{ {
switch (type) { switch (type) {
case GL_FLOAT_MAT4: case SH_FLOAT_MAT4:
case GL_FLOAT_MAT2x4: case SH_FLOAT_MAT2x4:
case GL_FLOAT_MAT3x4: case SH_FLOAT_MAT3x4:
case GL_FLOAT_MAT4x2: case SH_FLOAT_MAT4x2:
case GL_FLOAT_MAT4x3: case SH_FLOAT_MAT4x3:
return 0; return 0;
case GL_FLOAT_MAT2: case SH_FLOAT_MAT2:
return 1; return 1;
case GL_FLOAT_VEC4: case SH_FLOAT_VEC4:
case GL_INT_VEC4: case SH_INT_VEC4:
case GL_BOOL_VEC4: case SH_BOOL_VEC4:
return 2; return 2;
case GL_FLOAT_MAT3: case SH_FLOAT_MAT3:
case GL_FLOAT_MAT2x3: case SH_FLOAT_MAT2x3:
case GL_FLOAT_MAT3x2: case SH_FLOAT_MAT3x2:
return 3; return 3;
case GL_FLOAT_VEC3: case SH_FLOAT_VEC3:
case GL_INT_VEC3: case SH_INT_VEC3:
case GL_BOOL_VEC3: case SH_BOOL_VEC3:
return 4; return 4;
case GL_FLOAT_VEC2: case SH_FLOAT_VEC2:
case GL_INT_VEC2: case SH_INT_VEC2:
case GL_BOOL_VEC2: case SH_BOOL_VEC2:
return 5; return 5;
case GL_FLOAT: case SH_FLOAT:
case GL_INT: case SH_INT:
case GL_BOOL: case SH_BOOL:
case GL_SAMPLER_2D: case SH_SAMPLER_2D:
case GL_SAMPLER_CUBE: case SH_SAMPLER_CUBE:
case GL_SAMPLER_EXTERNAL_OES: case SH_SAMPLER_EXTERNAL_OES:
case GL_SAMPLER_2D_RECT_ARB: case SH_SAMPLER_2D_RECT_ARB:
return 6; return 6;
default: default:
ASSERT(false); ASSERT(false);
...@@ -51,37 +50,37 @@ int GetSortOrder(sh::GLenum type) ...@@ -51,37 +50,37 @@ int GetSortOrder(sh::GLenum type)
} }
} // namespace } // namespace
int VariablePacker::GetNumComponentsPerRow(sh::GLenum type) int VariablePacker::GetNumComponentsPerRow(ShDataType type)
{ {
switch (type) { switch (type) {
case GL_FLOAT_MAT4: case SH_FLOAT_MAT4:
case GL_FLOAT_MAT2: case SH_FLOAT_MAT2:
case GL_FLOAT_MAT2x4: case SH_FLOAT_MAT2x4:
case GL_FLOAT_MAT3x4: case SH_FLOAT_MAT3x4:
case GL_FLOAT_MAT4x2: case SH_FLOAT_MAT4x2:
case GL_FLOAT_MAT4x3: case SH_FLOAT_MAT4x3:
case GL_FLOAT_VEC4: case SH_FLOAT_VEC4:
case GL_INT_VEC4: case SH_INT_VEC4:
case GL_BOOL_VEC4: case SH_BOOL_VEC4:
return 4; return 4;
case GL_FLOAT_MAT3: case SH_FLOAT_MAT3:
case GL_FLOAT_MAT2x3: case SH_FLOAT_MAT2x3:
case GL_FLOAT_MAT3x2: case SH_FLOAT_MAT3x2:
case GL_FLOAT_VEC3: case SH_FLOAT_VEC3:
case GL_INT_VEC3: case SH_INT_VEC3:
case GL_BOOL_VEC3: case SH_BOOL_VEC3:
return 3; return 3;
case GL_FLOAT_VEC2: case SH_FLOAT_VEC2:
case GL_INT_VEC2: case SH_INT_VEC2:
case GL_BOOL_VEC2: case SH_BOOL_VEC2:
return 2; return 2;
case GL_FLOAT: case SH_FLOAT:
case GL_INT: case SH_INT:
case GL_BOOL: case SH_BOOL:
case GL_SAMPLER_2D: case SH_SAMPLER_2D:
case GL_SAMPLER_CUBE: case SH_SAMPLER_CUBE:
case GL_SAMPLER_EXTERNAL_OES: case SH_SAMPLER_EXTERNAL_OES:
case GL_SAMPLER_2D_RECT_ARB: case SH_SAMPLER_2D_RECT_ARB:
return 1; return 1;
default: default:
ASSERT(false); ASSERT(false);
...@@ -89,37 +88,37 @@ int VariablePacker::GetNumComponentsPerRow(sh::GLenum type) ...@@ -89,37 +88,37 @@ int VariablePacker::GetNumComponentsPerRow(sh::GLenum type)
} }
} }
int VariablePacker::GetNumRows(sh::GLenum type) int VariablePacker::GetNumRows(ShDataType type)
{ {
switch (type) { switch (type) {
case GL_FLOAT_MAT4: case SH_FLOAT_MAT4:
case GL_FLOAT_MAT2x4: case SH_FLOAT_MAT2x4:
case GL_FLOAT_MAT3x4: case SH_FLOAT_MAT3x4:
case GL_FLOAT_MAT4x3: case SH_FLOAT_MAT4x3:
case GL_FLOAT_MAT4x2: case SH_FLOAT_MAT4x2:
return 4; return 4;
case GL_FLOAT_MAT3: case SH_FLOAT_MAT3:
case GL_FLOAT_MAT2x3: case SH_FLOAT_MAT2x3:
case GL_FLOAT_MAT3x2: case SH_FLOAT_MAT3x2:
return 3; return 3;
case GL_FLOAT_MAT2: case SH_FLOAT_MAT2:
return 2; return 2;
case GL_FLOAT_VEC4: case SH_FLOAT_VEC4:
case GL_INT_VEC4: case SH_INT_VEC4:
case GL_BOOL_VEC4: case SH_BOOL_VEC4:
case GL_FLOAT_VEC3: case SH_FLOAT_VEC3:
case GL_INT_VEC3: case SH_INT_VEC3:
case GL_BOOL_VEC3: case SH_BOOL_VEC3:
case GL_FLOAT_VEC2: case SH_FLOAT_VEC2:
case GL_INT_VEC2: case SH_INT_VEC2:
case GL_BOOL_VEC2: case SH_BOOL_VEC2:
case GL_FLOAT: case SH_FLOAT:
case GL_INT: case SH_INT:
case GL_BOOL: case SH_BOOL:
case GL_SAMPLER_2D: case SH_SAMPLER_2D:
case GL_SAMPLER_CUBE: case SH_SAMPLER_CUBE:
case GL_SAMPLER_EXTERNAL_OES: case SH_SAMPLER_EXTERNAL_OES:
case GL_SAMPLER_2D_RECT_ARB: case SH_SAMPLER_2D_RECT_ARB:
return 1; return 1;
default: default:
ASSERT(false); ASSERT(false);
......
...@@ -19,10 +19,10 @@ class VariablePacker { ...@@ -19,10 +19,10 @@ class VariablePacker {
const TVariableInfoList& in_variables); const TVariableInfoList& in_variables);
// Gets how many components in a row a data type takes. // Gets how many components in a row a data type takes.
static int GetNumComponentsPerRow(sh::GLenum type); static int GetNumComponentsPerRow(ShDataType type);
// Gets how many rows a data type takes. // Gets how many rows a data type takes.
static int GetNumRows(sh::GLenum type); static int GetNumRows(ShDataType type);
private: private:
static const int kNumColumns = 4; static const int kNumColumns = 4;
......
...@@ -35,7 +35,7 @@ static const int GLSL_VERSION_120 = 120; ...@@ -35,7 +35,7 @@ static const int GLSL_VERSION_120 = 120;
// - invariant gl_Position; // - invariant gl_Position;
// - varying vec3 color; invariant color; // - varying vec3 color; invariant color;
// //
TVersionGLSL::TVersionGLSL(sh::GLenum type) TVersionGLSL::TVersionGLSL(ShShaderType type)
: mVersion(GLSL_VERSION_110) : mVersion(GLSL_VERSION_110)
{ {
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// TODO: ES3 equivalent versions of GLSL // TODO: ES3 equivalent versions of GLSL
class TVersionGLSL : public TIntermTraverser { class TVersionGLSL : public TIntermTraverser {
public: public:
TVersionGLSL(sh::GLenum type); TVersionGLSL(ShShaderType type);
// Returns 120 if the following is used the shader: // Returns 120 if the following is used the shader:
// - "invariant", // - "invariant",
......
...@@ -37,7 +37,6 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h). ...@@ -37,7 +37,6 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
#include "compiler/translator/SymbolTable.h" #include "compiler/translator/SymbolTable.h"
#include "compiler/translator/ParseContext.h" #include "compiler/translator/ParseContext.h"
#include "GLSLANG/ShaderLang.h" #include "GLSLANG/ShaderLang.h"
#include "angle_gl.h"
#define YYENABLE_NLS 0 #define YYENABLE_NLS 0
...@@ -107,14 +106,14 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason) ...@@ -107,14 +106,14 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
} while (0) } while (0)
#define VERTEX_ONLY(S, L) { \ #define VERTEX_ONLY(S, L) { \
if (context->shaderType != GL_VERTEX_SHADER) { \ if (context->shaderType != SH_VERTEX_SHADER) { \
context->error(L, " supported in vertex shaders only ", S); \ context->error(L, " supported in vertex shaders only ", S); \
context->recover(); \ context->recover(); \
} \ } \
} }
#define FRAG_ONLY(S, L) { \ #define FRAG_ONLY(S, L) { \
if (context->shaderType != GL_FRAGMENT_SHADER) { \ if (context->shaderType != SH_FRAGMENT_SHADER) { \
context->error(L, " supported in fragment shaders only ", S); \ context->error(L, " supported in fragment shaders only ", S); \
context->recover(); \ context->recover(); \
} \ } \
...@@ -821,7 +820,7 @@ declaration ...@@ -821,7 +820,7 @@ declaration
$$ = $1.intermAggregate; $$ = $1.intermAggregate;
} }
| PRECISION precision_qualifier type_specifier_no_prec SEMICOLON { | PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
if (($2 == EbpHigh) && (context->shaderType == GL_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) { if (($2 == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
context->error(@1, "precision is not supported in fragment shader", "highp"); context->error(@1, "precision is not supported in fragment shader", "highp");
context->recover(); context->recover();
} }
...@@ -1163,7 +1162,7 @@ type_qualifier ...@@ -1163,7 +1162,7 @@ type_qualifier
ES2_ONLY("varying", @1); ES2_ONLY("varying", @1);
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "varying")) if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "varying"))
context->recover(); context->recover();
if (context->shaderType == GL_VERTEX_SHADER) if (context->shaderType == SH_VERTEX_SHADER)
$$.setBasic(EbtVoid, EvqVaryingOut, @1); $$.setBasic(EbtVoid, EvqVaryingOut, @1);
else else
$$.setBasic(EbtVoid, EvqVaryingIn, @1); $$.setBasic(EbtVoid, EvqVaryingIn, @1);
...@@ -1172,7 +1171,7 @@ type_qualifier ...@@ -1172,7 +1171,7 @@ type_qualifier
ES2_ONLY("varying", @1); ES2_ONLY("varying", @1);
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying")) if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover(); context->recover();
if (context->shaderType == GL_VERTEX_SHADER) if (context->shaderType == SH_VERTEX_SHADER)
$$.setBasic(EbtVoid, EvqInvariantVaryingOut, @1); $$.setBasic(EbtVoid, EvqInvariantVaryingOut, @1);
else else
$$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1); $$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1);
...@@ -1211,29 +1210,29 @@ storage_qualifier ...@@ -1211,29 +1210,29 @@ storage_qualifier
} }
| IN_QUAL { | IN_QUAL {
ES3_ONLY("in", @1, "storage qualifier"); ES3_ONLY("in", @1, "storage qualifier");
$$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn; $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
} }
| OUT_QUAL { | OUT_QUAL {
ES3_ONLY("out", @1, "storage qualifier"); ES3_ONLY("out", @1, "storage qualifier");
$$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut; $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
} }
| CENTROID IN_QUAL { | CENTROID IN_QUAL {
ES3_ONLY("centroid in", @1, "storage qualifier"); ES3_ONLY("centroid in", @1, "storage qualifier");
if (context->shaderType == GL_VERTEX_SHADER) if (context->shaderType == SH_VERTEX_SHADER)
{ {
context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader"); context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
context->recover(); context->recover();
} }
$$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn; $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
} }
| CENTROID OUT_QUAL { | CENTROID OUT_QUAL {
ES3_ONLY("centroid out", @1, "storage qualifier"); ES3_ONLY("centroid out", @1, "storage qualifier");
if (context->shaderType == GL_FRAGMENT_SHADER) if (context->shaderType == SH_FRAGMENT_SHADER)
{ {
context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader"); context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
context->recover(); context->recover();
} }
$$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut; $$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
} }
| UNIFORM { | UNIFORM {
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform")) if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform"))
......
...@@ -87,7 +87,6 @@ ...@@ -87,7 +87,6 @@
#include "compiler/translator/SymbolTable.h" #include "compiler/translator/SymbolTable.h"
#include "compiler/translator/ParseContext.h" #include "compiler/translator/ParseContext.h"
#include "GLSLANG/ShaderLang.h" #include "GLSLANG/ShaderLang.h"
#include "angle_gl.h"
#define YYENABLE_NLS 0 #define YYENABLE_NLS 0
...@@ -363,14 +362,14 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason) ...@@ -363,14 +362,14 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
} while (0) } while (0)
#define VERTEX_ONLY(S, L) { \ #define VERTEX_ONLY(S, L) { \
if (context->shaderType != GL_VERTEX_SHADER) { \ if (context->shaderType != SH_VERTEX_SHADER) { \
context->error(L, " supported in vertex shaders only ", S); \ context->error(L, " supported in vertex shaders only ", S); \
context->recover(); \ context->recover(); \
} \ } \
} }
#define FRAG_ONLY(S, L) { \ #define FRAG_ONLY(S, L) { \
if (context->shaderType != GL_FRAGMENT_SHADER) { \ if (context->shaderType != SH_FRAGMENT_SHADER) { \
context->error(L, " supported in fragment shaders only ", S); \ context->error(L, " supported in fragment shaders only ", S); \
context->recover(); \ context->recover(); \
} \ } \
...@@ -3353,7 +3352,7 @@ yyreduce: ...@@ -3353,7 +3352,7 @@ yyreduce:
case 76: case 76:
{ {
if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == GL_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) { if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) && (context->shaderType == SH_FRAGMENT_SHADER) && !context->fragmentPrecisionHigh) {
context->error((yylsp[(1) - (4)]), "precision is not supported in fragment shader", "highp"); context->error((yylsp[(1) - (4)]), "precision is not supported in fragment shader", "highp");
context->recover(); context->recover();
} }
...@@ -3796,7 +3795,7 @@ yyreduce: ...@@ -3796,7 +3795,7 @@ yyreduce:
ES2_ONLY("varying", (yylsp[(1) - (1)])); ES2_ONLY("varying", (yylsp[(1) - (1)]));
if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "varying")) if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "varying"))
context->recover(); context->recover();
if (context->shaderType == GL_VERTEX_SHADER) if (context->shaderType == SH_VERTEX_SHADER)
(yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[(1) - (1)])); (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[(1) - (1)]));
else else
(yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[(1) - (1)])); (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[(1) - (1)]));
...@@ -3809,7 +3808,7 @@ yyreduce: ...@@ -3809,7 +3808,7 @@ yyreduce:
ES2_ONLY("varying", (yylsp[(1) - (2)])); ES2_ONLY("varying", (yylsp[(1) - (2)]));
if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying")) if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover(); context->recover();
if (context->shaderType == GL_VERTEX_SHADER) if (context->shaderType == SH_VERTEX_SHADER)
(yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[(1) - (2)])); (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[(1) - (2)]));
else else
(yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[(1) - (2)])); (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[(1) - (2)]));
...@@ -3873,7 +3872,7 @@ yyreduce: ...@@ -3873,7 +3872,7 @@ yyreduce:
{ {
ES3_ONLY("in", (yylsp[(1) - (1)]), "storage qualifier"); ES3_ONLY("in", (yylsp[(1) - (1)]), "storage qualifier");
(yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn; (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
} }
break; break;
...@@ -3881,7 +3880,7 @@ yyreduce: ...@@ -3881,7 +3880,7 @@ yyreduce:
{ {
ES3_ONLY("out", (yylsp[(1) - (1)]), "storage qualifier"); ES3_ONLY("out", (yylsp[(1) - (1)]), "storage qualifier");
(yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut; (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
} }
break; break;
...@@ -3889,12 +3888,12 @@ yyreduce: ...@@ -3889,12 +3888,12 @@ yyreduce:
{ {
ES3_ONLY("centroid in", (yylsp[(1) - (2)]), "storage qualifier"); ES3_ONLY("centroid in", (yylsp[(1) - (2)]), "storage qualifier");
if (context->shaderType == GL_VERTEX_SHADER) if (context->shaderType == SH_VERTEX_SHADER)
{ {
context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader"); context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
context->recover(); context->recover();
} }
(yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn; (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
} }
break; break;
...@@ -3902,12 +3901,12 @@ yyreduce: ...@@ -3902,12 +3901,12 @@ yyreduce:
{ {
ES3_ONLY("centroid out", (yylsp[(1) - (2)]), "storage qualifier"); ES3_ONLY("centroid out", (yylsp[(1) - (2)]), "storage qualifier");
if (context->shaderType == GL_FRAGMENT_SHADER) if (context->shaderType == SH_FRAGMENT_SHADER)
{ {
context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader"); context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
context->recover(); context->recover();
} }
(yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut; (yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
} }
break; break;
......
...@@ -206,8 +206,8 @@ void Shader::initializeCompiler() ...@@ -206,8 +206,8 @@ void Shader::initializeCompiler()
resources.MinProgramTexelOffset = -8; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE resources.MinProgramTexelOffset = -8; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE
resources.MaxProgramTexelOffset = 7; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE resources.MaxProgramTexelOffset = 7; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE
mFragmentCompiler = ShConstructCompiler(GL_FRAGMENT_SHADER, SH_GLES2_SPEC, hlslVersion, &resources); mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
mVertexCompiler = ShConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC, hlslVersion, &resources); mVertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
} }
} }
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <vector> #include <vector>
#include "GLSLANG/ShaderLang.h" #include "GLSLANG/ShaderLang.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "angle_gl.h"
#define SHADER(Src) #Src #define SHADER(Src) #Src
...@@ -180,7 +179,7 @@ TEST_F(ExpressionLimitTest, ExpressionComplexity) ...@@ -180,7 +179,7 @@ TEST_F(ExpressionLimitTest, ExpressionComplexity)
ShShaderSpec spec = SH_WEBGL_SPEC; ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT; ShShaderOutput output = SH_ESSL_OUTPUT;
ShHandle vertexCompiler = ShConstructCompiler( ShHandle vertexCompiler = ShConstructCompiler(
GL_FRAGMENT_SHADER, spec, output, &resources); SH_FRAGMENT_SHADER, spec, output, &resources);
int compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY; int compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
// Test expression under the limit passes. // Test expression under the limit passes.
...@@ -208,7 +207,7 @@ TEST_F(ExpressionLimitTest, UnusedExpressionComplexity) ...@@ -208,7 +207,7 @@ TEST_F(ExpressionLimitTest, UnusedExpressionComplexity)
ShShaderSpec spec = SH_WEBGL_SPEC; ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT; ShShaderOutput output = SH_ESSL_OUTPUT;
ShHandle vertexCompiler = ShConstructCompiler( ShHandle vertexCompiler = ShConstructCompiler(
GL_FRAGMENT_SHADER, spec, output, &resources); SH_FRAGMENT_SHADER, spec, output, &resources);
int compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY; int compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
// Test expression under the limit passes. // Test expression under the limit passes.
...@@ -236,7 +235,7 @@ TEST_F(ExpressionLimitTest, CallStackDepth) ...@@ -236,7 +235,7 @@ TEST_F(ExpressionLimitTest, CallStackDepth)
ShShaderSpec spec = SH_WEBGL_SPEC; ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT; ShShaderOutput output = SH_ESSL_OUTPUT;
ShHandle vertexCompiler = ShConstructCompiler( ShHandle vertexCompiler = ShConstructCompiler(
GL_FRAGMENT_SHADER, spec, output, &resources); SH_FRAGMENT_SHADER, spec, output, &resources);
int compileOptions = SH_LIMIT_CALL_STACK_DEPTH; int compileOptions = SH_LIMIT_CALL_STACK_DEPTH;
// Test call stack under the limit passes. // Test call stack under the limit passes.
...@@ -264,7 +263,7 @@ TEST_F(ExpressionLimitTest, UnusedCallStackDepth) ...@@ -264,7 +263,7 @@ TEST_F(ExpressionLimitTest, UnusedCallStackDepth)
ShShaderSpec spec = SH_WEBGL_SPEC; ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT; ShShaderOutput output = SH_ESSL_OUTPUT;
ShHandle vertexCompiler = ShConstructCompiler( ShHandle vertexCompiler = ShConstructCompiler(
GL_FRAGMENT_SHADER, spec, output, &resources); SH_FRAGMENT_SHADER, spec, output, &resources);
int compileOptions = SH_LIMIT_CALL_STACK_DEPTH; int compileOptions = SH_LIMIT_CALL_STACK_DEPTH;
// Test call stack under the limit passes. // Test call stack under the limit passes.
...@@ -292,7 +291,7 @@ TEST_F(ExpressionLimitTest, Recursion) ...@@ -292,7 +291,7 @@ TEST_F(ExpressionLimitTest, Recursion)
ShShaderSpec spec = SH_WEBGL_SPEC; ShShaderSpec spec = SH_WEBGL_SPEC;
ShShaderOutput output = SH_ESSL_OUTPUT; ShShaderOutput output = SH_ESSL_OUTPUT;
ShHandle vertexCompiler = ShConstructCompiler( ShHandle vertexCompiler = ShConstructCompiler(
GL_FRAGMENT_SHADER, spec, output, &resources); SH_FRAGMENT_SHADER, spec, output, &resources);
int compileOptions = 0; int compileOptions = 0;
static const char* shaderWithRecursion0 = SHADER( static const char* shaderWithRecursion0 = SHADER(
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
// //
#include "compiler/translator/VariablePacker.h" #include "compiler/translator/VariablePacker.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "angle_gl.h"
TEST(VariablePacking, Pack) { TEST(VariablePacking, Pack) {
VariablePacker packer; VariablePacker packer;
...@@ -14,30 +13,30 @@ TEST(VariablePacking, Pack) { ...@@ -14,30 +13,30 @@ TEST(VariablePacking, Pack) {
// test no vars. // test no vars.
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars)); EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
sh::GLenum types[] = { ShDataType types[] = {
GL_FLOAT_MAT4, // 0 SH_FLOAT_MAT4, // 0
GL_FLOAT_MAT2, // 1 SH_FLOAT_MAT2, // 1
GL_FLOAT_VEC4, // 2 SH_FLOAT_VEC4, // 2
GL_INT_VEC4, // 3 SH_INT_VEC4, // 3
GL_BOOL_VEC4, // 4 SH_BOOL_VEC4, // 4
GL_FLOAT_MAT3, // 5 SH_FLOAT_MAT3, // 5
GL_FLOAT_VEC3, // 6 SH_FLOAT_VEC3, // 6
GL_INT_VEC3, // 7 SH_INT_VEC3, // 7
GL_BOOL_VEC3, // 8 SH_BOOL_VEC3, // 8
GL_FLOAT_VEC2, // 9 SH_FLOAT_VEC2, // 9
GL_INT_VEC2, // 10 SH_INT_VEC2, // 10
GL_BOOL_VEC2, // 11 SH_BOOL_VEC2, // 11
GL_FLOAT, // 12 SH_FLOAT, // 12
GL_INT, // 13 SH_INT, // 13
GL_BOOL, // 14 SH_BOOL, // 14
GL_SAMPLER_2D, // 15 SH_SAMPLER_2D, // 15
GL_SAMPLER_CUBE, // 16 SH_SAMPLER_CUBE, // 16
GL_SAMPLER_EXTERNAL_OES, // 17 SH_SAMPLER_EXTERNAL_OES, // 17
GL_SAMPLER_2D_RECT_ARB, // 18 SH_SAMPLER_2D_RECT_ARB, // 18
}; };
for (size_t tt = 0; tt < sizeof(types) / sizeof(types[0]); ++tt) { for (size_t tt = 0; tt < sizeof(types) / sizeof(types[0]); ++tt) {
sh::GLenum type = types[tt]; ShDataType type = types[tt];
int num_rows = VariablePacker::GetNumRows(type); int num_rows = VariablePacker::GetNumRows(type);
int num_components_per_row = VariablePacker::GetNumComponentsPerRow(type); int num_components_per_row = VariablePacker::GetNumComponentsPerRow(type);
// Check 1 of the type. // Check 1 of the type.
...@@ -72,15 +71,15 @@ TEST(VariablePacking, Pack) { ...@@ -72,15 +71,15 @@ TEST(VariablePacking, Pack) {
// Test example from GLSL ES 3.0 spec chapter 11. // Test example from GLSL ES 3.0 spec chapter 11.
vars.clear(); vars.clear();
vars.push_back(TVariableInfo(GL_FLOAT_VEC4, 1)); vars.push_back(TVariableInfo(SH_FLOAT_VEC4, 1));
vars.push_back(TVariableInfo(GL_FLOAT_MAT3, 1)); vars.push_back(TVariableInfo(SH_FLOAT_MAT3, 1));
vars.push_back(TVariableInfo(GL_FLOAT_MAT3, 1)); vars.push_back(TVariableInfo(SH_FLOAT_MAT3, 1));
vars.push_back(TVariableInfo(GL_FLOAT_VEC2, 6)); vars.push_back(TVariableInfo(SH_FLOAT_VEC2, 6));
vars.push_back(TVariableInfo(GL_FLOAT_VEC2, 4)); vars.push_back(TVariableInfo(SH_FLOAT_VEC2, 4));
vars.push_back(TVariableInfo(GL_FLOAT_VEC2, 1)); vars.push_back(TVariableInfo(SH_FLOAT_VEC2, 1));
vars.push_back(TVariableInfo(GL_FLOAT, 3)); vars.push_back(TVariableInfo(SH_FLOAT, 3));
vars.push_back(TVariableInfo(GL_FLOAT, 2)); vars.push_back(TVariableInfo(SH_FLOAT, 2));
vars.push_back(TVariableInfo(GL_FLOAT, 1)); vars.push_back(TVariableInfo(SH_FLOAT, 1));
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars)); EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment