2 * Copyright 2013 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * Francisco Jerez <currojerez@riseup.net>
29 #include "shaderimage.h"
40 _mesa_get_shader_image_format(GLenum format
)
44 return MESA_FORMAT_RGBA_FLOAT32
;
47 return MESA_FORMAT_RGBA_FLOAT16
;
50 return MESA_FORMAT_RG_FLOAT32
;
53 return MESA_FORMAT_RG_FLOAT16
;
55 case GL_R11F_G11F_B10F
:
56 return MESA_FORMAT_R11G11B10_FLOAT
;
59 return MESA_FORMAT_R_FLOAT32
;
62 return MESA_FORMAT_R_FLOAT16
;
65 return MESA_FORMAT_RGBA_UINT32
;
68 return MESA_FORMAT_RGBA_UINT16
;
71 return MESA_FORMAT_R10G10B10A2_UINT
;
74 return MESA_FORMAT_RGBA_UINT8
;
77 return MESA_FORMAT_RG_UINT32
;
80 return MESA_FORMAT_RG_UINT16
;
83 return MESA_FORMAT_RG_UINT8
;
86 return MESA_FORMAT_R_UINT32
;
89 return MESA_FORMAT_R_UINT16
;
92 return MESA_FORMAT_R_UINT8
;
95 return MESA_FORMAT_RGBA_SINT32
;
98 return MESA_FORMAT_RGBA_SINT16
;
101 return MESA_FORMAT_RGBA_SINT8
;
104 return MESA_FORMAT_RG_SINT32
;
107 return MESA_FORMAT_RG_SINT16
;
110 return MESA_FORMAT_RG_SINT8
;
113 return MESA_FORMAT_R_SINT32
;
116 return MESA_FORMAT_R_SINT16
;
119 return MESA_FORMAT_R_SINT8
;
122 return MESA_FORMAT_RGBA_UNORM16
;
125 return MESA_FORMAT_R10G10B10A2_UNORM
;
128 return MESA_FORMAT_RGBA_UNORM8
;
131 return MESA_FORMAT_RG_UNORM16
;
134 return MESA_FORMAT_RG_UNORM8
;
137 return MESA_FORMAT_R_UNORM16
;
140 return MESA_FORMAT_R_UNORM8
;
142 case GL_RGBA16_SNORM
:
143 return MESA_FORMAT_RGBA_SNORM16
;
146 return MESA_FORMAT_RGBA_SNORM8
;
149 return MESA_FORMAT_RG_SNORM16
;
152 return MESA_FORMAT_RG_SNORM8
;
155 return MESA_FORMAT_R_SNORM16
;
158 return MESA_FORMAT_R_SNORM8
;
161 return MESA_FORMAT_NONE
;
165 enum image_format_class
167 /** Not a valid image format. */
168 IMAGE_FORMAT_CLASS_NONE
= 0,
170 /** Classes of image formats you can cast into each other. */
172 IMAGE_FORMAT_CLASS_1X8
,
173 IMAGE_FORMAT_CLASS_1X16
,
174 IMAGE_FORMAT_CLASS_1X32
,
175 IMAGE_FORMAT_CLASS_2X8
,
176 IMAGE_FORMAT_CLASS_2X16
,
177 IMAGE_FORMAT_CLASS_2X32
,
178 IMAGE_FORMAT_CLASS_10_11_11
,
179 IMAGE_FORMAT_CLASS_4X8
,
180 IMAGE_FORMAT_CLASS_4X16
,
181 IMAGE_FORMAT_CLASS_4X32
,
182 IMAGE_FORMAT_CLASS_2_10_10_10
186 static enum image_format_class
187 get_image_format_class(mesa_format format
)
190 case MESA_FORMAT_RGBA_FLOAT32
:
191 return IMAGE_FORMAT_CLASS_4X32
;
193 case MESA_FORMAT_RGBA_FLOAT16
:
194 return IMAGE_FORMAT_CLASS_4X16
;
196 case MESA_FORMAT_RG_FLOAT32
:
197 return IMAGE_FORMAT_CLASS_2X32
;
199 case MESA_FORMAT_RG_FLOAT16
:
200 return IMAGE_FORMAT_CLASS_2X16
;
202 case MESA_FORMAT_R11G11B10_FLOAT
:
203 return IMAGE_FORMAT_CLASS_10_11_11
;
205 case MESA_FORMAT_R_FLOAT32
:
206 return IMAGE_FORMAT_CLASS_1X32
;
208 case MESA_FORMAT_R_FLOAT16
:
209 return IMAGE_FORMAT_CLASS_1X16
;
211 case MESA_FORMAT_RGBA_UINT32
:
212 return IMAGE_FORMAT_CLASS_4X32
;
214 case MESA_FORMAT_RGBA_UINT16
:
215 return IMAGE_FORMAT_CLASS_4X16
;
217 case MESA_FORMAT_R10G10B10A2_UINT
:
218 return IMAGE_FORMAT_CLASS_2_10_10_10
;
220 case MESA_FORMAT_RGBA_UINT8
:
221 return IMAGE_FORMAT_CLASS_4X8
;
223 case MESA_FORMAT_RG_UINT32
:
224 return IMAGE_FORMAT_CLASS_2X32
;
226 case MESA_FORMAT_RG_UINT16
:
227 return IMAGE_FORMAT_CLASS_2X16
;
229 case MESA_FORMAT_RG_UINT8
:
230 return IMAGE_FORMAT_CLASS_2X8
;
232 case MESA_FORMAT_R_UINT32
:
233 return IMAGE_FORMAT_CLASS_1X32
;
235 case MESA_FORMAT_R_UINT16
:
236 return IMAGE_FORMAT_CLASS_1X16
;
238 case MESA_FORMAT_R_UINT8
:
239 return IMAGE_FORMAT_CLASS_1X8
;
241 case MESA_FORMAT_RGBA_SINT32
:
242 return IMAGE_FORMAT_CLASS_4X32
;
244 case MESA_FORMAT_RGBA_SINT16
:
245 return IMAGE_FORMAT_CLASS_4X16
;
247 case MESA_FORMAT_RGBA_SINT8
:
248 return IMAGE_FORMAT_CLASS_4X8
;
250 case MESA_FORMAT_RG_SINT32
:
251 return IMAGE_FORMAT_CLASS_2X32
;
253 case MESA_FORMAT_RG_SINT16
:
254 return IMAGE_FORMAT_CLASS_2X16
;
256 case MESA_FORMAT_RG_SINT8
:
257 return IMAGE_FORMAT_CLASS_2X8
;
259 case MESA_FORMAT_R_SINT32
:
260 return IMAGE_FORMAT_CLASS_1X32
;
262 case MESA_FORMAT_R_SINT16
:
263 return IMAGE_FORMAT_CLASS_1X16
;
265 case MESA_FORMAT_R_SINT8
:
266 return IMAGE_FORMAT_CLASS_1X8
;
268 case MESA_FORMAT_RGBA_UNORM16
:
269 return IMAGE_FORMAT_CLASS_4X16
;
271 case MESA_FORMAT_R10G10B10A2_UNORM
:
272 return IMAGE_FORMAT_CLASS_2_10_10_10
;
274 case MESA_FORMAT_RGBA_UNORM8
:
275 return IMAGE_FORMAT_CLASS_4X8
;
277 case MESA_FORMAT_RG_UNORM16
:
278 return IMAGE_FORMAT_CLASS_2X16
;
280 case MESA_FORMAT_RG_UNORM8
:
281 return IMAGE_FORMAT_CLASS_2X8
;
283 case MESA_FORMAT_R_UNORM16
:
284 return IMAGE_FORMAT_CLASS_1X16
;
286 case MESA_FORMAT_R_UNORM8
:
287 return IMAGE_FORMAT_CLASS_1X8
;
289 case MESA_FORMAT_RGBA_SNORM16
:
290 return IMAGE_FORMAT_CLASS_4X16
;
292 case MESA_FORMAT_RGBA_SNORM8
:
293 return IMAGE_FORMAT_CLASS_4X8
;
295 case MESA_FORMAT_RG_SNORM16
:
296 return IMAGE_FORMAT_CLASS_2X16
;
298 case MESA_FORMAT_RG_SNORM8
:
299 return IMAGE_FORMAT_CLASS_2X8
;
301 case MESA_FORMAT_R_SNORM16
:
302 return IMAGE_FORMAT_CLASS_1X16
;
304 case MESA_FORMAT_R_SNORM8
:
305 return IMAGE_FORMAT_CLASS_1X8
;
308 return IMAGE_FORMAT_CLASS_NONE
;
313 _image_format_class_to_glenum(enum image_format_class
class)
316 case IMAGE_FORMAT_CLASS_NONE
:
318 case IMAGE_FORMAT_CLASS_1X8
:
319 return GL_IMAGE_CLASS_1_X_8
;
320 case IMAGE_FORMAT_CLASS_1X16
:
321 return GL_IMAGE_CLASS_1_X_16
;
322 case IMAGE_FORMAT_CLASS_1X32
:
323 return GL_IMAGE_CLASS_1_X_32
;
324 case IMAGE_FORMAT_CLASS_2X8
:
325 return GL_IMAGE_CLASS_2_X_8
;
326 case IMAGE_FORMAT_CLASS_2X16
:
327 return GL_IMAGE_CLASS_2_X_16
;
328 case IMAGE_FORMAT_CLASS_2X32
:
329 return GL_IMAGE_CLASS_2_X_32
;
330 case IMAGE_FORMAT_CLASS_10_11_11
:
331 return GL_IMAGE_CLASS_11_11_10
;
332 case IMAGE_FORMAT_CLASS_4X8
:
333 return GL_IMAGE_CLASS_4_X_8
;
334 case IMAGE_FORMAT_CLASS_4X16
:
335 return GL_IMAGE_CLASS_4_X_16
;
336 case IMAGE_FORMAT_CLASS_4X32
:
337 return GL_IMAGE_CLASS_4_X_32
;
338 case IMAGE_FORMAT_CLASS_2_10_10_10
:
339 return GL_IMAGE_CLASS_10_10_10_2
;
341 assert(!"Invalid image_format_class");
347 _mesa_get_image_format_class(GLenum format
)
349 mesa_format tex_format
= _mesa_get_shader_image_format(format
);
350 if (tex_format
== MESA_FORMAT_NONE
)
353 enum image_format_class
class = get_image_format_class(tex_format
);
354 return _image_format_class_to_glenum(class);
358 _mesa_is_shader_image_format_supported(const struct gl_context
*ctx
,
362 /* Formats supported on both desktop and ES GL, c.f. table 8.27 of the
363 * OpenGL ES 3.1 specification.
380 /* Formats supported on unextended desktop GL and the original
381 * ARB_shader_image_load_store extension, c.f. table 3.21 of the OpenGL 4.2
382 * specification or by GLES 3.1 with GL_NV_image_formats extension.
386 case GL_R11F_G11F_B10F
:
406 /* Formats supported on unextended desktop GL and the original
407 * ARB_shader_image_load_store extension, c.f. table 3.21 of the OpenGL 4.2
410 * Following formats are supported by GLES 3.1 with GL_NV_image_formats &
411 * GL_EXT_texture_norm16 extensions.
414 case GL_RGBA16_SNORM
:
419 return _mesa_is_desktop_gl(ctx
) || _mesa_has_EXT_texture_norm16(ctx
);
427 _mesa_default_image_unit(struct gl_context
*ctx
)
429 const GLenum format
= _mesa_is_desktop_gl(ctx
) ? GL_R8
: GL_R32UI
;
430 const struct gl_image_unit u
= {
431 .Access
= GL_READ_ONLY
,
433 ._ActualFormat
= _mesa_get_shader_image_format(format
)
439 _mesa_init_image_units(struct gl_context
*ctx
)
443 ASSERT_BITFIELD_SIZE(struct gl_image_unit
, Format
, MESA_FORMAT_COUNT
);
445 for (i
= 0; i
< ARRAY_SIZE(ctx
->ImageUnits
); ++i
)
446 ctx
->ImageUnits
[i
] = _mesa_default_image_unit(ctx
);
451 _mesa_free_image_textures(struct gl_context
*ctx
)
455 for (i
= 0; i
< ARRAY_SIZE(ctx
->ImageUnits
); ++i
)
456 _mesa_reference_texobj(&ctx
->ImageUnits
[i
].TexObj
, NULL
);
460 _mesa_is_image_unit_valid(struct gl_context
*ctx
, struct gl_image_unit
*u
)
462 struct gl_texture_object
*t
= u
->TexObj
;
463 mesa_format tex_format
;
468 if (!t
->_BaseComplete
&& !t
->_MipmapComplete
)
469 _mesa_test_texobj_completeness(ctx
, t
);
471 if (u
->Level
< t
->BaseLevel
||
472 u
->Level
> t
->_MaxLevel
||
473 (u
->Level
== t
->BaseLevel
&& !t
->_BaseComplete
) ||
474 (u
->Level
!= t
->BaseLevel
&& !t
->_MipmapComplete
))
477 if (_mesa_tex_target_is_layered(t
->Target
) &&
478 u
->_Layer
>= _mesa_get_texture_layers(t
, u
->Level
))
481 if (t
->Target
== GL_TEXTURE_BUFFER
) {
482 tex_format
= _mesa_get_shader_image_format(t
->BufferObjectFormat
);
485 struct gl_texture_image
*img
= (t
->Target
== GL_TEXTURE_CUBE_MAP
?
486 t
->Image
[u
->_Layer
][u
->Level
] :
487 t
->Image
[0][u
->Level
]);
489 if (!img
|| img
->Border
|| img
->NumSamples
> ctx
->Const
.MaxImageSamples
)
492 tex_format
= _mesa_get_shader_image_format(img
->InternalFormat
);
498 switch (t
->ImageFormatCompatibilityType
) {
499 case GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE
:
500 if (_mesa_get_format_bytes(tex_format
) !=
501 _mesa_get_format_bytes(u
->_ActualFormat
))
505 case GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS
:
506 if (get_image_format_class(tex_format
) !=
507 get_image_format_class(u
->_ActualFormat
))
512 assert(!"Unexpected image format compatibility type");
519 validate_bind_image_texture(struct gl_context
*ctx
, GLuint unit
,
520 GLuint texture
, GLint level
, GLint layer
,
521 GLenum access
, GLenum format
, bool check_level_layer
)
523 assert(ctx
->Const
.MaxImageUnits
<= MAX_IMAGE_UNITS
);
525 if (unit
>= ctx
->Const
.MaxImageUnits
) {
526 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(unit)");
530 if (check_level_layer
) {
531 /* EXT_shader_image_load_store doesn't throw an error if level or
535 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(level)");
540 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(layer)");
545 if (access
!= GL_READ_ONLY
&&
546 access
!= GL_WRITE_ONLY
&&
547 access
!= GL_READ_WRITE
) {
548 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(access)");
552 if (!_mesa_is_shader_image_format_supported(ctx
, format
)) {
553 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(format)");
561 set_image_binding(struct gl_image_unit
*u
, struct gl_texture_object
*texObj
,
562 GLint level
, GLboolean layered
, GLint layer
, GLenum access
,
568 u
->_ActualFormat
= _mesa_get_shader_image_format(format
);
570 if (texObj
&& _mesa_tex_target_is_layered(texObj
->Target
)) {
571 u
->Layered
= layered
;
574 u
->Layered
= GL_FALSE
;
577 u
->_Layer
= (u
->Layered
? 0 : u
->Layer
);
579 _mesa_reference_texobj(&u
->TexObj
, texObj
);
583 bind_image_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
,
584 GLuint unit
, GLint level
, GLboolean layered
, GLint layer
,
585 GLenum access
, GLenum format
)
587 struct gl_image_unit
*u
;
589 u
= &ctx
->ImageUnits
[unit
];
591 FLUSH_VERTICES(ctx
, 0);
592 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewImageUnits
;
594 set_image_binding(u
, texObj
, level
, layered
, layer
, access
, format
);
598 _mesa_BindImageTexture_no_error(GLuint unit
, GLuint texture
, GLint level
,
599 GLboolean layered
, GLint layer
, GLenum access
,
602 struct gl_texture_object
*texObj
= NULL
;
604 GET_CURRENT_CONTEXT(ctx
);
607 texObj
= _mesa_lookup_texture(ctx
, texture
);
609 bind_image_texture(ctx
, texObj
, unit
, level
, layered
, layer
, access
, format
);
613 _mesa_BindImageTexture(GLuint unit
, GLuint texture
, GLint level
,
614 GLboolean layered
, GLint layer
, GLenum access
,
617 struct gl_texture_object
*texObj
= NULL
;
619 GET_CURRENT_CONTEXT(ctx
);
621 if (!validate_bind_image_texture(ctx
, unit
, texture
, level
, layer
, access
,
626 texObj
= _mesa_lookup_texture(ctx
, texture
);
629 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(texture)");
633 /* From section 8.22 "Texture Image Loads and Stores" of the OpenGL ES
636 * "An INVALID_OPERATION error is generated if texture is not the name
637 * of an immutable texture object."
639 * However note that issue 7 of the GL_OES_texture_buffer spec
640 * recognizes that there is no way to create immutable buffer textures,
641 * so those are excluded from this requirement.
643 * Additionally, issue 10 of the OES_EGL_image_external_essl3 spec
644 * states that glBindImageTexture must accept external textures.
646 if (_mesa_is_gles(ctx
) && !texObj
->Immutable
&&
647 texObj
->Target
!= GL_TEXTURE_BUFFER
&&
648 texObj
->Target
!= GL_TEXTURE_EXTERNAL_OES
) {
649 _mesa_error(ctx
, GL_INVALID_OPERATION
,
650 "glBindImageTexture(!immutable)");
655 bind_image_texture(ctx
, texObj
, unit
, level
, layered
, layer
, access
, format
);
659 _mesa_BindImageTextureEXT(GLuint index
, GLuint texture
, GLint level
,
660 GLboolean layered
, GLint layer
, GLenum access
,
663 struct gl_texture_object
*texObj
= NULL
;
665 GET_CURRENT_CONTEXT(ctx
);
667 if (!validate_bind_image_texture(ctx
, index
, texture
, level
, layer
, access
,
672 texObj
= _mesa_lookup_texture(ctx
, texture
);
675 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTextureEXT(texture)");
680 bind_image_texture(ctx
, texObj
, index
, level
, layered
, layer
, access
, format
);
683 static ALWAYS_INLINE
void
684 bind_image_textures(struct gl_context
*ctx
, GLuint first
, GLuint count
,
685 const GLuint
*textures
, bool no_error
)
689 /* Assume that at least one binding will be changed */
690 FLUSH_VERTICES(ctx
, 0);
691 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewImageUnits
;
693 /* Note that the error semantics for multi-bind commands differ from
694 * those of other GL commands.
696 * The Issues section in the ARB_multi_bind spec says:
698 * "(11) Typically, OpenGL specifies that if an error is generated by
699 * a command, that command has no effect. This is somewhat
700 * unfortunate for multi-bind commands, because it would require
701 * a first pass to scan the entire list of bound objects for
702 * errors and then a second pass to actually perform the
703 * bindings. Should we have different error semantics?
705 * RESOLVED: Yes. In this specification, when the parameters for
706 * one of the <count> binding points are invalid, that binding
707 * point is not updated and an error will be generated. However,
708 * other binding points in the same command will be updated if
709 * their parameters are valid and no other error occurs."
712 _mesa_HashLockMutex(ctx
->Shared
->TexObjects
);
714 for (i
= 0; i
< count
; i
++) {
715 struct gl_image_unit
*u
= &ctx
->ImageUnits
[first
+ i
];
716 const GLuint texture
= textures
? textures
[i
] : 0;
719 struct gl_texture_object
*texObj
= u
->TexObj
;
722 if (!texObj
|| texObj
->Name
!= texture
) {
723 texObj
= _mesa_lookup_texture_locked(ctx
, texture
);
724 if (!no_error
&& !texObj
) {
725 /* The ARB_multi_bind spec says:
727 * "An INVALID_OPERATION error is generated if any value
728 * in <textures> is not zero or the name of an existing
729 * texture object (per binding)."
731 _mesa_error(ctx
, GL_INVALID_OPERATION
,
732 "glBindImageTextures(textures[%d]=%u "
733 "is not zero or the name of an existing texture "
734 "object)", i
, texture
);
739 if (texObj
->Target
== GL_TEXTURE_BUFFER
) {
740 tex_format
= texObj
->BufferObjectFormat
;
742 struct gl_texture_image
*image
= texObj
->Image
[0][0];
744 if (!no_error
&& (!image
|| image
->Width
== 0 ||
745 image
->Height
== 0 || image
->Depth
== 0)) {
746 /* The ARB_multi_bind spec says:
748 * "An INVALID_OPERATION error is generated if the width,
749 * height, or depth of the level zero texture image of
750 * any texture in <textures> is zero (per binding)."
752 _mesa_error(ctx
, GL_INVALID_OPERATION
,
753 "glBindImageTextures(the width, height or depth "
754 "of the level zero texture image of "
755 "textures[%d]=%u is zero)", i
, texture
);
759 tex_format
= image
->InternalFormat
;
763 !_mesa_is_shader_image_format_supported(ctx
, tex_format
)) {
764 /* The ARB_multi_bind spec says:
766 * "An INVALID_OPERATION error is generated if the internal
767 * format of the level zero texture image of any texture
768 * in <textures> is not found in table 8.33 (per binding)."
770 _mesa_error(ctx
, GL_INVALID_OPERATION
,
771 "glBindImageTextures(the internal format %s of "
772 "the level zero texture image of textures[%d]=%u "
774 _mesa_enum_to_string(tex_format
),
779 /* Update the texture binding */
780 set_image_binding(u
, texObj
, 0,
781 _mesa_tex_target_is_layered(texObj
->Target
),
782 0, GL_READ_WRITE
, tex_format
);
784 /* Unbind the texture from the unit */
785 set_image_binding(u
, NULL
, 0, GL_FALSE
, 0, GL_READ_ONLY
, GL_R8
);
789 _mesa_HashUnlockMutex(ctx
->Shared
->TexObjects
);
793 _mesa_BindImageTextures_no_error(GLuint first
, GLsizei count
,
794 const GLuint
*textures
)
796 GET_CURRENT_CONTEXT(ctx
);
798 bind_image_textures(ctx
, first
, count
, textures
, true);
802 _mesa_BindImageTextures(GLuint first
, GLsizei count
, const GLuint
*textures
)
804 GET_CURRENT_CONTEXT(ctx
);
806 if (!ctx
->Extensions
.ARB_shader_image_load_store
) {
807 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindImageTextures()");
811 if (first
+ count
> ctx
->Const
.MaxImageUnits
) {
812 /* The ARB_multi_bind spec says:
814 * "An INVALID_OPERATION error is generated if <first> + <count>
815 * is greater than the number of image units supported by
816 * the implementation."
818 _mesa_error(ctx
, GL_INVALID_OPERATION
,
819 "glBindImageTextures(first=%u + count=%d > the value of "
820 "GL_MAX_IMAGE_UNITS=%u)",
821 first
, count
, ctx
->Const
.MaxImageUnits
);
825 bind_image_textures(ctx
, first
, count
, textures
, false);