Commit 7e815c77 by Geoff Lang Committed by Commit Bot

Implement EXT_shadow_samplers

Bug: angleproject:4863,b/161716126 Change-Id: I6beb45d91f59a851787c9f40b40266fb985198d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2288330 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarback sept 10 - Jamie Madill <jmadill@chromium.org>
parent e5f188b2
...@@ -405,6 +405,7 @@ struct ShBuiltInResources ...@@ -405,6 +405,7 @@ struct ShBuiltInResources
int APPLE_clip_distance; int APPLE_clip_distance;
int OES_texture_cube_map_array; int OES_texture_cube_map_array;
int EXT_texture_cube_map_array; int EXT_texture_cube_map_array;
int EXT_shadow_samplers;
// Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives // Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives
// with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate // with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
"src/compiler/translator/generate_parser.py": "src/compiler/translator/generate_parser.py":
"566178ecdfae3a29803b3687fc518ebb", "566178ecdfae3a29803b3687fc518ebb",
"src/compiler/translator/glslang.l": "src/compiler/translator/glslang.l":
"5af9feeb7ba8549265f8d19ec7f43343", "27b1e8d59a04bbaec10fac5688a67602",
"src/compiler/translator/glslang.y": "src/compiler/translator/glslang.y":
"1619aa1587a5fae94df9d143af732b77", "1619aa1587a5fae94df9d143af732b77",
"src/compiler/translator/glslang_lex_autogen.cpp": "src/compiler/translator/glslang_lex_autogen.cpp":
"4b94107e3314432cfdc8f9e90909e5a0", "ca9edf3f6882bdf9ac60dab16e8fb994",
"src/compiler/translator/glslang_tab_autogen.cpp": "src/compiler/translator/glslang_tab_autogen.cpp":
"fc0ab4cb3179dc0d936ed9d56bb2dbd0", "fc0ab4cb3179dc0d936ed9d56bb2dbd0",
"src/compiler/translator/glslang_tab_autogen.h": "src/compiler/translator/glslang_tab_autogen.h":
......
{ {
"src/compiler/translator/ImmutableString_ESSL_autogen.cpp": "src/compiler/translator/ImmutableString_ESSL_autogen.cpp":
"0ea93a3bc04293f610fdbfae45f8e436", "a9a7d0620a2db1e80f8a370b523eeae5",
"src/compiler/translator/ImmutableString_autogen.cpp": "src/compiler/translator/ImmutableString_autogen.cpp":
"f3b0095f9f8669520698c845085ab62e", "afe7aec06ab49afc91a1ba25db0a3bce",
"src/compiler/translator/ParseContext_ESSL_autogen.h": "src/compiler/translator/ParseContext_ESSL_autogen.h":
"45035f9e1e7cd735476fc250e034bc72", "4da3f648f61218602aff76296103e0f2",
"src/compiler/translator/ParseContext_complete_autogen.h": "src/compiler/translator/ParseContext_complete_autogen.h":
"d116f43b2e3b61a73b26b301be561e0b", "272d913f6a057fe1ebce884a6bd2bb73",
"src/compiler/translator/SymbolTable_ESSL_autogen.cpp": "src/compiler/translator/SymbolTable_ESSL_autogen.cpp":
"6f3e49f813ca1fa93de47514b3390dfe", "017b7c00d55b9ec4edf084e87847f1d9",
"src/compiler/translator/SymbolTable_autogen.cpp": "src/compiler/translator/SymbolTable_autogen.cpp":
"912d1ec634bf4178d310de6db46066f3", "ef071b17834742f56397bc63d531bb5f",
"src/compiler/translator/SymbolTable_autogen.h": "src/compiler/translator/SymbolTable_autogen.h":
"2d8bed6ff5debc6546199a2add316a66", "2d8bed6ff5debc6546199a2add316a66",
"src/compiler/translator/builtin_function_declarations.txt": "src/compiler/translator/builtin_function_declarations.txt":
"52e0dd28d8be3a0430b70c23d2b060aa", "dc84b6c5fc78d9da23204d72574dd682",
"src/compiler/translator/builtin_variables.json": "src/compiler/translator/builtin_variables.json":
"98d347a6ed181eca3d89bfd73193d787", "98d347a6ed181eca3d89bfd73193d787",
"src/compiler/translator/gen_builtin_symbols.py": "src/compiler/translator/gen_builtin_symbols.py":
"ef6fde209ca86ffb1752fc3a5b9d72d7", "ef6fde209ca86ffb1752fc3a5b9d72d7",
"src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h": "src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h":
"2ca793d3326d9e39e7d4ffbca7041e52", "fa72b4b824dd85feeda5f984866a017f",
"src/compiler/translator/tree_util/BuiltIn_complete_autogen.h": "src/compiler/translator/tree_util/BuiltIn_complete_autogen.h":
"f3713a80fc4ffee53ba4992cc275d5b7", "c3f43a7fafcf0bad43178be1a7da5d0f",
"src/tests/compiler_tests/ImmutableString_test_ESSL_autogen.cpp": "src/tests/compiler_tests/ImmutableString_test_ESSL_autogen.cpp":
"14cbdec9c41ae4a27910347b2c5e59ef", "1f48b488c4e436833f5341ce1ad95f15",
"src/tests/compiler_tests/ImmutableString_test_autogen.cpp": "src/tests/compiler_tests/ImmutableString_test_autogen.cpp":
"d368befd9e4c194c5f6b987b3628a184" "aeacada0c801b923edefe3a74fc16285"
} }
\ No newline at end of file
...@@ -165,6 +165,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) ...@@ -165,6 +165,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
resources.MaxDualSourceDrawBuffers = 1; resources.MaxDualSourceDrawBuffers = 1;
resources.EXT_gpu_shader5 = 1; resources.EXT_gpu_shader5 = 1;
resources.MaxClipDistances = 1; resources.MaxClipDistances = 1;
resources.EXT_shadow_samplers = 1;
if (!translator->Init(resources)) if (!translator->Init(resources))
{ {
......
...@@ -1089,6 +1089,7 @@ void TCompiler::setResourceString() ...@@ -1089,6 +1089,7 @@ void TCompiler::setResourceString()
<< ":APPLE_clip_distance:" << mResources.APPLE_clip_distance << ":APPLE_clip_distance:" << mResources.APPLE_clip_distance
<< ":OES_texture_cube_map_array:" << mResources.OES_texture_cube_map_array << ":OES_texture_cube_map_array:" << mResources.OES_texture_cube_map_array
<< ":EXT_texture_cube_map_array:" << mResources.EXT_texture_cube_map_array << ":EXT_texture_cube_map_array:" << mResources.EXT_texture_cube_map_array
<< ":EXT_shadow_samplers:" << mResources.EXT_shadow_samplers
<< ":MinProgramTextureGatherOffset:" << mResources.MinProgramTextureGatherOffset << ":MinProgramTextureGatherOffset:" << mResources.MinProgramTextureGatherOffset
<< ":MaxProgramTextureGatherOffset:" << mResources.MaxProgramTextureGatherOffset << ":MaxProgramTextureGatherOffset:" << mResources.MaxProgramTextureGatherOffset
<< ":MaxImageUnits:" << mResources.MaxImageUnits << ":MaxImageUnits:" << mResources.MaxImageUnits
......
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
OP(WEBGL_video_texture) \ OP(WEBGL_video_texture) \
OP(APPLE_clip_distance) \ OP(APPLE_clip_distance) \
OP(OES_texture_cube_map_array) \ OP(OES_texture_cube_map_array) \
OP(EXT_texture_cube_map_array) OP(EXT_texture_cube_map_array) \
OP(EXT_shadow_samplers)
namespace sh namespace sh
{ {
......
...@@ -47,6 +47,7 @@ enum class TExtension : uint8_t ...@@ -47,6 +47,7 @@ enum class TExtension : uint8_t
APPLE_clip_distance, APPLE_clip_distance,
OES_texture_cube_map_array, OES_texture_cube_map_array,
EXT_texture_cube_map_array, EXT_texture_cube_map_array,
EXT_shadow_samplers,
}; };
enum TBehavior : uint8_t enum TBehavior : uint8_t
......
...@@ -125,6 +125,10 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi ...@@ -125,6 +125,10 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi
{ {
extBehavior[TExtension::EXT_texture_cube_map_array] = EBhUndefined; extBehavior[TExtension::EXT_texture_cube_map_array] = EBhUndefined;
} }
if (resources.EXT_shadow_samplers)
{
extBehavior[TExtension::EXT_shadow_samplers] = EBhUndefined;
}
} }
void ResetExtensionBehavior(const ShBuiltInResources &resources, void ResetExtensionBehavior(const ShBuiltInResources &resources,
......
...@@ -117,7 +117,8 @@ ImmutableString TOutputGLSL::translateTextureFunction(const ImmutableString &nam ...@@ -117,7 +117,8 @@ ImmutableString TOutputGLSL::translateTextureFunction(const ImmutableString &nam
"textureCubeLodEXT", "textureLod", "texture2DGradEXT", "textureGrad", "textureCubeLodEXT", "textureLod", "texture2DGradEXT", "textureGrad",
"texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", "texture3D", "texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", "texture3D",
"texture", "texture3DProj", "textureProj", "texture3DLod", "textureLod", "texture3DProjLod", "texture", "texture3DProj", "textureProj", "texture3DLod", "textureLod", "texture3DProjLod",
"textureProjLod", nullptr, nullptr}; "textureProjLod", "shadow2DEXT", "texture", "shadow2DProjEXT", "textureProj", nullptr,
nullptr};
const char **mapping = const char **mapping =
(sh::IsGLSL130OrNewer(getShaderOutput())) ? legacyToCoreRename : simpleRename; (sh::IsGLSL130OrNewer(getShaderOutput())) ? legacyToCoreRename : simpleRename;
......
...@@ -21,67 +21,67 @@ namespace BuiltInGroup ...@@ -21,67 +21,67 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func) bool isTextureOffsetNoBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3094 && id <= 3163; return id >= 3098 && id <= 3167;
} }
bool isTextureOffsetBias(const TFunction *func) bool isTextureOffsetBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3164 && id <= 3183; return id >= 3168 && id <= 3187;
} }
bool isTextureGatherOffsetsComp(const TFunction *func) bool isTextureGatherOffsetsComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3221 && id <= 3233; return id >= 3225 && id <= 3237;
} }
bool isTextureGatherOffsetsNoComp(const TFunction *func) bool isTextureGatherOffsetsNoComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3234 && id <= 3249; return id >= 3238 && id <= 3253;
} }
bool isTextureGatherOffsets(const TFunction *func) bool isTextureGatherOffsets(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3221 && id <= 3249; return id >= 3225 && id <= 3253;
} }
bool isTextureGatherOffsetComp(const TFunction *func) bool isTextureGatherOffsetComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3250 && id <= 3255; return id >= 3254 && id <= 3259;
} }
bool isTextureGatherOffsetNoComp(const TFunction *func) bool isTextureGatherOffsetNoComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3256 && id <= 3263; return id >= 3260 && id <= 3267;
} }
bool isTextureGatherOffset(const TFunction *func) bool isTextureGatherOffset(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3250 && id <= 3263; return id >= 3254 && id <= 3267;
} }
bool isTextureGather(const TFunction *func) bool isTextureGather(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3197 && id <= 3263; return id >= 3201 && id <= 3267;
} }
bool isAtomicMemory(const TFunction *func) bool isAtomicMemory(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3280 && id <= 3297; return id >= 3284 && id <= 3301;
} }
bool isImageLoad(const TFunction *func) bool isImageLoad(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3328 && id <= 3342; return id >= 3332 && id <= 3346;
} }
bool isImageStore(const TFunction *func) bool isImageStore(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3343 && id <= 3357; return id >= 3347 && id <= 3361;
} }
bool isImage(const TFunction *func) bool isImage(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 3298 && id <= 3357; return id >= 3302 && id <= 3361;
} }
} // namespace BuiltInGroup } // namespace BuiltInGroup
......
...@@ -21,67 +21,67 @@ namespace BuiltInGroup ...@@ -21,67 +21,67 @@ namespace BuiltInGroup
bool isTextureOffsetNoBias(const TFunction *func) bool isTextureOffsetNoBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1130 && id <= 1276; return id >= 1132 && id <= 1278;
} }
bool isTextureOffsetBias(const TFunction *func) bool isTextureOffsetBias(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1277 && id <= 1311; return id >= 1279 && id <= 1313;
} }
bool isTextureGatherOffsetsComp(const TFunction *func) bool isTextureGatherOffsetsComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1356 && id <= 1371; return id >= 1358 && id <= 1373;
} }
bool isTextureGatherOffsetsNoComp(const TFunction *func) bool isTextureGatherOffsetsNoComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1372 && id <= 1391; return id >= 1374 && id <= 1393;
} }
bool isTextureGatherOffsets(const TFunction *func) bool isTextureGatherOffsets(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1356 && id <= 1391; return id >= 1358 && id <= 1393;
} }
bool isTextureGatherOffsetComp(const TFunction *func) bool isTextureGatherOffsetComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1392 && id <= 1400; return id >= 1394 && id <= 1402;
} }
bool isTextureGatherOffsetNoComp(const TFunction *func) bool isTextureGatherOffsetNoComp(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1401 && id <= 1412; return id >= 1403 && id <= 1414;
} }
bool isTextureGatherOffset(const TFunction *func) bool isTextureGatherOffset(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1392 && id <= 1412; return id >= 1394 && id <= 1414;
} }
bool isTextureGather(const TFunction *func) bool isTextureGather(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1325 && id <= 1412; return id >= 1327 && id <= 1414;
} }
bool isAtomicMemory(const TFunction *func) bool isAtomicMemory(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1474 && id <= 1491; return id >= 1476 && id <= 1493;
} }
bool isImageLoad(const TFunction *func) bool isImageLoad(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 2128 && id <= 2160; return id >= 2130 && id <= 2162;
} }
bool isImageStore(const TFunction *func) bool isImageStore(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 2161 && id <= 2193; return id >= 2163 && id <= 2195;
} }
bool isImage(const TFunction *func) bool isImage(const TFunction *func)
{ {
int id = func->uniqueId().get(); int id = func->uniqueId().get();
return id >= 1492 && id <= 2193; return id >= 1494 && id <= 2195;
} }
} // namespace BuiltInGroup } // namespace BuiltInGroup
......
...@@ -178,6 +178,7 @@ void InitBuiltInResources(ShBuiltInResources *resources) ...@@ -178,6 +178,7 @@ void InitBuiltInResources(ShBuiltInResources *resources)
resources->APPLE_clip_distance = 0; resources->APPLE_clip_distance = 0;
resources->OES_texture_cube_map_array = 0; resources->OES_texture_cube_map_array = 0;
resources->EXT_texture_cube_map_array = 0; resources->EXT_texture_cube_map_array = 0;
resources->EXT_shadow_samplers = 0;
resources->NV_draw_buffers = 0; resources->NV_draw_buffers = 0;
......
...@@ -431,6 +431,13 @@ void TSymbolTable::initializeBuiltIns(sh::GLenum type, ...@@ -431,6 +431,13 @@ void TSymbolTable::initializeBuiltIns(sh::GLenum type,
// It isn't specified whether Sampler2DRect has default precision. // It isn't specified whether Sampler2DRect has default precision.
initSamplerDefaultPrecision(EbtSampler2DRect); initSamplerDefaultPrecision(EbtSampler2DRect);
if (spec < SH_GLES3_SPEC)
{
// Only set the default precision of shadow samplers in ESLL1. They become core in ESSL3
// where they do not have a defalut precision.
initSamplerDefaultPrecision(EbtSampler2DShadow);
}
setDefaultPrecision(EbtAtomicCounter, EbpHigh); setDefaultPrecision(EbtAtomicCounter, EbpHigh);
initializeBuiltInVariables(type, spec, resources); initializeBuiltInVariables(type, spec, resources);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -462,6 +462,9 @@ GROUP BEGIN TextureFirstVersionsFSExt {"shader_type": "FRAGMENT"} ...@@ -462,6 +462,9 @@ GROUP BEGIN TextureFirstVersionsFSExt {"shader_type": "FRAGMENT"}
vec4 texture2DProjLodEXT(sampler2D, vec3, float); vec4 texture2DProjLodEXT(sampler2D, vec3, float);
vec4 texture2DProjLodEXT(sampler2D, vec4, float); vec4 texture2DProjLodEXT(sampler2D, vec4, float);
vec4 textureCubeLodEXT(samplerCube, vec3, float); vec4 textureCubeLodEXT(samplerCube, vec3, float);
DEFAULT METADATA {"essl_level": "ESSL1_BUILTINS", "op": "CallBuiltInFunction", "essl_extension": "EXT_shadow_samplers"}
float shadow2DEXT(sampler2DShadow, vec3);
float shadow2DProjEXT(sampler2DShadow, vec4);
DEFAULT METADATA {"essl_level": "ESSL1_BUILTINS", "op": "CallBuiltInFunction", "essl_extension": "OES_texture_3D"} DEFAULT METADATA {"essl_level": "ESSL1_BUILTINS", "op": "CallBuiltInFunction", "essl_extension": "OES_texture_3D"}
vec4 texture3D(sampler3D, vec3); vec4 texture3D(sampler3D, vec3);
vec4 texture3DProj(sampler3D, vec4); vec4 texture3DProj(sampler3D, vec4);
......
...@@ -225,7 +225,7 @@ O [0-7] ...@@ -225,7 +225,7 @@ O [0-7]
"usamplerCube" { return ES3_keyword(context, USAMPLERCUBE); } "usamplerCube" { return ES3_keyword(context, USAMPLERCUBE); }
"usampler2DArray" { return ES3_keyword(context, USAMPLER2DARRAY); } "usampler2DArray" { return ES3_keyword(context, USAMPLER2DARRAY); }
"usampler2DMS" { return ES3_reserved_ES3_extension_ES3_1_keyword(context, TExtension::ANGLE_texture_multisample, USAMPLER2DMS); } "usampler2DMS" { return ES3_reserved_ES3_extension_ES3_1_keyword(context, TExtension::ANGLE_texture_multisample, USAMPLER2DMS); }
"sampler2DShadow" { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); } "sampler2DShadow" { return ES2_reserved_ES2_extension_ES3_keyword(context, TExtension::EXT_shadow_samplers, SAMPLER2DSHADOW); }
"samplerCubeShadow" { return ES3_keyword(context, SAMPLERCUBESHADOW); } "samplerCubeShadow" { return ES3_keyword(context, SAMPLERCUBESHADOW); }
"sampler2DArrayShadow" { return ES3_keyword(context, SAMPLER2DARRAYSHADOW); } "sampler2DArrayShadow" { return ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
"__samplerExternal2DY2YEXT" { return ES3_extension(context, TExtension::EXT_YUV_target, SAMPLEREXTERNAL2DY2YEXT); } "__samplerExternal2DY2YEXT" { return ES3_extension(context, TExtension::EXT_YUV_target, SAMPLEREXTERNAL2DY2YEXT); }
......
...@@ -1555,7 +1555,11 @@ YY_DECL ...@@ -1555,7 +1555,11 @@ YY_DECL
} }
YY_BREAK YY_BREAK
case 80: case 80:
YY_RULE_SETUP { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); } YY_RULE_SETUP
{
return ES2_reserved_ES2_extension_ES3_keyword(
context, TExtension::EXT_shadow_samplers, SAMPLER2DSHADOW);
}
YY_BREAK YY_BREAK
case 81: case 81:
YY_RULE_SETUP { return ES3_keyword(context, SAMPLERCUBESHADOW); } YY_RULE_SETUP { return ES3_keyword(context, SAMPLERCUBESHADOW); }
......
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.
...@@ -1029,6 +1029,7 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -1029,6 +1029,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_WEBGL_video_texture"] = enableableExtension(&Extensions::webglVideoTexture); map["GL_WEBGL_video_texture"] = enableableExtension(&Extensions::webglVideoTexture);
map["GL_OES_texture_cube_map_array"] = enableableExtension(&Extensions::textureCubeMapArrayOES); map["GL_OES_texture_cube_map_array"] = enableableExtension(&Extensions::textureCubeMapArrayOES);
map["GL_EXT_texture_cube_map_array"] = enableableExtension(&Extensions::textureCubeMapArrayEXT); map["GL_EXT_texture_cube_map_array"] = enableableExtension(&Extensions::textureCubeMapArrayEXT);
map["GL_EXT_shadow_samplers"] = enableableExtension(&Extensions::shadowSamplersEXT);
// clang-format on // clang-format on
#if defined(ANGLE_ENABLE_ASSERTS) #if defined(ANGLE_ENABLE_ASSERTS)
......
...@@ -641,6 +641,9 @@ struct Extensions ...@@ -641,6 +641,9 @@ struct Extensions
{ {
return (textureCubeMapArrayOES || textureCubeMapArrayEXT); return (textureCubeMapArrayOES || textureCubeMapArrayEXT);
} }
// GL_EXT_shadow_samplers
bool shadowSamplersEXT = false;
}; };
// Pointer to a boolean memeber of the Extensions struct // Pointer to a boolean memeber of the Extensions struct
......
...@@ -128,6 +128,9 @@ Compiler::Compiler(rx::GLImplFactory *implFactory, const State &state) ...@@ -128,6 +128,9 @@ Compiler::Compiler(rx::GLImplFactory *implFactory, const State &state)
mResources.OES_texture_cube_map_array = extensions.textureCubeMapArrayOES; mResources.OES_texture_cube_map_array = extensions.textureCubeMapArrayOES;
mResources.EXT_texture_cube_map_array = extensions.textureCubeMapArrayEXT; mResources.EXT_texture_cube_map_array = extensions.textureCubeMapArrayEXT;
// EXT_shadow_samplers
mResources.EXT_shadow_samplers = extensions.shadowSamplersEXT;
// GLSL ES 3.0 constants // GLSL ES 3.0 constants
mResources.MaxVertexOutputVectors = caps.maxVertexOutputComponents / 4; mResources.MaxVertexOutputVectors = caps.maxVertexOutputComponents / 4;
mResources.MaxFragmentInputVectors = caps.maxFragmentInputComponents / 4; mResources.MaxFragmentInputVectors = caps.maxFragmentInputComponents / 4;
......
...@@ -1537,6 +1537,10 @@ void GenerateCaps(const FunctionsGL *functions, ...@@ -1537,6 +1537,10 @@ void GenerateCaps(const FunctionsGL *functions,
functions->hasGLExtension("GL_ARB_gpu_shader5") || functions->hasGLExtension("GL_ARB_gpu_shader5") ||
functions->hasGLESExtension("GL_EXT_gpu_shader5"); functions->hasGLESExtension("GL_EXT_gpu_shader5");
extensions->shadowSamplersEXT = functions->isAtLeastGL(gl::Version(2, 0)) ||
functions->isAtLeastGLES(gl::Version(3, 0)) ||
functions->hasGLESExtension("GL_EXT_shadow_samplers");
// GL_APPLE_clip_distance // GL_APPLE_clip_distance
extensions->clipDistanceAPPLE = functions->isAtLeastGL(gl::Version(3, 0)); extensions->clipDistanceAPPLE = functions->isAtLeastGL(gl::Version(3, 0));
if (extensions->clipDistanceAPPLE) if (extensions->clipDistanceAPPLE)
......
...@@ -198,6 +198,8 @@ void RendererVk::ensureCapsInitialized() const ...@@ -198,6 +198,8 @@ void RendererVk::ensureCapsInitialized() const
mNativeExtensions.textureFilteringCHROMIUM = getFeatures().supportsFilteringPrecision.enabled; mNativeExtensions.textureFilteringCHROMIUM = getFeatures().supportsFilteringPrecision.enabled;
mNativeExtensions.shadowSamplersEXT = true;
// https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch31s02.html // https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch31s02.html
mNativeCaps.maxElementIndex = std::numeric_limits<GLuint>::max() - 1; mNativeCaps.maxElementIndex = std::numeric_limits<GLuint>::max() - 1;
mNativeCaps.max3DTextureSize = LimitToInt(limitsVk.maxImageDimension3D); mNativeCaps.max3DTextureSize = LimitToInt(limitsVk.maxImageDimension3D);
......
...@@ -5492,8 +5492,6 @@ bool ValidateGetTexParameterBase(const Context *context, ...@@ -5492,8 +5492,6 @@ bool ValidateGetTexParameterBase(const Context *context,
case GL_TEXTURE_MAX_LEVEL: case GL_TEXTURE_MAX_LEVEL:
case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_MAX_LOD:
case GL_TEXTURE_COMPARE_MODE:
case GL_TEXTURE_COMPARE_FUNC:
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES30); context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES30);
...@@ -5501,6 +5499,15 @@ bool ValidateGetTexParameterBase(const Context *context, ...@@ -5501,6 +5499,15 @@ bool ValidateGetTexParameterBase(const Context *context,
} }
break; break;
case GL_TEXTURE_COMPARE_MODE:
case GL_TEXTURE_COMPARE_FUNC:
if (context->getClientMajorVersion() < 3 && !context->getExtensions().shadowSamplersEXT)
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
}
break;
case GL_TEXTURE_SRGB_DECODE_EXT: case GL_TEXTURE_SRGB_DECODE_EXT:
if (!context->getExtensions().textureSRGBDecode) if (!context->getExtensions().textureSRGBDecode)
{ {
......
...@@ -65,6 +65,7 @@ angle_unittests_sources = [ ...@@ -65,6 +65,7 @@ angle_unittests_sources = [
"compiler_tests/EXT_blend_func_extended_test.cpp", "compiler_tests/EXT_blend_func_extended_test.cpp",
"compiler_tests/EXT_frag_depth_test.cpp", "compiler_tests/EXT_frag_depth_test.cpp",
"compiler_tests/EXT_shader_texture_lod_test.cpp", "compiler_tests/EXT_shader_texture_lod_test.cpp",
"compiler_tests/EXT_shadow_samplers_test.cpp",
"compiler_tests/EmulateGLBaseVertexBaseInstance_test.cpp", "compiler_tests/EmulateGLBaseVertexBaseInstance_test.cpp",
"compiler_tests/EmulateGLDrawID_test.cpp", "compiler_tests/EmulateGLDrawID_test.cpp",
"compiler_tests/EmulateGLFragColorBroadcast_test.cpp", "compiler_tests/EmulateGLFragColorBroadcast_test.cpp",
......
//
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// EXT_shadow_samplers_test.cpp:
// Test for EXT_shadow_samplers
//
#include "tests/test_utils/ShaderExtensionTest.h"
using EXTShadowSamplersTest = sh::ShaderExtensionTest;
namespace
{
const char EXTPragma[] = "#extension GL_EXT_shadow_samplers : require\n";
// Shader calling shadow2DEXT()
const char ESSL100_ShadowSamplersShader[] =
R"(
precision mediump float;
varying vec3 texCoord0v;
uniform sampler2DShadow tex;
void main()
{
float color = shadow2DEXT(tex, texCoord0v);
})";
// Extension flag is required to compile properly. Expect failure when it is
// not present.
TEST_P(EXTShadowSamplersTest, CompileFailsWithoutExtension)
{
mResources.EXT_shadow_samplers = 0;
InitializeCompiler();
EXPECT_FALSE(TestShaderCompile(EXTPragma));
}
// Extension directive is required to compile properly. Expect failure when
// it is not present.
TEST_P(EXTShadowSamplersTest, CompileFailsWithExtensionWithoutPragma)
{
mResources.EXT_shadow_samplers = 1;
InitializeCompiler();
EXPECT_FALSE(TestShaderCompile(""));
}
// With extension flag and extension directive, compiling succeeds.
// Also test that the extension directive state is reset correctly.
TEST_P(EXTShadowSamplersTest, CompileSucceedsWithExtensionAndPragma)
{
mResources.EXT_shadow_samplers = 1;
InitializeCompiler();
EXPECT_TRUE(TestShaderCompile(EXTPragma));
// Test reset functionality.
EXPECT_FALSE(TestShaderCompile(""));
EXPECT_TRUE(TestShaderCompile(EXTPragma));
}
// The SL #version 100 shaders that are correct work similarly
// in both GL2 and GL3, with and without the version string.
INSTANTIATE_TEST_SUITE_P(CorrectESSL100Shaders,
EXTShadowSamplersTest,
Combine(Values(SH_GLES2_SPEC),
Values(sh::ESSLVersion100),
Values(ESSL100_ShadowSamplersShader)));
} // anonymous namespace
\ No newline at end of file
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