diff --git a/Install/Windows/glslangValidator.exe b/Install/Windows/glslangValidator.exe index 1d66f7ae5ca3707214eb65e3bb7a581a1754e7e3..905b9decd8a43a0cb9091e3e4289ad600aee00c2 100644 Binary files a/Install/Windows/glslangValidator.exe and b/Install/Windows/glslangValidator.exe differ diff --git a/Test/100.frag b/Test/100.frag index 9daa0267e7f5e8946d97fb88d23f9034ee32c4bf..abe3ed12a793deccf3221650f1a7c4f35608540f 100644 --- a/Test/100.frag +++ b/Test/100.frag @@ -140,13 +140,27 @@ void foo246() } #extension GL_OES_EGL_image_external : disable +uniform sampler2D s2Dg; int foo203940(int a, float b, float a) // ERROR, a redefined { + texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2); // ERROR, extension not enabled return a; } float f123 = 4.0f; // ERROR float f124 = 5e10F; // ERROR +#extension GL_EXT_shader_texture_lod : enable + +uniform samplerCube sCube; + +void foo323433() +{ + texture2DLodEXT(s2Dg, uv2, f13); + texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2); + texture2DGradEXT(s2Dg, uv2, uv2, uv2); + textureCubeGradEXT(sCube, vec3(f13), vec3(f13), vec3(f13)); +} + uniform samplerExternalOES badExt; // syntax ERROR diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index be3726fc24998135456c53f304c5fca50b2454ce..d3182397011e52241e22ef1f94257f63f9d74611 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -43,9 +43,9 @@ // TBuiltIns::initialize(version,profile) context-independent textual built-ins; add them to the right string // TBuiltIns::initialize(resources,...) context-dependent textual built-ins; add them to the right string // IdentifyBuiltIns(...,symbolTable) context-independent programmatic additions/mappings to the symbol table, -// including identify what extensions are needed if a version does not allow a symbol +// including identifying what extensions are needed if a version does not allow a symbol // IdentifyBuiltIns(...,symbolTable, resources) context-dependent programmatic additions/mappings to the symbol table, -// including identify what extensions are needed if a version does not allow a symbol +// including identifying what extensions are needed if a version does not allow a symbol // #include "../Include/intermediate.h" @@ -648,7 +648,7 @@ void TBuiltIns::initialize(int version, EProfile profile) } // - // Original-style texture functions existing in both stages. + // Original-style texture functions existing in all stages. // (Per-stage functions below.) // if ((profile == EEsProfile && version == 100) || @@ -686,12 +686,16 @@ void TBuiltIns::initialize(int version, EProfile profile) "\n"); } - if (profile == EEsProfile) { - // GL_OES_EGL_image_external, caught by keyword check + if (profile == EEsProfile) { commonBuiltins.append( - "vec4 texture2D(samplerExternalOES, vec2 coord);" - "vec4 texture2DProj(samplerExternalOES, vec3);" - "vec4 texture2DProj(samplerExternalOES, vec4);" + "vec4 texture2D(samplerExternalOES, vec2 coord);" // GL_OES_EGL_image_external, caught by keyword check + "vec4 texture2DProj(samplerExternalOES, vec3);" // GL_OES_EGL_image_external, caught by keyword check + "vec4 texture2DProj(samplerExternalOES, vec4);" // GL_OES_EGL_image_external, caught by keyword check + "vec4 texture2DGradEXT(sampler2D, vec2, vec2, vec2);" // GL_EXT_shader_texture_lod + "vec4 texture2DProjGradEXT(sampler2D, vec3, vec2, vec2);" // GL_EXT_shader_texture_lod + "vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod + "vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod + "\n"); } @@ -857,6 +861,15 @@ void TBuiltIns::initialize(int version, EProfile profile) "\n"); } + if (profile == EEsProfile) { + stageBuiltins[EShLangFragment].append( + "vec4 texture2DLodEXT(sampler2D, vec2, float);" // GL_EXT_shader_texture_lod + "vec4 texture2DProjLodEXT(sampler2D, vec3, float);" // GL_EXT_shader_texture_lod + "vec4 texture2DProjLodEXT(sampler2D, vec4, float);" // GL_EXT_shader_texture_lod + "vec4 textureCubeLodEXT(samplerCube, vec3, float);" // GL_EXT_shader_texture_lod + + "\n"); + } stageBuiltins[EShLangFragment].append( "float dFdx(float p);" @@ -2161,6 +2174,11 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb symbolTable.setFunctionExtensions("dFdy", 1, &GL_OES_standard_derivatives); symbolTable.setFunctionExtensions("fwidth", 1, &GL_OES_standard_derivatives); } + if (profile == EEsProfile) { + symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &GL_EXT_shader_texture_lod); + } symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &GL_EXT_frag_depth); break; @@ -2173,9 +2191,15 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb break; } + if (profile == EEsProfile) { + symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &GL_EXT_shader_texture_lod); + } + // - // Next, identify which built-ins from the already loaded headers have - // a mapping to an operator. Those that are not identified as such are + // Next, identify which built-ins have a mapping to an operator. + // Those that are not identified as such are // expected to be resolved through a library of functions, versus as // operations. // diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index c86d4f3782e1cd6f77152289550ee4718f892509..36aa1514186217da1ec0a51919699a8980535a41 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -153,6 +153,7 @@ void TParseContext::initializeExtensionBehavior() extensionBehavior[GL_OES_standard_derivatives] = EBhDisable; extensionBehavior[GL_EXT_frag_depth] = EBhDisable; extensionBehavior[GL_OES_EGL_image_external] = EBhDisable; + extensionBehavior[GL_EXT_shader_texture_lod] = EBhDisable; extensionBehavior[GL_ARB_texture_rectangle] = EBhDisable; extensionBehavior[GL_3DL_array_objects] = EBhDisable; @@ -171,7 +172,8 @@ const char* TParseContext::getPreamble() "#define GL_OES_texture_3D 1\n" "#define GL_OES_standard_derivatives 1\n" "#define GL_EXT_frag_depth 1\n" - "#define GL_OES_EGL_image_external 1\n"; + "#define GL_OES_EGL_image_external 1\n" + "#define GL_EXT_shader_texture_lod 1\n"; } else { return "#define GL_FRAGMENT_PRECISION_HIGH 1\n" diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 0580cc96826d50f4bacd50464bc7f24b6437f301..3c8619d0fa016df6f6845e9ded0f82cedcee9f58 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -76,6 +76,7 @@ const char* const GL_OES_texture_3D = "GL_OES_texture_3D"; const char* const GL_OES_standard_derivatives = "GL_OES_standard_derivatives"; const char* const GL_EXT_frag_depth = "GL_EXT_frag_depth"; const char* const GL_OES_EGL_image_external = "GL_OES_EGL_image_external"; +const char* const GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod"; const char* const GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle"; const char* const GL_3DL_array_objects = "GL_3DL_array_objects";