Targetting SPIR-V under OpenGL + Bindless Textures


Question

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!


Background

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

@Dark_Photon did you manage to find a way? I’d like to use SPIR-V too but I have the same problem - I went heavily into sparse texture arrays & bindless textures in my renderer and my hands are tied now. I need ARB_bindless_texture support if I’m ever going to go SPIR-V :confused:

From what issue 27 says here, there is no way to use bindless textures in SPIR-V (or many other OpenGL-exclusive features).

No. SPIR-V is completely on-the-shelf at this point, in the “Interesting but not currently useful” bucket.

It sure would be helpful if Khronos or NVidia would put out an extension to support basic bindless texture for GLSL → SPIR-V, if only when targeting OpenGL (e.g. glslangValidator -G). A GDC release would be great!

…in unextended SPIR-V 1.0. (The implication of your statement as-is isn’t correct.)

It says “can’t [currently] be expressed in terms of SPIR-V 1.0 functionality … will need to have SPIR-V extensions defined to add the required functionality.” That doesn’t mean the implied extension either has not already been written or could not be written.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.

Related to SPIR-V support for true Bindless Texturing (descriptorless), I recently noticed that there’s been some interesting developments on this front in the last year. Just FYI for those that are also keeping an eye on this.

Now whether this might ever materialize as accessible to SPIR-V for OpenGL is separate issue. Currently this support appears to be oriented towards SPIR-V for Vulkan.

Extensions:

A blog post discussing this:

Related: