Commit 486f381f by Clemen Deng Committed by Commit Bot

Add desktop GL built-in functions to symbol table

Added GL built-in functions to symbol table autogeneration Built-in lookup now checks against spec and returns GL symbols when appropriate. Bug: angleproject:3719 Change-Id: I74786150f6063b40e13aebcb2eb9ea35e4ecaa53 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1731550Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Clemen Deng <clemendeng@google.com>
parent 265fdf0c
{
"src/compiler/translator/ImmutableString_autogen.cpp":
"a47e4acb32dac769b179bb1e884fbece",
"0a96956b0168817b28032a567f606940",
"src/compiler/translator/ParseContext_autogen.h":
"58786d2f352ee1a58d529fb7572c86a4",
"48f878f5878e8ab239af7c14e5878b62",
"src/compiler/translator/SymbolTable_autogen.cpp":
"e53566eaeeb2ca47d54b22ff0ff21b6d",
"49931f9922d8b8d4478658fc76ae2a44",
"src/compiler/translator/SymbolTable_autogen.h":
"bdb3c8eab0d48267a2f264e3af635e1a",
"src/compiler/translator/builtin_function_declarations.txt":
"d0c15cb9f2ef6c0ba5cd6612470db000",
"583e23ceaca8d2baeb07694049b68644",
"src/compiler/translator/builtin_variables.json":
"bbcda061188c066dd887f9ecf5f6f4b4",
"src/compiler/translator/gen_builtin_symbols.py":
"5527c49f0e939aa593fa14f0f0cf84c5",
"ff3ba3065b88217d72419630d87940e9",
"src/compiler/translator/tree_util/BuiltIn_autogen.h":
"8960db32b50614ad1f339bd0f5fdca2a",
"eb49e9f6216e90d11e91d60a2446ac6d",
"src/tests/compiler_tests/ImmutableString_test_autogen.cpp":
"7b9cded5c25f8e433b866a3f4be334c3"
"99468acdcf2bad59fd9f6a7519bcf390"
}
\ No newline at end of file
......@@ -54,6 +54,7 @@ enum TBasicType
{
EbtVoid,
EbtFloat,
EbtDouble,
EbtInt,
EbtUInt,
EbtBool,
......@@ -86,7 +87,25 @@ enum TBasicType
EbtSampler2DShadow,
EbtSamplerCubeShadow,
EbtSampler2DArrayShadow,
EbtGuardSamplerEnd = EbtSampler2DArrayShadow, // non type: see implementation of IsSampler()
EbtSampler1D, // Desktop GLSL sampler types
EbtSampler1DArray,
EbtSampler1DArrayShadow,
EbtSamplerBuffer,
EbtSamplerCubeArray,
EbtSamplerCubeArrayShadow,
EbtSampler1DShadow,
EbtSampler2DRectShadow,
EbtISampler1D,
EbtISampler1DArray,
EbtISampler2DRect,
EbtISamplerBuffer,
EbtISamplerCubeArray,
EbtUSampler1D,
EbtUSampler1DArray,
EbtUSampler2DRect,
EbtUSamplerBuffer,
EbtUSamplerCubeArray,
EbtGuardSamplerEnd = EbtUSamplerCubeArray, // non type: see implementation of IsSampler()
// images
EbtGuardImageBegin,
......@@ -102,9 +121,40 @@ enum TBasicType
EbtImageCube,
EbtIImageCube,
EbtUImageCube,
EbtGuardImageEnd = EbtUImageCube,
EbtLastSimpleType = EbtGuardImageEnd,
EbtImage1D, // Desktop GLSL image types
EbtIImage1D,
EbtUImage1D,
EbtImage1DArray,
EbtIImage1DArray,
EbtUImage1DArray,
EbtImage2DMS,
EbtIImage2DMS,
EbtUImage2DMS,
EbtImage2DMSArray,
EbtIImage2DMSArray,
EbtUImage2DMSArray,
EbtImage2DRect,
EbtIImage2DRect,
EbtUImage2DRect,
EbtImageCubeArray,
EbtIImageCubeArray,
EbtUImageCubeArray,
EbtImageRect,
EbtIImageRect,
EbtUImageRect,
EbtImageBuffer,
EbtIImageBuffer,
EbtUImageBuffer,
EbtGuardImageEnd = EbtUImageBuffer,
EbtSubpassInput,
EbtISubpassInput,
EbtUSubpassInput,
EbtSubpassInputMS,
EbtISubpassInputMS,
EbtUSubpassInputMS,
EbtLastSimpleType = EbtUSubpassInputMS,
EbtStruct,
EbtInterfaceBlock,
......@@ -133,6 +183,16 @@ class TBasicMangledName
mName[0] = '0';
mName[1] = static_cast<char>('a' - 26 + t);
}
else if (t < 78)
{
mName[0] = '1';
mName[1] = static_cast<char>('A' - 52 + t);
}
else if (t < 104)
{
mName[0] = '1';
mName[1] = static_cast<char>('a' - 78 + t);
}
}
constexpr char *getName() { return mName; }
......
......@@ -232,7 +232,7 @@ enum TOperator
EOpBitwiseXorAssign,
EOpBitwiseOrAssign,
// barriers
// barriers
EOpBarrier,
EOpMemoryBarrier,
EOpMemoryBarrierAtomicCounter,
......@@ -251,9 +251,15 @@ enum TOperator
EOpAtomicExchange,
EOpAtomicCompSwap,
// Geometry only
// Geometry only
EOpEmitVertex,
EOpEndPrimitive
EOpEndPrimitive,
// Desktop GLSL functions
EOpFTransform,
EOpFma,
EOpPackDouble2x32,
EOpUnpackDouble2x32,
};
// Returns the string corresponding to the operator in GLSL
......
......@@ -21,42 +21,42 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 677 && id <= 746;
return id >= 1113 && id <= 1259;
}
bool isTextureOffsetBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 747 && id <= 766;
return id >= 1260 && id <= 1294;
}
bool isTextureGatherOffset(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 844 && id <= 857;
return id >= 1346 && id <= 1388;
}
bool isTextureGather(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 820 && id <= 857;
return id >= 1308 && id <= 1388;
}
bool isAtomicMemory(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 874 && id <= 891;
return id >= 1450 && id <= 1467;
}
bool isImageLoad(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 916 && id <= 927;
return id >= 2104 && id <= 2136;
}
bool isImageStore(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 928 && id <= 939;
return id >= 2137 && id <= 2169;
}
bool isImage(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 892 && id <= 939;
return id >= 1468 && id <= 2169;
}
} // namespace BuiltInGroup
......
......@@ -69,6 +69,7 @@ TSymbolTable::TSymbolTable()
: mGlobalInvariant(false),
mUniqueIdCounter(0),
mShaderType(GL_FRAGMENT_SHADER),
mShaderSpec(SH_GLES2_SPEC),
mGlInVariableWithArraySize(nullptr)
{}
......@@ -359,6 +360,7 @@ void TSymbolTable::initializeBuiltIns(sh::GLenum type,
const ShBuiltInResources &resources)
{
mShaderType = type;
mShaderSpec = spec;
mResources = resources;
// We need just one precision stack level for predefined precisions.
......
......@@ -44,17 +44,6 @@
namespace sh
{
// Define ESymbolLevel as int rather than an enum so that we can do arithmetic on it.
typedef int ESymbolLevel;
const int COMMON_BUILTINS = 0;
const int ESSL1_BUILTINS = 1;
const int ESSL3_BUILTINS = 2;
const int ESSL3_1_BUILTINS = 3;
// GLSL_BUILTINS are desktop GLSL builtins that don't exist in ESSL but are used to implement
// features in ANGLE's GLSL backend. They're not visible to the parser.
const int GLSL_BUILTINS = 4;
const int LAST_BUILTIN_LEVEL = GLSL_BUILTINS;
struct UnmangledBuiltIn
{
constexpr UnmangledBuiltIn(TExtension extension) : extension(extension) {}
......@@ -186,6 +175,7 @@ class TSymbolTable : angle::NonCopyable, TSymbolTableBase
static const int kLastBuiltInId;
sh::GLenum mShaderType;
ShShaderSpec mShaderSpec;
ShBuiltInResources mResources;
// Indexed by unique id. Map instead of vector since the variables are fairly sparse.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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