@@ -5914,15 +5914,19 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
59145914 addSamplingFunctions (sampler, typeName, version, profile);
59155915 addGatherFunctions (sampler, typeName, version, profile);
59165916
5917- if (spvVersion.vulkan > 0 && sampler.dim == EsdBuffer && sampler.isCombined ()) {
5918- // Vulkan wants a textureBuffer to allow texelFetch() --
5919- // a sampled image with no sampler.
5920- // So, add sampling functions for both the
5921- // samplerBuffer and textureBuffer types.
5917+ if (spvVersion.vulkan > 0 && sampler.isCombined () && !sampler.shadow ) {
5918+ // Base Vulkan allows texelFetch() for
5919+ // textureBuffer (i.e. without sampler).
5920+ //
5921+ // GL_EXT_samplerless_texture_functions
5922+ // allows texelFetch() and query functions
5923+ // (other than textureQueryLod()) for all
5924+ // texture types.
59225925 sampler.setTexture (sampler.type , sampler.dim , sampler.arrayed , sampler.shadow ,
59235926 sampler.ms );
59245927 TString textureTypeName = sampler.getString ();
59255928 addSamplingFunctions (sampler, textureTypeName, version, profile);
5929+ addQueryFunctions (sampler, textureTypeName, version, profile);
59265930 }
59275931 }
59285932 }
@@ -5995,7 +5999,7 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int
59955999 // textureQueryLod(), fragment stage only
59966000 //
59976001
5998- if (profile != EEsProfile && version >= 400 && ! sampler.image && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) {
6002+ if (profile != EEsProfile && version >= 400 && sampler.combined && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) {
59996003#ifdef AMD_EXTENSIONS
60006004 for (int f16TexAddr = 0 ; f16TexAddr < 2 ; ++f16TexAddr) {
60016005 if (f16TexAddr && sampler.type != EbtFloat16)
@@ -6200,12 +6204,12 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
62006204 //
62016205 for (int proj = 0 ; proj <= 1 ; ++proj) { // loop over "bool" projective or not
62026206
6203- if (proj && (sampler.dim == EsdCube || sampler.dim == EsdBuffer || sampler.arrayed || sampler.ms ))
6207+ if (proj && (sampler.dim == EsdCube || sampler.dim == EsdBuffer || sampler.arrayed || sampler.ms || !sampler. combined ))
62046208 continue ;
62056209
62066210 for (int lod = 0 ; lod <= 1 ; ++lod) {
62076211
6208- if (lod && (sampler.dim == EsdBuffer || sampler.dim == EsdRect || sampler.ms ))
6212+ if (lod && (sampler.dim == EsdBuffer || sampler.dim == EsdRect || sampler.ms || !sampler. combined ))
62096213 continue ;
62106214 if (lod && sampler.dim == Esd2D && sampler.arrayed && sampler.shadow )
62116215 continue ;
@@ -6214,7 +6218,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
62146218
62156219 for (int bias = 0 ; bias <= 1 ; ++bias) {
62166220
6217- if (bias && (lod || sampler.ms ))
6221+ if (bias && (lod || sampler.ms || !sampler. combined ))
62186222 continue ;
62196223 if (bias && (sampler.dim == Esd2D || sampler.dim == EsdCube) && sampler.shadow && sampler.arrayed )
62206224 continue ;
@@ -6236,12 +6240,12 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
62366240 continue ;
62376241 if (fetch && (sampler.shadow || sampler.dim == EsdCube))
62386242 continue ;
6239- if (fetch == 0 && (sampler.ms || sampler.dim == EsdBuffer))
6243+ if (fetch == 0 && (sampler.ms || sampler.dim == EsdBuffer || !sampler. combined ))
62406244 continue ;
62416245
62426246 for (int grad = 0 ; grad <= 1 ; ++grad) { // loop over "bool" grad or not
62436247
6244- if (grad && (lod || bias || sampler.ms ))
6248+ if (grad && (lod || bias || sampler.ms || !sampler. combined ))
62456249 continue ;
62466250 if (grad && sampler.dim == EsdBuffer)
62476251 continue ;
@@ -6263,7 +6267,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
62636267
62646268 if (extraProj && ! proj)
62656269 continue ;
6266- if (extraProj && (sampler.dim == Esd3D || sampler.shadow ))
6270+ if (extraProj && (sampler.dim == Esd3D || sampler.shadow || !sampler. combined ))
62676271 continue ;
62686272#ifdef AMD_EXTENSIONS
62696273 for (int f16TexAddr = 0 ; f16TexAddr <= 1 ; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing
0 commit comments