<p>The specification defines <code>GL_MAX_TEXTURE_IMAGE_UNITS</code> as:</p>
<blockquote>
<p>The maximum number of texture image units available to [the fragment shader]</p>
</blockquote>
<p>Texture image units are locations in the OpenGL context to which you bind textures for use by shaders.</p>
<p>Bindless texture, as the name suggests, does not involve binding textures to texture image units. As such, <a href="https://registry.khronos.org/OpenGL/extensions/ARB/ARB_bindless_texture.txt" rel="nofollow noreferrer">they do not count against this limit</a>:</p>
<blockquote>
<p>Sampler uniforms specified using handles do not count as using any texture image unit, even if a texture referred to by a handle is currently bound to one or more texture image units.</p>
</blockquote>

CC BY-SA 4.0
2022-11-28T15:37:14.437Z
What confused me is that in case of uniform block this is as expected but in the case of uniform array of samplers and setting uniform handles using `glUniformHandleui64ARB` the same error results.
mdkdy
CC BY-SA 4.0
2022-11-29T13:07:40.170Z
I assume this is driver issue.
mdkdy
CC BY-SA 4.0
2022-11-28T15:15:40.947Z
2022-11-28T15:15:40.947Z
Nicol Bolas
<p>When I have an array of samplers, for example:</p>
<pre><code>uniform sampler3D RHToBounceGridR[MULTI_BOUNCES_NUM];
</code></pre>
<p>where <code>MULTI_BOUNCES_NUM</code> is bigger than <code>GL_MAX_TEXTURE_IMAGE_UNITS</code> value, I get <code>INVALID_OPERATION</code> when dispatching the shader.</p>
<p>If I use Uniform block with bindless textures (handles)</p>
<pre><code>layout (std140, binding = 0) uniform SamplersBuffer
{
    sampler3D samplers[MULTI_BOUNCES_NUM];
};
</code></pre>
<p>Or just uniforms</p>
<pre><code>layout(bindless_sampler) uniform sampler3D RHToBounceGridR[MULTI_BOUNCES_NUM];
</code></pre>
<p>Does it overcome this limitation?</p>

<opengl><texture>
Do bindless textures overcome the limit of GL_MAX_TEXTURE_IMAGE_UNITS?
mdkdy
# Do bindless textures overcome the limit of GL_MAX_TEXTURE_IMAGE_UNITS?

(Asked by: username_0 on 2022-11-28)

When I have an array of samplers, for example:

```
uniform sampler3D RHToBounceGridR[MULTI_BOUNCES_NUM];

```

where `MULTI_BOUNCES_NUM` is bigger than `GL_MAX_TEXTURE_IMAGE_UNITS` value, I get `INVALID_OPERATION` when dispatching the shader.

If I use Uniform block with bindless textures (handles)

```
layout (std140, binding = 0) uniform SamplersBuffer
{
    sampler3D samplers[MULTI_BOUNCES_NUM];
};

```

Or just uniforms

```
layout(bindless_sampler) uniform sampler3D RHToBounceGridR[MULTI_BOUNCES_NUM];

```

Does it overcome this limitation?

**Tags:** opengl, texture


---

## 1 answers

### Answer by username_1 on 2022-11-28. Score: 1 | Accepted answer

The specification defines `GL_MAX_TEXTURE_IMAGE_UNITS` as:

> The maximum number of texture image units available to [the fragment shader]

Texture image units are locations in the OpenGL context to which you bind textures for use by shaders.

Bindless texture, as the name suggests, does not involve binding textures to texture image units. As such, [they do not count against this limit](https://registry.khronos.org/OpenGL/extensions/ARB/ARB_bindless_texture.txt):

> Sampler uniforms specified using handles do not count as using any texture image unit, even if a texture referred to by a handle is currently bound to one or more texture image units.

> **Comments:**
> **username_0**: What confused me is that in case of uniform block this is as expected but in the case of uniform array of samplers and setting uniform handles using `glUniformHandleui64ARB` the same error results.  
> **username_0**: I assume this is driver issue.  

---

