diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index b1e510b5aefb4347f7af865591677f74f80e650b..fbd2281d67e753b0c6fe1541c72cca44e14dc91b 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1333,6 +1333,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod "vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod + "float shadow2DEXT(sampler2DShadow, vec3);" // GL_EXT_shadow_samplers + "float shadow2DProjEXT(sampler2DShadow, vec4);" // GL_EXT_shadow_samplers + "\n"); } } @@ -5324,6 +5327,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable); } + if (profile == EEsProfile) { + symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers); + symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers); + } + // Fall through case EShLangTessControl: @@ -5661,6 +5669,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview); BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); + + if (profile == EEsProfile) { + symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers); + symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers); + } break; case EShLangCompute: @@ -6048,6 +6061,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("sparseTextureGatherLodOffsetsAMD", EOpSparseTextureGatherLodOffsets); #endif } + if (profile == EEsProfile) { + symbolTable.relateToOperator("shadow2DEXT", EOpTexture); + symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj); + } } switch(language) { diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp index 3f2f40aaf3907a49ac1a2141fce3531f6ec93fed..096d34e4ca4b58cc6d7a459ed6b2ea5de2c8d6af 100644 --- a/glslang/MachineIndependent/Scan.cpp +++ b/glslang/MachineIndependent/Scan.cpp @@ -1113,8 +1113,10 @@ int TScanContext::tokenizeIdentifier() case SAMPLER2DSHADOW: afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version < 300) - reservedWord(); + if (parseContext.profile == EEsProfile && parseContext.version < 300) { + if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers)) + reservedWord(); + } return keyword; case SAMPLER2DRECT: diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 800956c934132dcfbd6cfbb6843e1e7b77d94d0b..8f1c5dba821ca440cc0bd9472a11e338427c9456 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -155,7 +155,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_frag_depth] = EBhDisable; extensionBehavior[E_GL_OES_EGL_image_external] = EBhDisable; extensionBehavior[E_GL_EXT_shader_texture_lod] = EBhDisable; - + extensionBehavior[E_GL_EXT_shadow_samplers] = EBhDisable; extensionBehavior[E_GL_ARB_texture_rectangle] = EBhDisable; extensionBehavior[E_GL_3DL_array_objects] = EBhDisable; extensionBehavior[E_GL_ARB_shading_language_420pack] = EBhDisable; @@ -253,6 +253,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_frag_depth 1\n" "#define GL_OES_EGL_image_external 1\n" "#define GL_EXT_shader_texture_lod 1\n" + "#define GL_EXT_shadow_samplers 1\n" // AEP "#define GL_ANDROID_extension_pack_es31a 1\n" diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 702a5ae58dd0739f64c37435e306f0e5ee74feb8..f1d7e9ed48dd933d42303e68f872eafb8a2cd570 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -103,6 +103,7 @@ const char* const E_GL_OES_standard_derivatives = "GL_OES_standard_deriv const char* const E_GL_EXT_frag_depth = "GL_EXT_frag_depth"; const char* const E_GL_OES_EGL_image_external = "GL_OES_EGL_image_external"; const char* const E_GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod"; +const char* const E_GL_EXT_shadow_samplers = "GL_EXT_shadow_samplers"; const char* const E_GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle"; const char* const E_GL_3DL_array_objects = "GL_3DL_array_objects";