AnsweredAssumed Answered

driver apparently does not implement ARB_bindless_texture correctly/completely

Question asked by philippb3 on Aug 30, 2018

AMD Radeon HD 8600/8700M on my Samsung NP530U4E Laptop, "original" os Windows 8.1 installed.

Installed driver from  , "Driver version" 14.301.1001.0000

With this setup the program "OpenGL Extensions Viewer" by "realtech VR" states that the opengl extension ARB_bindless_texture  is supported.


In the extension's document ( it is stated :


      // 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.


      any sampler type(uvec2)     // Converts a pair of 32-bit unsigned integers to

                                  //   a sampler type



I tried to use ARB_bindless_texture in my own application, in the fragment shader i created a temporary sampler2DArray variable and initialized it like in the spec above:


sampler2DArray bindlessSampler = sampler2DArray(bindlessHandle);


with "bindlessHandle" being a valid texture handle (as an uvec2).


shader compilation and program linkage works without errors. Right before the draw call i perform a "glValidateProgram" and read the value with "glGetProgramiv(program, GL_VALIDATE_STATUS, ..)" and it turns out to be GL_TRUE so the validation succeeded.


However, when invoking the draw call i get a segmentation fault. On my other machine (desktop computer with a nvidia gtx980) everything works fine and the behaviour is as expected.





the crash occured due to incorrect access to the "bindlessHandle": If i understand correctly sampler* objects need to be "dynamically uniform" (see Core Language (GLSL) - OpenGL Wiki ). Unfortunately i accessed the "bindlessHandle" variable (which initialized the sampler) via a texture buffer object, which apparently is not "dynamically uniform".
Maybe this worked on my machine with a nvidia gpu because it supports the extension NV_gpu_shader5 ( Somewhere there it says:
"the ability to index into arrays of samplers, uniforms and shader

  storage blocks with arbitrary expressions, and not require that

  non-constant indices be uniform across all shader invocations."


"Arbitrary indices may be used to index a uniform block array;

  integral constant expressions are not required. If the index

  used to access an array of uniform blocks is out-of-bounds, the

  results of the access are undefined."

And maybe this did not work on my machine with a amd gpu because it did not support this extension.


So the solution in my case was to make sure to get "dynamically uniform" initialization of my bindless texture sampler. For example the simplest way is to turn the whole sampler or the texture handle into a uniform and set it via glUniform* commands from the client side. Of course this again makes the whole bindless texture extension less useful in my opinion. So i get the handle via a Uniform Buffer (instead of Texture Buffer - which apparently retains "dynamically uniform[ity]").


Nachricht geändert durch Philipp Beisel