Targetting SPIR-V under OpenGL + Bindless Textures



Is there really no support in SPIR-V (including extensions) for even basic OpenGL bindless texturing (ARB_bindless_texture)?

Just supporting sampler2D( uvec2 ) constructors would be enough for my needs.

If I’m missing something here (and I seriously hope I am), please do point it out!


Before you even start, yes I’ve read the discussions that suggest Vulkan doesn’t need this because it supports dynamic indexing of large arrays of samplers via descriptor indexing.

However, I find myself converting some shader infrastructure code within an OpenGL engine. I would like to set this up so it’s as “Vulkan-ready” as possible. So, targeting a GLSL -> SPIR-V -> GL Driver shader path makes sense.

I’ve done some test shader conversions, determined the GLSL subset to use which works well with SPIR-V compilers (when targeting either OpenGL or Vulkan), and I find that all of the features I need seem to be supported in SPIR-V …

except bindless textures. And that’s a make-or-break issue. I can’t afford to lose support for those.

As I said, if SPIR-V only supported sampler2D( uvec2 ) constructors, that’d be enough. I don’t need most of the extension.

So I find myself being forced away from the SPIR-V “Vulkan-ready” shading path I’d prefer:

  • GLSL -> SPIR-V -> GL Driver

to instead target a legacy shading path:

  • GLSL -> GL Driver Native

just because SPIR-V doesn’t (or at least appears not to) support even basic OpenGL bindless texturing.

Is there some extension that provides what I’m looking for that I don’t know about? If so, please do point it out! Thanks!

ARB_bindless_texture: Section on uvec2 -> sampler conversion in GLSL

    Modify Section 5.4.1, Conversion and Scalar Constructors, p. 60

    (add the following constructors:)

      // In the following four constructors, the low 32 bits of the sampler
      // type correspond to the .x component of the uvec2 and the high 32 bits
      // correspond to the .y component.
      uvec2(any sampler type)     // Converts a sampler type to a
                                  //   pair of 32-bit unsigned integers
      any sampler type(uvec2)     // Converts a pair of 32-bit unsigned integers to
                                  //   a sampler type
      uvec2(any image type)       // Converts an image type to a
                                  //   pair of 32-bit unsigned integers
      any image type(uvec2)       // Converts a pair of 32-bit unsigned integers to
                                  //   an image type