зеркало из https://github.com/AvaloniaUI/angle.git
Revert "Return variable type queries using GLenum values."
Breaks the FYI bots until we get Chromium patched.
BUG=angle:466
This reverts commit 53221f5a03
.
Change-Id: Ib28548df5c10a6f76f46e4cf8f2013dca5cf0ee2
Reviewed-on: https://chromium-review.googlesource.com/205850
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
53221f5a03
Коммит
ce50555375
|
@ -31,19 +31,24 @@
|
|||
// and the shading language compiler.
|
||||
//
|
||||
|
||||
namespace sh
|
||||
{
|
||||
// GLenum alias
|
||||
typedef unsigned int GLenum;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Version number for shader translation API.
|
||||
// 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 {
|
||||
SH_GLES2_SPEC = 0x8B40,
|
||||
|
@ -80,6 +85,52 @@ typedef enum {
|
|||
SH_HLSL11_OUTPUT = 0x8B48
|
||||
} ShShaderOutput;
|
||||
|
||||
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_MEDIUMP = 0x5002,
|
||||
|
@ -142,7 +193,7 @@ typedef enum {
|
|||
// This flag only has an effect if all of the following are true:
|
||||
// - The shader spec is SH_WEBGL_SPEC.
|
||||
// - 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,
|
||||
|
||||
// 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
|
|||
// Returns the handle of constructed compiler, null if the requested compiler is
|
||||
// not supported.
|
||||
// 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 -
|
||||
// SH_GLES2_SPEC or SH_WEBGL_SPEC.
|
||||
// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
|
||||
// SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT.
|
||||
// resources: Specifies the built-in resources.
|
||||
COMPILER_EXPORT ShHandle ShConstructCompiler(
|
||||
sh::GLenum type,
|
||||
ShShaderType type,
|
||||
ShShaderSpec spec,
|
||||
ShShaderOutput output,
|
||||
const ShBuiltInResources* resources);
|
||||
|
@ -425,7 +476,7 @@ COMPILER_EXPORT void ShGetVariableInfo(const ShHandle handle,
|
|||
int index,
|
||||
size_t* length,
|
||||
int* size,
|
||||
sh::GLenum* type,
|
||||
ShDataType* type,
|
||||
ShPrecisionType* precision,
|
||||
int* staticUse,
|
||||
char* name,
|
||||
|
@ -463,7 +514,7 @@ COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle,
|
|||
|
||||
typedef struct
|
||||
{
|
||||
sh::GLenum type;
|
||||
ShDataType type;
|
||||
int size;
|
||||
} ShVariableInfo;
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include "angle_gl.h"
|
||||
|
||||
//
|
||||
// Return codes from main.
|
||||
|
@ -25,7 +24,7 @@ enum TFailCode {
|
|||
};
|
||||
|
||||
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 void LogMsg(const char* msg, const char* name, const int num, const char* logName);
|
||||
static void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType);
|
||||
|
@ -138,16 +137,16 @@ int main(int argc, char* argv[])
|
|||
} else {
|
||||
ShHandle compiler = 0;
|
||||
switch (FindShaderType(argv[0])) {
|
||||
case GL_VERTEX_SHADER:
|
||||
case SH_VERTEX_SHADER:
|
||||
if (vertexCompiler == 0)
|
||||
vertexCompiler = ShConstructCompiler(
|
||||
GL_VERTEX_SHADER, spec, output, &resources);
|
||||
SH_VERTEX_SHADER, spec, output, &resources);
|
||||
compiler = vertexCompiler;
|
||||
break;
|
||||
case GL_FRAGMENT_SHADER:
|
||||
case SH_FRAGMENT_SHADER:
|
||||
if (fragmentCompiler == 0)
|
||||
fragmentCompiler = ShConstructCompiler(
|
||||
GL_FRAGMENT_SHADER, spec, output, &resources);
|
||||
SH_FRAGMENT_SHADER, spec, output, &resources);
|
||||
compiler = fragmentCompiler;
|
||||
break;
|
||||
default: break;
|
||||
|
@ -243,7 +242,7 @@ void usage()
|
|||
// .frag* = fragment shader
|
||||
// .vert* = vertex shader
|
||||
//
|
||||
sh::GLenum FindShaderType(const char* fileName)
|
||||
ShShaderType FindShaderType(const char* fileName)
|
||||
{
|
||||
assert(fileName);
|
||||
|
||||
|
@ -254,11 +253,11 @@ sh::GLenum FindShaderType(const char* fileName)
|
|||
|
||||
ext = strrchr(fileName, '.');
|
||||
if (ext) {
|
||||
if (strncmp(ext, ".frag", 4) == 0) return GL_FRAGMENT_SHADER;
|
||||
if (strncmp(ext, ".vert", 4) == 0) return GL_VERTEX_SHADER;
|
||||
if (strncmp(ext, ".frag", 4) == 0) return SH_FRAGMENT_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)
|
|||
|
||||
size_t activeVars = 0;
|
||||
int size = 0;
|
||||
sh::GLenum type = GL_NONE;
|
||||
ShDataType type = SH_NONE;
|
||||
ShPrecisionType precision = SH_PRECISION_UNDEFINED;
|
||||
int staticUse = 0;
|
||||
const char* typeName = NULL;
|
||||
|
@ -314,34 +313,34 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType)
|
|||
default: assert(0);
|
||||
}
|
||||
switch (type) {
|
||||
case GL_FLOAT: typeName = "GL_FLOAT"; break;
|
||||
case GL_FLOAT_VEC2: typeName = "GL_FLOAT_VEC2"; break;
|
||||
case GL_FLOAT_VEC3: typeName = "GL_FLOAT_VEC3"; break;
|
||||
case GL_FLOAT_VEC4: typeName = "GL_FLOAT_VEC4"; break;
|
||||
case GL_INT: typeName = "GL_INT"; break;
|
||||
case GL_INT_VEC2: typeName = "GL_INT_VEC2"; break;
|
||||
case GL_INT_VEC3: typeName = "GL_INT_VEC3"; break;
|
||||
case GL_INT_VEC4: typeName = "GL_INT_VEC4"; break;
|
||||
case GL_UNSIGNED_INT: typeName = "GL_UNSIGNED_INT"; break;
|
||||
case GL_UNSIGNED_INT_VEC2: typeName = "GL_UNSIGNED_INT_VEC2"; break;
|
||||
case GL_UNSIGNED_INT_VEC3: typeName = "GL_UNSIGNED_INT_VEC3"; break;
|
||||
case GL_UNSIGNED_INT_VEC4: typeName = "GL_UNSIGNED_INT_VEC4"; break;
|
||||
case GL_BOOL: typeName = "GL_BOOL"; break;
|
||||
case GL_BOOL_VEC2: typeName = "GL_BOOL_VEC2"; break;
|
||||
case GL_BOOL_VEC3: typeName = "GL_BOOL_VEC3"; break;
|
||||
case GL_BOOL_VEC4: typeName = "GL_BOOL_VEC4"; break;
|
||||
case GL_FLOAT_MAT2: typeName = "GL_FLOAT_MAT2"; break;
|
||||
case GL_FLOAT_MAT3: typeName = "GL_FLOAT_MAT3"; break;
|
||||
case GL_FLOAT_MAT4: typeName = "GL_FLOAT_MAT4"; break;
|
||||
case GL_FLOAT_MAT2x3: typeName = "GL_FLOAT_MAT2x3"; break;
|
||||
case GL_FLOAT_MAT3x2: typeName = "GL_FLOAT_MAT3x2"; break;
|
||||
case GL_FLOAT_MAT4x2: typeName = "GL_FLOAT_MAT4x2"; break;
|
||||
case GL_FLOAT_MAT2x4: typeName = "GL_FLOAT_MAT2x4"; break;
|
||||
case GL_FLOAT_MAT3x4: typeName = "GL_FLOAT_MAT3x4"; break;
|
||||
case GL_FLOAT_MAT4x3: typeName = "GL_FLOAT_MAT4x3"; break;
|
||||
case GL_SAMPLER_2D: typeName = "GL_SAMPLER_2D"; break;
|
||||
case GL_SAMPLER_CUBE: typeName = "GL_SAMPLER_CUBE"; break;
|
||||
case GL_SAMPLER_EXTERNAL_OES: typeName = "GL_SAMPLER_EXTERNAL_OES"; break;
|
||||
case SH_FLOAT: typeName = "GL_FLOAT"; break;
|
||||
case SH_FLOAT_VEC2: typeName = "GL_FLOAT_VEC2"; break;
|
||||
case SH_FLOAT_VEC3: typeName = "GL_FLOAT_VEC3"; break;
|
||||
case SH_FLOAT_VEC4: typeName = "GL_FLOAT_VEC4"; break;
|
||||
case SH_INT: typeName = "GL_INT"; break;
|
||||
case SH_INT_VEC2: typeName = "GL_INT_VEC2"; break;
|
||||
case SH_INT_VEC3: typeName = "GL_INT_VEC3"; break;
|
||||
case SH_INT_VEC4: typeName = "GL_INT_VEC4"; break;
|
||||
case SH_UNSIGNED_INT: typeName = "GL_UNSIGNED_INT"; break;
|
||||
case SH_UNSIGNED_INT_VEC2: typeName = "GL_UNSIGNED_INT_VEC2"; break;
|
||||
case SH_UNSIGNED_INT_VEC3: typeName = "GL_UNSIGNED_INT_VEC3"; break;
|
||||
case SH_UNSIGNED_INT_VEC4: typeName = "GL_UNSIGNED_INT_VEC4"; break;
|
||||
case SH_BOOL: typeName = "GL_BOOL"; break;
|
||||
case SH_BOOL_VEC2: typeName = "GL_BOOL_VEC2"; break;
|
||||
case SH_BOOL_VEC3: typeName = "GL_BOOL_VEC3"; break;
|
||||
case SH_BOOL_VEC4: typeName = "GL_BOOL_VEC4"; break;
|
||||
case SH_FLOAT_MAT2: typeName = "GL_FLOAT_MAT2"; break;
|
||||
case SH_FLOAT_MAT3: typeName = "GL_FLOAT_MAT3"; break;
|
||||
case SH_FLOAT_MAT4: typeName = "GL_FLOAT_MAT4"; break;
|
||||
case SH_FLOAT_MAT2x3: typeName = "GL_FLOAT_MAT2x3"; break;
|
||||
case SH_FLOAT_MAT3x2: typeName = "GL_FLOAT_MAT3x2"; break;
|
||||
case SH_FLOAT_MAT4x2: typeName = "GL_FLOAT_MAT4x2"; break;
|
||||
case SH_FLOAT_MAT2x4: typeName = "GL_FLOAT_MAT2x4"; break;
|
||||
case SH_FLOAT_MAT3x4: typeName = "GL_FLOAT_MAT3x4"; break;
|
||||
case SH_FLOAT_MAT4x3: typeName = "GL_FLOAT_MAT4x3"; break;
|
||||
case SH_SAMPLER_2D: typeName = "GL_SAMPLER_2D"; break;
|
||||
case SH_SAMPLER_CUBE: typeName = "GL_SAMPLER_CUBE"; break;
|
||||
case SH_SAMPLER_EXTERNAL_OES: typeName = "GL_SAMPLER_EXTERNAL_OES"; break;
|
||||
default: assert(0);
|
||||
}
|
||||
printf("%lu: name:%s type:%s size:%d\n", i, name, typeName, size);
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
namespace sh
|
||||
{
|
||||
|
||||
// GLenum alias
|
||||
typedef unsigned int GLenum;
|
||||
|
||||
// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
|
||||
enum InterpolationType
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "compiler/translator/BuiltInFunctionEmulator.h"
|
||||
|
||||
#include "compiler/translator/SymbolTable.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -266,9 +265,9 @@ private:
|
|||
|
||||
} // anonymous namepsace
|
||||
|
||||
BuiltInFunctionEmulator::BuiltInFunctionEmulator(sh::GLenum shaderType)
|
||||
BuiltInFunctionEmulator::BuiltInFunctionEmulator(ShShaderType shaderType)
|
||||
{
|
||||
if (shaderType == GL_FRAGMENT_SHADER) {
|
||||
if (shaderType == SH_FRAGMENT_SHADER) {
|
||||
mFunctionMask = kFunctionEmulationFragmentMask;
|
||||
mFunctionSource = kFunctionEmulationFragmentSource;
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
//
|
||||
class BuiltInFunctionEmulator {
|
||||
public:
|
||||
BuiltInFunctionEmulator(sh::GLenum shaderType);
|
||||
BuiltInFunctionEmulator(ShShaderType 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.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// a subclass of TCompiler.
|
||||
//
|
||||
TCompiler* ConstructCompiler(
|
||||
sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
|
||||
ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
|
||||
{
|
||||
switch (output) {
|
||||
case SH_ESSL_OUTPUT:
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#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)
|
||||
{
|
||||
|
@ -93,7 +92,7 @@ TShHandleBase::~TShHandleBase()
|
|||
allocator.popAll();
|
||||
}
|
||||
|
||||
TCompiler::TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
|
||||
TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
|
||||
: shaderType(type),
|
||||
shaderSpec(spec),
|
||||
outputType(output),
|
||||
|
@ -113,7 +112,7 @@ TCompiler::~TCompiler()
|
|||
bool TCompiler::Init(const ShBuiltInResources& resources)
|
||||
{
|
||||
shaderVersion = 100;
|
||||
maxUniformVectors = (shaderType == GL_VERTEX_SHADER) ?
|
||||
maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
|
||||
resources.MaxVertexUniformVectors :
|
||||
resources.MaxFragmentUniformVectors;
|
||||
maxExpressionComplexity = resources.MaxExpressionComplexity;
|
||||
|
@ -188,7 +187,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
|||
if (success)
|
||||
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);
|
||||
|
||||
if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
|
||||
|
@ -226,7 +225,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
|||
if (success && (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
|
||||
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);
|
||||
|
||||
if (success && (compileOptions & SH_UNFOLD_SHORT_CIRCUIT))
|
||||
|
@ -248,7 +247,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
|
|||
infoSink.info << "too many uniforms";
|
||||
}
|
||||
}
|
||||
if (success && shaderType == GL_VERTEX_SHADER &&
|
||||
if (success && shaderType == SH_VERTEX_SHADER &&
|
||||
(compileOptions & SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
|
||||
initializeVaryingsWithoutStaticUse(root);
|
||||
}
|
||||
|
@ -295,10 +294,10 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
|
|||
|
||||
switch(shaderType)
|
||||
{
|
||||
case GL_FRAGMENT_SHADER:
|
||||
case SH_FRAGMENT_SHADER:
|
||||
symbolTable.setDefaultPrecision(integer, EbpMedium);
|
||||
break;
|
||||
case GL_VERTEX_SHADER:
|
||||
case SH_VERTEX_SHADER:
|
||||
symbolTable.setDefaultPrecision(integer, EbpHigh);
|
||||
symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
|
||||
break;
|
||||
|
@ -419,7 +418,7 @@ bool TCompiler::enforceTimingRestrictions(TIntermNode* root, bool outputGraph)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (shaderType == GL_FRAGMENT_SHADER)
|
||||
if (shaderType == SH_FRAGMENT_SHADER)
|
||||
{
|
||||
TDependencyGraph graph(root);
|
||||
|
||||
|
@ -513,26 +512,26 @@ void TCompiler::initializeVaryingsWithoutStaticUse(TIntermNode* root)
|
|||
unsigned char primarySize = 1, secondarySize = 1;
|
||||
switch (varying.type)
|
||||
{
|
||||
case GL_FLOAT:
|
||||
case SH_FLOAT:
|
||||
break;
|
||||
case GL_FLOAT_VEC2:
|
||||
case SH_FLOAT_VEC2:
|
||||
primarySize = 2;
|
||||
break;
|
||||
case GL_FLOAT_VEC3:
|
||||
case SH_FLOAT_VEC3:
|
||||
primarySize = 3;
|
||||
break;
|
||||
case GL_FLOAT_VEC4:
|
||||
case SH_FLOAT_VEC4:
|
||||
primarySize = 4;
|
||||
break;
|
||||
case GL_FLOAT_MAT2:
|
||||
case SH_FLOAT_MAT2:
|
||||
primarySize = 2;
|
||||
secondarySize = 2;
|
||||
break;
|
||||
case GL_FLOAT_MAT3:
|
||||
case SH_FLOAT_MAT3:
|
||||
primarySize = 3;
|
||||
secondarySize = 3;
|
||||
break;
|
||||
case GL_FLOAT_MAT4:
|
||||
case SH_FLOAT_MAT4:
|
||||
primarySize = 4;
|
||||
secondarySize = 4;
|
||||
break;
|
||||
|
|
|
@ -54,7 +54,7 @@ protected:
|
|||
//
|
||||
class TCompiler : public TShHandleBase {
|
||||
public:
|
||||
TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
|
||||
TCompiler(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
|
||||
virtual ~TCompiler();
|
||||
virtual TCompiler* getAsCompiler() { return this; }
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
std::string getBuiltInResourcesString() const { return builtInResourcesString; }
|
||||
|
||||
protected:
|
||||
sh::GLenum getShaderType() const { return shaderType; }
|
||||
ShShaderType 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 @@ protected:
|
|||
const BuiltInFunctionEmulator& getBuiltInFunctionEmulator() const;
|
||||
|
||||
private:
|
||||
sh::GLenum shaderType;
|
||||
ShShaderType shaderType;
|
||||
ShShaderSpec shaderSpec;
|
||||
ShShaderOutput outputType;
|
||||
|
||||
|
@ -174,7 +174,7 @@ private:
|
|||
// above machine independent information.
|
||||
//
|
||||
TCompiler* ConstructCompiler(
|
||||
sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
|
||||
ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
|
||||
void DeleteCompiler(TCompiler*);
|
||||
|
||||
#endif // _SHHANDLE_INCLUDED_
|
||||
|
|
|
@ -13,9 +13,8 @@
|
|||
#include "compiler/translator/Initialize.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 *float2 = new TType(EbtFloat, 2);
|
||||
|
@ -363,7 +362,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
|
|||
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, "texture2DProj", sampler2D, float3, float1);
|
||||
|
@ -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, "texture2DProjLod", sampler2D, float3, float1);
|
||||
|
@ -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", 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", gsampler3D, float3, float1);
|
||||
|
@ -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, "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", samplerCubeShadow, float4, float1);
|
||||
|
@ -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, 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, float2, "dFdx", float2);
|
||||
|
@ -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, 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", gsampler3D, float3, int3, float1);
|
||||
|
@ -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, 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, float4, int2, float1);
|
||||
|
@ -595,7 +594,7 @@ void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInR
|
|||
symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", resources.MaxProgramTexelOffset);
|
||||
}
|
||||
|
||||
void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
|
||||
void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
|
||||
const ShBuiltInResources &resources,
|
||||
TSymbolTable &symbolTable)
|
||||
{
|
||||
|
@ -604,7 +603,7 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
|
|||
// the built-in header files.
|
||||
//
|
||||
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_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
|
||||
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,
|
|||
|
||||
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_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
|
||||
break;
|
||||
|
@ -695,9 +694,9 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
|
|||
|
||||
// Map language-specific operators.
|
||||
switch(type) {
|
||||
case GL_VERTEX_SHADER:
|
||||
case SH_VERTEX_SHADER:
|
||||
break;
|
||||
case GL_FRAGMENT_SHADER:
|
||||
case SH_FRAGMENT_SHADER:
|
||||
if (resources.OES_standard_derivatives)
|
||||
{
|
||||
symbolTable.relateToOperator(ESSL1_BUILTINS, "dFdx", EOpDFdx);
|
||||
|
@ -731,7 +730,7 @@ void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
|
|||
|
||||
// Finally add resource-specific variables.
|
||||
switch(type) {
|
||||
case GL_FRAGMENT_SHADER:
|
||||
case SH_FRAGMENT_SHADER:
|
||||
if (spec != SH_CSS_SHADERS_SPEC) {
|
||||
// Set up gl_FragData. The array size.
|
||||
TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#include "compiler/translator/Compiler.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,
|
||||
TSymbolTable& symbolTable);
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ OutputHLSL::OutputHLSL(TParseContext &context, const ShBuiltInResources& resourc
|
|||
|
||||
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
|
||||
mUniformHLSL->reserveUniformRegisters(3);
|
||||
|
@ -167,13 +167,13 @@ OutputHLSL::~OutputHLSL()
|
|||
|
||||
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);
|
||||
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 == GL_VERTEX_SHADER)
|
||||
if (mOutputType == SH_HLSL9_OUTPUT && mContext.shaderType == SH_VERTEX_SHADER)
|
||||
{
|
||||
RewriteElseBlocks(mContext.treeRoot);
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ void OutputHLSL::header()
|
|||
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");
|
||||
const bool usingMRTExtension = (iter != mContext.extensionBehavior().end() && (iter->second == EBhEnable || iter->second == EBhRequire));
|
||||
|
@ -2147,7 +2147,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ struct TMatrixFields {
|
|||
// they can be passed to the parser without needing a global.
|
||||
//
|
||||
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),
|
||||
symbolTable(symt),
|
||||
shaderType(type),
|
||||
|
@ -47,7 +47,7 @@ struct TParseContext {
|
|||
scanner(NULL) { }
|
||||
TIntermediate& intermediate; // to hold and build a parse tree
|
||||
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.
|
||||
int shaderVersion;
|
||||
int compileOptions;
|
||||
|
|
|
@ -115,7 +115,7 @@ void ShInitBuiltInResources(ShBuiltInResources* resources)
|
|||
//
|
||||
// Driver calls these to create and destroy compiler objects.
|
||||
//
|
||||
ShHandle ShConstructCompiler(sh::GLenum type, ShShaderSpec spec,
|
||||
ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
|
||||
ShShaderOutput output,
|
||||
const ShBuiltInResources* resources)
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ void ShGetVariableInfo(const ShHandle handle,
|
|||
int index,
|
||||
size_t* length,
|
||||
int* size,
|
||||
sh::GLenum* type,
|
||||
ShDataType* type,
|
||||
ShPrecisionType* precision,
|
||||
int* staticUse,
|
||||
char* name,
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
#include "compiler/translator/TranslatorESSL.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) {
|
||||
}
|
||||
|
||||
|
@ -21,7 +20,7 @@ void TranslatorESSL::translate(TIntermNode* root) {
|
|||
|
||||
// Write emulated built-in functions if needed.
|
||||
getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
|
||||
sink, getShaderType() == GL_FRAGMENT_SHADER);
|
||||
sink, getShaderType() == SH_FRAGMENT_SHADER);
|
||||
|
||||
// Write array bounds clamping emulation if needed.
|
||||
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
class TranslatorESSL : public TCompiler {
|
||||
public:
|
||||
TranslatorESSL(sh::GLenum type, ShShaderSpec spec);
|
||||
TranslatorESSL(ShShaderType type, ShShaderSpec spec);
|
||||
|
||||
protected:
|
||||
virtual void translate(TIntermNode* root);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "compiler/translator/OutputGLSL.h"
|
||||
#include "compiler/translator/VersionGLSL.h"
|
||||
|
||||
static void writeVersion(sh::GLenum type, TIntermNode* root,
|
||||
static void writeVersion(ShShaderType type, TIntermNode* root,
|
||||
TInfoSinkBase& sink) {
|
||||
TVersionGLSL versionGLSL(type);
|
||||
root->traverse(&versionGLSL);
|
||||
|
@ -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) {
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
class TranslatorGLSL : public TCompiler {
|
||||
public:
|
||||
TranslatorGLSL(sh::GLenum type, ShShaderSpec spec);
|
||||
TranslatorGLSL(ShShaderType type, ShShaderSpec spec);
|
||||
|
||||
protected:
|
||||
virtual void translate(TIntermNode* root);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "compiler/translator/InitializeParseContext.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)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
class TranslatorHLSL : public TCompiler {
|
||||
public:
|
||||
TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
|
||||
TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
|
||||
|
||||
virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
|
||||
const std::vector<sh::Uniform> &getUniforms() { return mActiveUniforms; }
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "compiler/translator/InfoSink.h"
|
||||
#include "compiler/translator/InitializeParseContext.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -49,7 +48,7 @@ class ValidateConstIndexExpr : public TIntermTraverser
|
|||
|
||||
} // namespace anonymous
|
||||
|
||||
ValidateLimitations::ValidateLimitations(sh::GLenum shaderType,
|
||||
ValidateLimitations::ValidateLimitations(ShShaderType shaderType,
|
||||
TInfoSinkBase &sink)
|
||||
: mShaderType(shaderType),
|
||||
mSink(sink),
|
||||
|
@ -458,7 +457,7 @@ bool ValidateLimitations::validateIndexing(TIntermBinary *node)
|
|||
// 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 == GL_VERTEX_SHADER) &&
|
||||
bool skip = (mShaderType == SH_VERTEX_SHADER) &&
|
||||
(operand->getQualifier() == EvqUniform);
|
||||
if (!skip && !isConstIndexExpr(index))
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ class TInfoSinkBase;
|
|||
class ValidateLimitations : public TIntermTraverser
|
||||
{
|
||||
public:
|
||||
ValidateLimitations(sh::GLenum shaderType, TInfoSinkBase &sink);
|
||||
ValidateLimitations(ShShaderType shaderType, TInfoSinkBase &sink);
|
||||
|
||||
int numErrors() const { return mNumErrors; }
|
||||
|
||||
|
@ -47,7 +47,7 @@ class ValidateLimitations : public TIntermTraverser
|
|||
bool isConstIndexExpr(TIntermNode *node);
|
||||
bool validateIndexing(TIntermBinary *node);
|
||||
|
||||
sh::GLenum mShaderType;
|
||||
ShShaderType mShaderType;
|
||||
TInfoSinkBase &mSink;
|
||||
int mNumErrors;
|
||||
TLoopStack mLoopStack;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
//
|
||||
|
||||
#include "compiler/translator/VariableInfo.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -17,7 +16,7 @@ TString arrayBrackets(int index)
|
|||
}
|
||||
|
||||
// Returns the data type for an attribute, uniform, or varying.
|
||||
sh::GLenum getVariableDataType(const TType& type)
|
||||
ShDataType getVariableDataType(const TType& type)
|
||||
{
|
||||
switch (type.getBasicType()) {
|
||||
case EbtFloat:
|
||||
|
@ -27,97 +26,97 @@ sh::GLenum getVariableDataType(const TType& type)
|
|||
case 2:
|
||||
switch (type.getRows())
|
||||
{
|
||||
case 2: return GL_FLOAT_MAT2;
|
||||
case 3: return GL_FLOAT_MAT2x3;
|
||||
case 4: return GL_FLOAT_MAT2x4;
|
||||
case 2: return SH_FLOAT_MAT2;
|
||||
case 3: return SH_FLOAT_MAT2x3;
|
||||
case 4: return SH_FLOAT_MAT2x4;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
case 3:
|
||||
switch (type.getRows())
|
||||
{
|
||||
case 2: return GL_FLOAT_MAT3x2;
|
||||
case 3: return GL_FLOAT_MAT3;
|
||||
case 4: return GL_FLOAT_MAT3x4;
|
||||
case 2: return SH_FLOAT_MAT3x2;
|
||||
case 3: return SH_FLOAT_MAT3;
|
||||
case 4: return SH_FLOAT_MAT3x4;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
case 4:
|
||||
switch (type.getRows())
|
||||
{
|
||||
case 2: return GL_FLOAT_MAT4x2;
|
||||
case 3: return GL_FLOAT_MAT4x3;
|
||||
case 4: return GL_FLOAT_MAT4;
|
||||
case 2: return SH_FLOAT_MAT4x2;
|
||||
case 3: return SH_FLOAT_MAT4x3;
|
||||
case 4: return SH_FLOAT_MAT4;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
}
|
||||
} else if (type.isVector()) {
|
||||
switch (type.getNominalSize()) {
|
||||
case 2: return GL_FLOAT_VEC2;
|
||||
case 3: return GL_FLOAT_VEC3;
|
||||
case 4: return GL_FLOAT_VEC4;
|
||||
case 2: return SH_FLOAT_VEC2;
|
||||
case 3: return SH_FLOAT_VEC3;
|
||||
case 4: return SH_FLOAT_VEC4;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
} else {
|
||||
return GL_FLOAT;
|
||||
return SH_FLOAT;
|
||||
}
|
||||
case EbtInt:
|
||||
if (type.isMatrix()) {
|
||||
UNREACHABLE();
|
||||
} else if (type.isVector()) {
|
||||
switch (type.getNominalSize()) {
|
||||
case 2: return GL_INT_VEC2;
|
||||
case 3: return GL_INT_VEC3;
|
||||
case 4: return GL_INT_VEC4;
|
||||
case 2: return SH_INT_VEC2;
|
||||
case 3: return SH_INT_VEC3;
|
||||
case 4: return SH_INT_VEC4;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
} else {
|
||||
return GL_INT;
|
||||
return SH_INT;
|
||||
}
|
||||
case EbtUInt:
|
||||
if (type.isMatrix()) {
|
||||
UNREACHABLE();
|
||||
} else if (type.isVector()) {
|
||||
switch (type.getNominalSize()) {
|
||||
case 2: return GL_UNSIGNED_INT_VEC2;
|
||||
case 3: return GL_UNSIGNED_INT_VEC3;
|
||||
case 4: return GL_UNSIGNED_INT_VEC4;
|
||||
case 2: return SH_UNSIGNED_INT_VEC2;
|
||||
case 3: return SH_UNSIGNED_INT_VEC3;
|
||||
case 4: return SH_UNSIGNED_INT_VEC4;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
} else {
|
||||
return GL_UNSIGNED_INT;
|
||||
return SH_UNSIGNED_INT;
|
||||
}
|
||||
case EbtBool:
|
||||
if (type.isMatrix()) {
|
||||
UNREACHABLE();
|
||||
} else if (type.isVector()) {
|
||||
switch (type.getNominalSize()) {
|
||||
case 2: return GL_BOOL_VEC2;
|
||||
case 3: return GL_BOOL_VEC3;
|
||||
case 4: return GL_BOOL_VEC4;
|
||||
case 2: return SH_BOOL_VEC2;
|
||||
case 3: return SH_BOOL_VEC3;
|
||||
case 4: return SH_BOOL_VEC4;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
} else {
|
||||
return GL_BOOL;
|
||||
return SH_BOOL;
|
||||
}
|
||||
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;
|
||||
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;
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
return GL_NONE;
|
||||
return SH_NONE;
|
||||
}
|
||||
|
||||
void getBuiltInVariableInfo(const TType& type,
|
||||
|
@ -217,7 +216,7 @@ TVariableInfo* findVariable(const TType& type,
|
|||
} // namespace anonymous
|
||||
|
||||
TVariableInfo::TVariableInfo()
|
||||
: type(GL_NONE),
|
||||
: type(SH_NONE),
|
||||
size(0),
|
||||
isArray(false),
|
||||
precision(EbpUndefined),
|
||||
|
@ -225,7 +224,7 @@ TVariableInfo::TVariableInfo()
|
|||
{
|
||||
}
|
||||
|
||||
TVariableInfo::TVariableInfo(sh::GLenum type, int size)
|
||||
TVariableInfo::TVariableInfo(ShDataType type, int size)
|
||||
: type(type),
|
||||
size(size),
|
||||
isArray(false),
|
||||
|
@ -273,7 +272,7 @@ void CollectVariables::visitSymbol(TIntermSymbol* symbol)
|
|||
TVariableInfo info;
|
||||
info.name = "gl_FragCoord";
|
||||
info.mappedName = "gl_FragCoord";
|
||||
info.type = GL_FLOAT_VEC4;
|
||||
info.type = SH_FLOAT_VEC4;
|
||||
info.size = 1;
|
||||
info.precision = EbpMedium; // Use mediump as it doesn't really matter.
|
||||
info.staticUse = true;
|
||||
|
@ -286,7 +285,7 @@ void CollectVariables::visitSymbol(TIntermSymbol* symbol)
|
|||
TVariableInfo info;
|
||||
info.name = "gl_FrontFacing";
|
||||
info.mappedName = "gl_FrontFacing";
|
||||
info.type = GL_BOOL;
|
||||
info.type = SH_BOOL;
|
||||
info.size = 1;
|
||||
info.precision = EbpUndefined;
|
||||
info.staticUse = true;
|
||||
|
@ -299,7 +298,7 @@ void CollectVariables::visitSymbol(TIntermSymbol* symbol)
|
|||
TVariableInfo info;
|
||||
info.name = "gl_PointCoord";
|
||||
info.mappedName = "gl_PointCoord";
|
||||
info.type = GL_FLOAT_VEC2;
|
||||
info.type = SH_FLOAT_VEC2;
|
||||
info.size = 1;
|
||||
info.precision = EbpMedium; // Use mediump as it doesn't really matter.
|
||||
info.staticUse = true;
|
||||
|
|
|
@ -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(sh::GLenum type, int size);
|
||||
TVariableInfo(ShDataType type, int size);
|
||||
TVariableInfo();
|
||||
|
||||
TPersistString name;
|
||||
TPersistString mappedName;
|
||||
sh::GLenum type;
|
||||
ShDataType type;
|
||||
int size;
|
||||
bool isArray;
|
||||
TPrecision precision;
|
||||
|
|
|
@ -4,45 +4,44 @@
|
|||
// found in the LICENSE file.
|
||||
//
|
||||
#include "compiler/translator/VariablePacker.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace {
|
||||
int GetSortOrder(sh::GLenum type)
|
||||
int GetSortOrder(ShDataType type)
|
||||
{
|
||||
switch (type) {
|
||||
case GL_FLOAT_MAT4:
|
||||
case GL_FLOAT_MAT2x4:
|
||||
case GL_FLOAT_MAT3x4:
|
||||
case GL_FLOAT_MAT4x2:
|
||||
case GL_FLOAT_MAT4x3:
|
||||
case SH_FLOAT_MAT4:
|
||||
case SH_FLOAT_MAT2x4:
|
||||
case SH_FLOAT_MAT3x4:
|
||||
case SH_FLOAT_MAT4x2:
|
||||
case SH_FLOAT_MAT4x3:
|
||||
return 0;
|
||||
case GL_FLOAT_MAT2:
|
||||
case SH_FLOAT_MAT2:
|
||||
return 1;
|
||||
case GL_FLOAT_VEC4:
|
||||
case GL_INT_VEC4:
|
||||
case GL_BOOL_VEC4:
|
||||
case SH_FLOAT_VEC4:
|
||||
case SH_INT_VEC4:
|
||||
case SH_BOOL_VEC4:
|
||||
return 2;
|
||||
case GL_FLOAT_MAT3:
|
||||
case GL_FLOAT_MAT2x3:
|
||||
case GL_FLOAT_MAT3x2:
|
||||
case SH_FLOAT_MAT3:
|
||||
case SH_FLOAT_MAT2x3:
|
||||
case SH_FLOAT_MAT3x2:
|
||||
return 3;
|
||||
case GL_FLOAT_VEC3:
|
||||
case GL_INT_VEC3:
|
||||
case GL_BOOL_VEC3:
|
||||
case SH_FLOAT_VEC3:
|
||||
case SH_INT_VEC3:
|
||||
case SH_BOOL_VEC3:
|
||||
return 4;
|
||||
case GL_FLOAT_VEC2:
|
||||
case GL_INT_VEC2:
|
||||
case GL_BOOL_VEC2:
|
||||
case SH_FLOAT_VEC2:
|
||||
case SH_INT_VEC2:
|
||||
case SH_BOOL_VEC2:
|
||||
return 5;
|
||||
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:
|
||||
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:
|
||||
return 6;
|
||||
default:
|
||||
ASSERT(false);
|
||||
|
@ -51,37 +50,37 @@ int GetSortOrder(sh::GLenum type)
|
|||
}
|
||||
} // namespace
|
||||
|
||||
int VariablePacker::GetNumComponentsPerRow(sh::GLenum type)
|
||||
int VariablePacker::GetNumComponentsPerRow(ShDataType type)
|
||||
{
|
||||
switch (type) {
|
||||
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:
|
||||
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:
|
||||
return 4;
|
||||
case GL_FLOAT_MAT3:
|
||||
case GL_FLOAT_MAT2x3:
|
||||
case GL_FLOAT_MAT3x2:
|
||||
case GL_FLOAT_VEC3:
|
||||
case GL_INT_VEC3:
|
||||
case GL_BOOL_VEC3:
|
||||
case SH_FLOAT_MAT3:
|
||||
case SH_FLOAT_MAT2x3:
|
||||
case SH_FLOAT_MAT3x2:
|
||||
case SH_FLOAT_VEC3:
|
||||
case SH_INT_VEC3:
|
||||
case SH_BOOL_VEC3:
|
||||
return 3;
|
||||
case GL_FLOAT_VEC2:
|
||||
case GL_INT_VEC2:
|
||||
case GL_BOOL_VEC2:
|
||||
case SH_FLOAT_VEC2:
|
||||
case SH_INT_VEC2:
|
||||
case SH_BOOL_VEC2:
|
||||
return 2;
|
||||
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:
|
||||
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:
|
||||
return 1;
|
||||
default:
|
||||
ASSERT(false);
|
||||
|
@ -89,37 +88,37 @@ int VariablePacker::GetNumComponentsPerRow(sh::GLenum type)
|
|||
}
|
||||
}
|
||||
|
||||
int VariablePacker::GetNumRows(sh::GLenum type)
|
||||
int VariablePacker::GetNumRows(ShDataType type)
|
||||
{
|
||||
switch (type) {
|
||||
case GL_FLOAT_MAT4:
|
||||
case GL_FLOAT_MAT2x4:
|
||||
case GL_FLOAT_MAT3x4:
|
||||
case GL_FLOAT_MAT4x3:
|
||||
case GL_FLOAT_MAT4x2:
|
||||
case SH_FLOAT_MAT4:
|
||||
case SH_FLOAT_MAT2x4:
|
||||
case SH_FLOAT_MAT3x4:
|
||||
case SH_FLOAT_MAT4x3:
|
||||
case SH_FLOAT_MAT4x2:
|
||||
return 4;
|
||||
case GL_FLOAT_MAT3:
|
||||
case GL_FLOAT_MAT2x3:
|
||||
case GL_FLOAT_MAT3x2:
|
||||
case SH_FLOAT_MAT3:
|
||||
case SH_FLOAT_MAT2x3:
|
||||
case SH_FLOAT_MAT3x2:
|
||||
return 3;
|
||||
case GL_FLOAT_MAT2:
|
||||
case SH_FLOAT_MAT2:
|
||||
return 2;
|
||||
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:
|
||||
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:
|
||||
return 1;
|
||||
default:
|
||||
ASSERT(false);
|
||||
|
|
|
@ -19,10 +19,10 @@ class VariablePacker {
|
|||
const TVariableInfoList& in_variables);
|
||||
|
||||
// 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.
|
||||
static int GetNumRows(sh::GLenum type);
|
||||
static int GetNumRows(ShDataType type);
|
||||
|
||||
private:
|
||||
static const int kNumColumns = 4;
|
||||
|
|
|
@ -35,7 +35,7 @@ static const int GLSL_VERSION_120 = 120;
|
|||
// - invariant gl_Position;
|
||||
// - varying vec3 color; invariant color;
|
||||
//
|
||||
TVersionGLSL::TVersionGLSL(sh::GLenum type)
|
||||
TVersionGLSL::TVersionGLSL(ShShaderType type)
|
||||
: mVersion(GLSL_VERSION_110)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
// TODO: ES3 equivalent versions of GLSL
|
||||
class TVersionGLSL : public TIntermTraverser {
|
||||
public:
|
||||
TVersionGLSL(sh::GLenum type);
|
||||
TVersionGLSL(ShShaderType type);
|
||||
|
||||
// Returns 120 if the following is used the shader:
|
||||
// - "invariant",
|
||||
|
|
|
@ -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/ParseContext.h"
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
#define YYENABLE_NLS 0
|
||||
|
||||
|
@ -107,14 +106,14 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
|
|||
} while (0)
|
||||
|
||||
#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->recover(); \
|
||||
} \
|
||||
}
|
||||
|
||||
#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->recover(); \
|
||||
} \
|
||||
|
@ -821,7 +820,7 @@ declaration
|
|||
$$ = $1.intermAggregate;
|
||||
}
|
||||
| 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->recover();
|
||||
}
|
||||
|
@ -1163,7 +1162,7 @@ type_qualifier
|
|||
ES2_ONLY("varying", @1);
|
||||
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "varying"))
|
||||
context->recover();
|
||||
if (context->shaderType == GL_VERTEX_SHADER)
|
||||
if (context->shaderType == SH_VERTEX_SHADER)
|
||||
$$.setBasic(EbtVoid, EvqVaryingOut, @1);
|
||||
else
|
||||
$$.setBasic(EbtVoid, EvqVaryingIn, @1);
|
||||
|
@ -1172,7 +1171,7 @@ type_qualifier
|
|||
ES2_ONLY("varying", @1);
|
||||
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying"))
|
||||
context->recover();
|
||||
if (context->shaderType == GL_VERTEX_SHADER)
|
||||
if (context->shaderType == SH_VERTEX_SHADER)
|
||||
$$.setBasic(EbtVoid, EvqInvariantVaryingOut, @1);
|
||||
else
|
||||
$$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1);
|
||||
|
@ -1211,29 +1210,29 @@ storage_qualifier
|
|||
}
|
||||
| IN_QUAL {
|
||||
ES3_ONLY("in", @1, "storage qualifier");
|
||||
$$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
|
||||
$$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
|
||||
}
|
||||
| OUT_QUAL {
|
||||
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 {
|
||||
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->recover();
|
||||
}
|
||||
$$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
|
||||
$$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
|
||||
}
|
||||
| CENTROID OUT_QUAL {
|
||||
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->recover();
|
||||
}
|
||||
$$.qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
|
||||
$$.qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
|
||||
}
|
||||
| UNIFORM {
|
||||
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform"))
|
||||
|
|
|
@ -87,7 +87,6 @@
|
|||
#include "compiler/translator/SymbolTable.h"
|
||||
#include "compiler/translator/ParseContext.h"
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
#define YYENABLE_NLS 0
|
||||
|
||||
|
@ -363,14 +362,14 @@ extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
|
|||
} while (0)
|
||||
|
||||
#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->recover(); \
|
||||
} \
|
||||
}
|
||||
|
||||
#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->recover(); \
|
||||
} \
|
||||
|
@ -3353,7 +3352,7 @@ yyreduce:
|
|||
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->recover();
|
||||
}
|
||||
|
@ -3796,7 +3795,7 @@ yyreduce:
|
|||
ES2_ONLY("varying", (yylsp[(1) - (1)]));
|
||||
if (context->globalErrorCheck((yylsp[(1) - (1)]), context->symbolTable.atGlobalLevel(), "varying"))
|
||||
context->recover();
|
||||
if (context->shaderType == GL_VERTEX_SHADER)
|
||||
if (context->shaderType == SH_VERTEX_SHADER)
|
||||
(yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[(1) - (1)]));
|
||||
else
|
||||
(yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[(1) - (1)]));
|
||||
|
@ -3809,7 +3808,7 @@ yyreduce:
|
|||
ES2_ONLY("varying", (yylsp[(1) - (2)]));
|
||||
if (context->globalErrorCheck((yylsp[(1) - (2)]), context->symbolTable.atGlobalLevel(), "invariant varying"))
|
||||
context->recover();
|
||||
if (context->shaderType == GL_VERTEX_SHADER)
|
||||
if (context->shaderType == SH_VERTEX_SHADER)
|
||||
(yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[(1) - (2)]));
|
||||
else
|
||||
(yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[(1) - (2)]));
|
||||
|
@ -3873,7 +3872,7 @@ yyreduce:
|
|||
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -3881,7 +3880,7 @@ yyreduce:
|
|||
|
||||
{
|
||||
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;
|
||||
|
||||
|
@ -3889,12 +3888,12 @@ yyreduce:
|
|||
|
||||
{
|
||||
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->recover();
|
||||
}
|
||||
(yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
|
||||
(yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -3902,12 +3901,12 @@ yyreduce:
|
|||
|
||||
{
|
||||
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->recover();
|
||||
}
|
||||
(yyval.interm.type).qualifier = (context->shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
|
||||
(yyval.interm.type).qualifier = (context->shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -206,8 +206,8 @@ void Shader::initializeCompiler()
|
|||
resources.MinProgramTexelOffset = -8; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE
|
||||
resources.MaxProgramTexelOffset = 7; // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE
|
||||
|
||||
mFragmentCompiler = ShConstructCompiler(GL_FRAGMENT_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
|
||||
mVertexCompiler = ShConstructCompiler(GL_VERTEX_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
|
||||
mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
|
||||
mVertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, hlslVersion, &resources);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <vector>
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
#define SHADER(Src) #Src
|
||||
|
||||
|
@ -180,7 +179,7 @@ TEST_F(ExpressionLimitTest, ExpressionComplexity)
|
|||
ShShaderSpec spec = SH_WEBGL_SPEC;
|
||||
ShShaderOutput output = SH_ESSL_OUTPUT;
|
||||
ShHandle vertexCompiler = ShConstructCompiler(
|
||||
GL_FRAGMENT_SHADER, spec, output, &resources);
|
||||
SH_FRAGMENT_SHADER, spec, output, &resources);
|
||||
int compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
|
||||
|
||||
// Test expression under the limit passes.
|
||||
|
@ -208,7 +207,7 @@ TEST_F(ExpressionLimitTest, UnusedExpressionComplexity)
|
|||
ShShaderSpec spec = SH_WEBGL_SPEC;
|
||||
ShShaderOutput output = SH_ESSL_OUTPUT;
|
||||
ShHandle vertexCompiler = ShConstructCompiler(
|
||||
GL_FRAGMENT_SHADER, spec, output, &resources);
|
||||
SH_FRAGMENT_SHADER, spec, output, &resources);
|
||||
int compileOptions = SH_LIMIT_EXPRESSION_COMPLEXITY;
|
||||
|
||||
// Test expression under the limit passes.
|
||||
|
@ -236,7 +235,7 @@ TEST_F(ExpressionLimitTest, CallStackDepth)
|
|||
ShShaderSpec spec = SH_WEBGL_SPEC;
|
||||
ShShaderOutput output = SH_ESSL_OUTPUT;
|
||||
ShHandle vertexCompiler = ShConstructCompiler(
|
||||
GL_FRAGMENT_SHADER, spec, output, &resources);
|
||||
SH_FRAGMENT_SHADER, spec, output, &resources);
|
||||
int compileOptions = SH_LIMIT_CALL_STACK_DEPTH;
|
||||
|
||||
// Test call stack under the limit passes.
|
||||
|
@ -264,7 +263,7 @@ TEST_F(ExpressionLimitTest, UnusedCallStackDepth)
|
|||
ShShaderSpec spec = SH_WEBGL_SPEC;
|
||||
ShShaderOutput output = SH_ESSL_OUTPUT;
|
||||
ShHandle vertexCompiler = ShConstructCompiler(
|
||||
GL_FRAGMENT_SHADER, spec, output, &resources);
|
||||
SH_FRAGMENT_SHADER, spec, output, &resources);
|
||||
int compileOptions = SH_LIMIT_CALL_STACK_DEPTH;
|
||||
|
||||
// Test call stack under the limit passes.
|
||||
|
@ -292,7 +291,7 @@ TEST_F(ExpressionLimitTest, Recursion)
|
|||
ShShaderSpec spec = SH_WEBGL_SPEC;
|
||||
ShShaderOutput output = SH_ESSL_OUTPUT;
|
||||
ShHandle vertexCompiler = ShConstructCompiler(
|
||||
GL_FRAGMENT_SHADER, spec, output, &resources);
|
||||
SH_FRAGMENT_SHADER, spec, output, &resources);
|
||||
int compileOptions = 0;
|
||||
|
||||
static const char* shaderWithRecursion0 = SHADER(
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
//
|
||||
#include "compiler/translator/VariablePacker.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "angle_gl.h"
|
||||
|
||||
TEST(VariablePacking, Pack) {
|
||||
VariablePacker packer;
|
||||
|
@ -14,30 +13,30 @@ TEST(VariablePacking, Pack) {
|
|||
// test no vars.
|
||||
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
|
||||
|
||||
sh::GLenum types[] = {
|
||||
GL_FLOAT_MAT4, // 0
|
||||
GL_FLOAT_MAT2, // 1
|
||||
GL_FLOAT_VEC4, // 2
|
||||
GL_INT_VEC4, // 3
|
||||
GL_BOOL_VEC4, // 4
|
||||
GL_FLOAT_MAT3, // 5
|
||||
GL_FLOAT_VEC3, // 6
|
||||
GL_INT_VEC3, // 7
|
||||
GL_BOOL_VEC3, // 8
|
||||
GL_FLOAT_VEC2, // 9
|
||||
GL_INT_VEC2, // 10
|
||||
GL_BOOL_VEC2, // 11
|
||||
GL_FLOAT, // 12
|
||||
GL_INT, // 13
|
||||
GL_BOOL, // 14
|
||||
GL_SAMPLER_2D, // 15
|
||||
GL_SAMPLER_CUBE, // 16
|
||||
GL_SAMPLER_EXTERNAL_OES, // 17
|
||||
GL_SAMPLER_2D_RECT_ARB, // 18
|
||||
ShDataType types[] = {
|
||||
SH_FLOAT_MAT4, // 0
|
||||
SH_FLOAT_MAT2, // 1
|
||||
SH_FLOAT_VEC4, // 2
|
||||
SH_INT_VEC4, // 3
|
||||
SH_BOOL_VEC4, // 4
|
||||
SH_FLOAT_MAT3, // 5
|
||||
SH_FLOAT_VEC3, // 6
|
||||
SH_INT_VEC3, // 7
|
||||
SH_BOOL_VEC3, // 8
|
||||
SH_FLOAT_VEC2, // 9
|
||||
SH_INT_VEC2, // 10
|
||||
SH_BOOL_VEC2, // 11
|
||||
SH_FLOAT, // 12
|
||||
SH_INT, // 13
|
||||
SH_BOOL, // 14
|
||||
SH_SAMPLER_2D, // 15
|
||||
SH_SAMPLER_CUBE, // 16
|
||||
SH_SAMPLER_EXTERNAL_OES, // 17
|
||||
SH_SAMPLER_2D_RECT_ARB, // 18
|
||||
};
|
||||
|
||||
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_components_per_row = VariablePacker::GetNumComponentsPerRow(type);
|
||||
// Check 1 of the type.
|
||||
|
@ -72,15 +71,15 @@ TEST(VariablePacking, Pack) {
|
|||
|
||||
// Test example from GLSL ES 3.0 spec chapter 11.
|
||||
vars.clear();
|
||||
vars.push_back(TVariableInfo(GL_FLOAT_VEC4, 1));
|
||||
vars.push_back(TVariableInfo(GL_FLOAT_MAT3, 1));
|
||||
vars.push_back(TVariableInfo(GL_FLOAT_MAT3, 1));
|
||||
vars.push_back(TVariableInfo(GL_FLOAT_VEC2, 6));
|
||||
vars.push_back(TVariableInfo(GL_FLOAT_VEC2, 4));
|
||||
vars.push_back(TVariableInfo(GL_FLOAT_VEC2, 1));
|
||||
vars.push_back(TVariableInfo(GL_FLOAT, 3));
|
||||
vars.push_back(TVariableInfo(GL_FLOAT, 2));
|
||||
vars.push_back(TVariableInfo(GL_FLOAT, 1));
|
||||
vars.push_back(TVariableInfo(SH_FLOAT_VEC4, 1));
|
||||
vars.push_back(TVariableInfo(SH_FLOAT_MAT3, 1));
|
||||
vars.push_back(TVariableInfo(SH_FLOAT_MAT3, 1));
|
||||
vars.push_back(TVariableInfo(SH_FLOAT_VEC2, 6));
|
||||
vars.push_back(TVariableInfo(SH_FLOAT_VEC2, 4));
|
||||
vars.push_back(TVariableInfo(SH_FLOAT_VEC2, 1));
|
||||
vars.push_back(TVariableInfo(SH_FLOAT, 3));
|
||||
vars.push_back(TVariableInfo(SH_FLOAT, 2));
|
||||
vars.push_back(TVariableInfo(SH_FLOAT, 1));
|
||||
EXPECT_TRUE(packer.CheckVariablesWithinPackingLimits(kMaxRows, vars));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче