Commit 4fbbdb15 by Cody Northrop Committed by Commit Bot

texture3D: Compiler changes for sampler3D

Bug: angleproject:3188 Change-Id: Iac1408f8b91c6a6610a63cef236205b7dcdbd2c4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1682781Reviewed-by: 's avatarLingfeng Yang <lfy@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
parent cb335463
......@@ -331,6 +331,7 @@ struct ShBuiltInResources
int EXT_YUV_target;
int EXT_geometry_shader;
int OES_texture_storage_multisample_2d_array;
int OES_texture_3D;
int ANGLE_texture_multisample;
int ANGLE_multi_draw;
......
......@@ -50,23 +50,23 @@
"DXGI format:src/libANGLE/renderer/d3d/d3d11/gen_dxgi_format_table.py":
"411e6064b916d570fa76949820d34a45",
"ESSL static builtins:src/compiler/translator/ParseContext_autogen.h":
"6be7f97ce68aa5ba5ecf30b835bc344d",
"58786d2f352ee1a58d529fb7572c86a4",
"ESSL static builtins:src/compiler/translator/SymbolTable_autogen.cpp":
"ad011c79a85e5cb3dfff7ccb1095bff0",
"a33c88c3e99fd32b914daa9991262810",
"ESSL static builtins:src/compiler/translator/SymbolTable_autogen.h":
"bdb3c8eab0d48267a2f264e3af635e1a",
"ESSL static builtins:src/compiler/translator/builtin_function_declarations.txt":
"e5e567406476306ea06984d885be028d",
"d0c15cb9f2ef6c0ba5cd6612470db000",
"ESSL static builtins:src/compiler/translator/builtin_symbols_hash_autogen.txt":
"02ffe4544c2e72a3fc1d4d3adeec3b05",
"03ea75bbf5fe670041c9ccd60ab4d9c3",
"ESSL static builtins:src/compiler/translator/builtin_variables.json":
"13e7c79b2c2baaf7dab12730a0509982",
"ESSL static builtins:src/compiler/translator/gen_builtin_symbols.py":
"5d5467e17ca5ed5bf9938df9a3391e6f",
"ESSL static builtins:src/compiler/translator/tree_util/BuiltIn_autogen.h":
"6df5ab6576da4f364763b581da839b77",
"150682db27fba7f4d2d0d67272d67768",
"ESSL static builtins:src/tests/compiler_tests/ImmutableString_test_autogen.cpp":
"c7994179a311f152df4b4a8513211c87",
"db56dc37c3369f5c5e7c6b0ee5439ba9",
"Emulated HLSL functions:src/compiler/translator/emulated_builtin_function_data_hlsl.json":
"002ad46d144c51fe98d73478aa554ba7",
"Emulated HLSL functions:src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp":
......
......@@ -976,6 +976,7 @@ void TCompiler::setResourceString()
<< ":OVR_multiview:" << mResources.OVR_multiview
<< ":EXT_YUV_target:" << mResources.EXT_YUV_target
<< ":EXT_geometry_shader:" << mResources.EXT_geometry_shader
<< ":OES_texture_3D:" << mResources.OES_texture_3D
<< ":MaxVertexOutputVectors:" << mResources.MaxVertexOutputVectors
<< ":MaxFragmentInputVectors:" << mResources.MaxFragmentInputVectors
<< ":MinProgramTexelOffset:" << mResources.MinProgramTexelOffset
......
......@@ -29,6 +29,7 @@
OP(OES_EGL_image_external_essl3) \
OP(OES_standard_derivatives) \
OP(OES_texture_storage_multisample_2d_array) \
OP(OES_texture_3D) \
OP(OVR_multiview) \
OP(OVR_multiview2) \
OP(ANGLE_multi_draw)
......
......@@ -34,6 +34,7 @@ enum class TExtension
OES_EGL_image_external_essl3,
OES_standard_derivatives,
OES_texture_storage_multisample_2d_array,
OES_texture_3D,
OVR_multiview,
OVR_multiview2,
ANGLE_multi_draw,
......
......@@ -81,6 +81,10 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi
{
extBehavior[TExtension::OES_texture_storage_multisample_2d_array] = EBhUndefined;
}
if (resources.OES_texture_3D)
{
extBehavior[TExtension::OES_texture_3D] = EBhUndefined;
}
if (resources.ANGLE_texture_multisample)
{
extBehavior[TExtension::ANGLE_texture_multisample] = EBhUndefined;
......
......@@ -98,8 +98,9 @@ ImmutableString TOutputGLSL::translateTextureFunction(const ImmutableString &nam
// Extensions
"texture2DLodEXT", "textureLod", "texture2DProjLodEXT", "textureProjLod",
"textureCubeLodEXT", "textureLod", "texture2DGradEXT", "textureGrad",
"texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", nullptr,
nullptr};
"texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", "texture3D",
"texture", "texture3DProj", "textureProj", "texture3DLod", "textureLod", "texture3DProjLod",
"textureProjLod", nullptr, nullptr};
const char **mapping =
(sh::IsGLSL130OrNewer(getShaderOutput())) ? legacyToCoreRename : simpleRename;
......
......@@ -21,42 +21,42 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 671 && id <= 740;
return id >= 677 && id <= 746;
}
bool isTextureOffsetBias(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 741 && id <= 760;
return id >= 747 && id <= 766;
}
bool isTextureGatherOffset(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 838 && id <= 851;
return id >= 844 && id <= 857;
}
bool isTextureGather(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 814 && id <= 851;
return id >= 820 && id <= 857;
}
bool isAtomicMemory(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 868 && id <= 885;
return id >= 874 && id <= 891;
}
bool isImageLoad(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 910 && id <= 921;
return id >= 916 && id <= 927;
}
bool isImageStore(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 922 && id <= 933;
return id >= 928 && id <= 939;
}
bool isImage(const TFunction *func)
{
int id = func->uniqueId().get();
return id >= 886 && id <= 933;
return id >= 892 && id <= 939;
}
} // namespace BuiltInGroup
......
......@@ -204,6 +204,7 @@ void InitBuiltInResources(ShBuiltInResources *resources)
resources->EXT_YUV_target = 0;
resources->EXT_geometry_shader = 0;
resources->OES_texture_storage_multisample_2d_array = 0;
resources->OES_texture_3D = 0;
resources->ANGLE_texture_multisample = 0;
resources->ANGLE_multi_draw = 0;
......
......@@ -321,6 +321,13 @@ GROUP BEGIN TextureESSL100FS {"condition": "shaderType == GL_FRAGMENT_SHADER"}
vec4 texture2DProjLodEXT(sampler2D, vec3, float);
vec4 texture2DProjLodEXT(sampler2D, vec4, float);
vec4 textureCubeLodEXT(samplerCube, vec3, float);
DEFAULT METADATA {"level": "ESSL1_BUILTINS", "op": "CallBuiltInFunction", "extension": "OES_texture_3D"}
vec4 texture3D(sampler3D, vec3);
vec4 texture3D(sampler3D, vec3, float);
vec4 texture3DProj(sampler3D, vec4);
vec4 texture3DProj(sampler3D, vec4, float);
vec4 texture3DLod(sampler3D, vec3, float);
vec4 texture3DProjLod(sampler3D, vec4, float);
GROUP END TextureESSL100FS
GROUP BEGIN TextureESSL100VS {"condition": "shaderType == GL_VERTEX_SHADER"}
......
6edf8fb36322aa738e34a1ef287a4d33
\ No newline at end of file
81fe24b242a39d4996a5d91bf7227b6d
\ No newline at end of file
......@@ -85,6 +85,7 @@ static int ES2_ident_ES3_keyword(TParseContext *context, int token);
static int ES2_ident_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
static int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
static int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token);
static int ES2_extension_ES3_keyword_else_reserved(TParseContext *context, TExtension extension, int token);
static int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token);
static int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExtension extension, int token);
static int ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(TParseContext *context, TExtension extension, int token);
......@@ -187,7 +188,7 @@ O [0-7]
"sampler2D" { return SAMPLER2D; }
"samplerCube" { return SAMPLERCUBE; }
"samplerExternalOES" { return SAMPLER_EXTERNAL_OES; }
"sampler3D" { return ES2_reserved_ES3_keyword(context, SAMPLER3D); }
"sampler3D" { return ES2_extension_ES3_keyword_else_reserved(context, TExtension::OES_texture_3D, SAMPLER3D); }
"sampler3DRect" { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
"sampler2DRect" { return SAMPLER2DRECT; }
"sampler2DArray" { return ES2_ident_ES3_keyword(context, SAMPLER2DARRAY); }
......@@ -549,6 +550,19 @@ int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token)
return token;
}
int ES2_extension_ES3_keyword_else_reserved(TParseContext *context, TExtension extension, int token)
{
yyscan_t yyscanner = (yyscan_t) context->getScanner();
// Available with extension or ES 3.00 and above, reserved otherwise
if (context->isExtensionEnabled(extension) || context->getShaderVersion() >= 300)
{
return token;
}
return reserved_word(yyscanner);
}
int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token)
{
struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
......
......@@ -1224,6 +1224,7 @@ static int ES2_ident_ES3_keyword(TParseContext *context, int token);
static int ES2_ident_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
static int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
static int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token);
static int ES2_extension_ES3_keyword_else_reserved(TParseContext *context, TExtension extension, int token);
static int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token);
static int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExtension extension, int token);
static int ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(TParseContext *context, TExtension extension, int token);
......@@ -1954,7 +1955,7 @@ YY_RULE_SETUP
YY_BREAK
case 64:
YY_RULE_SETUP
{ return ES2_reserved_ES3_keyword(context, SAMPLER3D); }
{ return ES2_extension_ES3_keyword_else_reserved(context, TExtension::OES_texture_3D, SAMPLER3D); }
YY_BREAK
case 65:
YY_RULE_SETUP
......@@ -3914,6 +3915,19 @@ int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token)
return token;
}
int ES2_extension_ES3_keyword_else_reserved(TParseContext *context, TExtension extension, int token)
{
yyscan_t yyscanner = (yyscan_t) context->getScanner();
// Available with extension or ES 3.00 and above, reserved otherwise
if (context->isExtensionEnabled(extension) || context->getShaderVersion() >= 300)
{
return token;
}
return reserved_word(yyscanner);
}
int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token)
{
struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
......
......@@ -518,6 +518,12 @@ TEST(ImmutableStringTest, ScriptGeneratedHashesMatch)
ASSERT_EQ(0x26d60d82u, ImmutableString("texture2DProjLodEXT(0H2B0B").mangledNameHash());
ASSERT_EQ(0x26d1d3beu, ImmutableString("texture2DProjLodEXT(0H3B0B").mangledNameHash());
ASSERT_EQ(0x22c206a5u, ImmutableString("textureCubeLodEXT(0J2B0B").mangledNameHash());
ASSERT_EQ(0x12764e24u, ImmutableString("texture3D(0I2B").mangledNameHash());
ASSERT_EQ(0x12810dc6u, ImmutableString("texture3D(0I2B0B").mangledNameHash());
ASSERT_EQ(0x1a93312fu, ImmutableString("texture3DProj(0I3B").mangledNameHash());
ASSERT_EQ(0x1aa7eecdu, ImmutableString("texture3DProj(0I3B0B").mangledNameHash());
ASSERT_EQ(0x189e8416u, ImmutableString("texture3DLod(0I2B0B").mangledNameHash());
ASSERT_EQ(0x20b9ceecu, ImmutableString("texture3DProjLod(0I3B0B").mangledNameHash());
ASSERT_EQ(0x18986fc2u, ImmutableString("texture2DLod(0H1B0B").mangledNameHash());
ASSERT_EQ(0x20bc6337u, ImmutableString("texture2DProjLod(0H2B0B").mangledNameHash());
ASSERT_EQ(0x20b8a0c3u, ImmutableString("texture2DProjLod(0H3B0B").mangledNameHash());
......@@ -976,6 +982,10 @@ TEST(ImmutableStringTest, ScriptGeneratedHashesMatch)
ASSERT_EQ(0x7e7b843eu, ImmutableString("texture2DLodEXT").mangledNameHash());
ASSERT_EQ(0x7e9ddba0u, ImmutableString("texture2DProjLodEXT").mangledNameHash());
ASSERT_EQ(0x7e8b81cau, ImmutableString("textureCubeLodEXT").mangledNameHash());
ASSERT_EQ(0x7e4db1c8u, ImmutableString("texture3D").mangledNameHash());
ASSERT_EQ(0x7e687e40u, ImmutableString("texture3DProj").mangledNameHash());
ASSERT_EQ(0x7e63c1d1u, ImmutableString("texture3DLod").mangledNameHash());
ASSERT_EQ(0x7e85692eu, ImmutableString("texture3DProjLod").mangledNameHash());
ASSERT_EQ(0x7e67c7ceu, ImmutableString("texture2DLod").mangledNameHash());
ASSERT_EQ(0x7e819b90u, ImmutableString("texture2DProjLod").mangledNameHash());
ASSERT_EQ(0x7e758eddu, ImmutableString("textureCubeLod").mangledNameHash());
......
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