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 * Define endian-invariant aliases for some mesa formats that are
41 * defined in terms of their channel layout from LSB to MSB in a
42 * 32-bit word. The actual byte offsets matter here because the user
43 * is allowed to bit-cast one format into another and get predictable
46 #ifdef MESA_BIG_ENDIAN
47 # define MESA_FORMAT_RGBA_8 MESA_FORMAT_A8B8G8R8_UNORM
48 # define MESA_FORMAT_RG_16 MESA_FORMAT_G16R16_UNORM
49 # define MESA_FORMAT_RG_8 MESA_FORMAT_G8R8_UNORM
50 # define MESA_FORMAT_SIGNED_RGBA_8 MESA_FORMAT_A8B8G8R8_SNORM
51 # define MESA_FORMAT_SIGNED_RG_16 MESA_FORMAT_G16R16_SNORM
52 # define MESA_FORMAT_SIGNED_RG_8 MESA_FORMAT_G8R8_SNORM
54 # define MESA_FORMAT_RGBA_8 MESA_FORMAT_R8G8B8A8_UNORM
55 # define MESA_FORMAT_RG_16 MESA_FORMAT_R16G16_UNORM
56 # define MESA_FORMAT_RG_8 MESA_FORMAT_R8G8_UNORM
57 # define MESA_FORMAT_SIGNED_RGBA_8 MESA_FORMAT_R8G8B8A8_SNORM
58 # define MESA_FORMAT_SIGNED_RG_16 MESA_FORMAT_R16G16_SNORM
59 # define MESA_FORMAT_SIGNED_RG_8 MESA_FORMAT_R8G8_SNORM
63 _mesa_get_shader_image_format(GLenum format
)
67 return MESA_FORMAT_RGBA_FLOAT32
;
70 return MESA_FORMAT_RGBA_FLOAT16
;
73 return MESA_FORMAT_RG_FLOAT32
;
76 return MESA_FORMAT_RG_FLOAT16
;
78 case GL_R11F_G11F_B10F
:
79 return MESA_FORMAT_R11G11B10_FLOAT
;
82 return MESA_FORMAT_R_FLOAT32
;
85 return MESA_FORMAT_R_FLOAT16
;
88 return MESA_FORMAT_RGBA_UINT32
;
91 return MESA_FORMAT_RGBA_UINT16
;
94 return MESA_FORMAT_R10G10B10A2_UINT
;
97 return MESA_FORMAT_RGBA_UINT8
;
100 return MESA_FORMAT_RG_UINT32
;
103 return MESA_FORMAT_RG_UINT16
;
106 return MESA_FORMAT_RG_UINT8
;
109 return MESA_FORMAT_R_UINT32
;
112 return MESA_FORMAT_R_UINT16
;
115 return MESA_FORMAT_R_UINT8
;
118 return MESA_FORMAT_RGBA_SINT32
;
121 return MESA_FORMAT_RGBA_SINT16
;
124 return MESA_FORMAT_RGBA_SINT8
;
127 return MESA_FORMAT_RG_SINT32
;
130 return MESA_FORMAT_RG_SINT16
;
133 return MESA_FORMAT_RG_SINT8
;
136 return MESA_FORMAT_R_SINT32
;
139 return MESA_FORMAT_R_SINT16
;
142 return MESA_FORMAT_R_SINT8
;
145 return MESA_FORMAT_RGBA_UNORM16
;
148 return MESA_FORMAT_R10G10B10A2_UNORM
;
151 return MESA_FORMAT_RGBA_8
;
154 return MESA_FORMAT_RG_16
;
157 return MESA_FORMAT_RG_8
;
160 return MESA_FORMAT_R_UNORM16
;
163 return MESA_FORMAT_R_UNORM8
;
165 case GL_RGBA16_SNORM
:
166 return MESA_FORMAT_RGBA_SNORM16
;
169 return MESA_FORMAT_SIGNED_RGBA_8
;
172 return MESA_FORMAT_SIGNED_RG_16
;
175 return MESA_FORMAT_SIGNED_RG_8
;
178 return MESA_FORMAT_R_SNORM16
;
181 return MESA_FORMAT_R_SNORM8
;
184 return MESA_FORMAT_NONE
;
188 enum image_format_class
190 /** Not a valid image format. */
191 IMAGE_FORMAT_CLASS_NONE
= 0,
193 /** Classes of image formats you can cast into each other. */
195 IMAGE_FORMAT_CLASS_1X8
,
196 IMAGE_FORMAT_CLASS_1X16
,
197 IMAGE_FORMAT_CLASS_1X32
,
198 IMAGE_FORMAT_CLASS_2X8
,
199 IMAGE_FORMAT_CLASS_2X16
,
200 IMAGE_FORMAT_CLASS_2X32
,
201 IMAGE_FORMAT_CLASS_10_11_11
,
202 IMAGE_FORMAT_CLASS_4X8
,
203 IMAGE_FORMAT_CLASS_4X16
,
204 IMAGE_FORMAT_CLASS_4X32
,
205 IMAGE_FORMAT_CLASS_2_10_10_10
209 static enum image_format_class
210 get_image_format_class(mesa_format format
)
213 case MESA_FORMAT_RGBA_FLOAT32
:
214 return IMAGE_FORMAT_CLASS_4X32
;
216 case MESA_FORMAT_RGBA_FLOAT16
:
217 return IMAGE_FORMAT_CLASS_4X16
;
219 case MESA_FORMAT_RG_FLOAT32
:
220 return IMAGE_FORMAT_CLASS_2X32
;
222 case MESA_FORMAT_RG_FLOAT16
:
223 return IMAGE_FORMAT_CLASS_2X16
;
225 case MESA_FORMAT_R11G11B10_FLOAT
:
226 return IMAGE_FORMAT_CLASS_10_11_11
;
228 case MESA_FORMAT_R_FLOAT32
:
229 return IMAGE_FORMAT_CLASS_1X32
;
231 case MESA_FORMAT_R_FLOAT16
:
232 return IMAGE_FORMAT_CLASS_1X16
;
234 case MESA_FORMAT_RGBA_UINT32
:
235 return IMAGE_FORMAT_CLASS_4X32
;
237 case MESA_FORMAT_RGBA_UINT16
:
238 return IMAGE_FORMAT_CLASS_4X16
;
240 case MESA_FORMAT_R10G10B10A2_UINT
:
241 return IMAGE_FORMAT_CLASS_2_10_10_10
;
243 case MESA_FORMAT_RGBA_UINT8
:
244 return IMAGE_FORMAT_CLASS_4X8
;
246 case MESA_FORMAT_RG_UINT32
:
247 return IMAGE_FORMAT_CLASS_2X32
;
249 case MESA_FORMAT_RG_UINT16
:
250 return IMAGE_FORMAT_CLASS_2X16
;
252 case MESA_FORMAT_RG_UINT8
:
253 return IMAGE_FORMAT_CLASS_2X8
;
255 case MESA_FORMAT_R_UINT32
:
256 return IMAGE_FORMAT_CLASS_1X32
;
258 case MESA_FORMAT_R_UINT16
:
259 return IMAGE_FORMAT_CLASS_1X16
;
261 case MESA_FORMAT_R_UINT8
:
262 return IMAGE_FORMAT_CLASS_1X8
;
264 case MESA_FORMAT_RGBA_SINT32
:
265 return IMAGE_FORMAT_CLASS_4X32
;
267 case MESA_FORMAT_RGBA_SINT16
:
268 return IMAGE_FORMAT_CLASS_4X16
;
270 case MESA_FORMAT_RGBA_SINT8
:
271 return IMAGE_FORMAT_CLASS_4X8
;
273 case MESA_FORMAT_RG_SINT32
:
274 return IMAGE_FORMAT_CLASS_2X32
;
276 case MESA_FORMAT_RG_SINT16
:
277 return IMAGE_FORMAT_CLASS_2X16
;
279 case MESA_FORMAT_RG_SINT8
:
280 return IMAGE_FORMAT_CLASS_2X8
;
282 case MESA_FORMAT_R_SINT32
:
283 return IMAGE_FORMAT_CLASS_1X32
;
285 case MESA_FORMAT_R_SINT16
:
286 return IMAGE_FORMAT_CLASS_1X16
;
288 case MESA_FORMAT_R_SINT8
:
289 return IMAGE_FORMAT_CLASS_1X8
;
291 case MESA_FORMAT_RGBA_UNORM16
:
292 return IMAGE_FORMAT_CLASS_4X16
;
294 case MESA_FORMAT_R10G10B10A2_UNORM
:
295 return IMAGE_FORMAT_CLASS_2_10_10_10
;
297 case MESA_FORMAT_RGBA_8
:
298 return IMAGE_FORMAT_CLASS_4X8
;
300 case MESA_FORMAT_RG_16
:
301 return IMAGE_FORMAT_CLASS_2X16
;
303 case MESA_FORMAT_RG_8
:
304 return IMAGE_FORMAT_CLASS_2X8
;
306 case MESA_FORMAT_R_UNORM16
:
307 return IMAGE_FORMAT_CLASS_1X16
;
309 case MESA_FORMAT_R_UNORM8
:
310 return IMAGE_FORMAT_CLASS_1X8
;
312 case MESA_FORMAT_RGBA_SNORM16
:
313 return IMAGE_FORMAT_CLASS_4X16
;
315 case MESA_FORMAT_SIGNED_RGBA_8
:
316 return IMAGE_FORMAT_CLASS_4X8
;
318 case MESA_FORMAT_SIGNED_RG_16
:
319 return IMAGE_FORMAT_CLASS_2X16
;
321 case MESA_FORMAT_SIGNED_RG_8
:
322 return IMAGE_FORMAT_CLASS_2X8
;
324 case MESA_FORMAT_R_SNORM16
:
325 return IMAGE_FORMAT_CLASS_1X16
;
327 case MESA_FORMAT_R_SNORM8
:
328 return IMAGE_FORMAT_CLASS_1X8
;
331 return IMAGE_FORMAT_CLASS_NONE
;
336 _image_format_class_to_glenum(enum image_format_class
class)
339 case IMAGE_FORMAT_CLASS_NONE
:
341 case IMAGE_FORMAT_CLASS_1X8
:
342 return GL_IMAGE_CLASS_1_X_8
;
343 case IMAGE_FORMAT_CLASS_1X16
:
344 return GL_IMAGE_CLASS_1_X_16
;
345 case IMAGE_FORMAT_CLASS_1X32
:
346 return GL_IMAGE_CLASS_1_X_32
;
347 case IMAGE_FORMAT_CLASS_2X8
:
348 return GL_IMAGE_CLASS_2_X_8
;
349 case IMAGE_FORMAT_CLASS_2X16
:
350 return GL_IMAGE_CLASS_2_X_16
;
351 case IMAGE_FORMAT_CLASS_2X32
:
352 return GL_IMAGE_CLASS_2_X_32
;
353 case IMAGE_FORMAT_CLASS_10_11_11
:
354 return GL_IMAGE_CLASS_11_11_10
;
355 case IMAGE_FORMAT_CLASS_4X8
:
356 return GL_IMAGE_CLASS_4_X_8
;
357 case IMAGE_FORMAT_CLASS_4X16
:
358 return GL_IMAGE_CLASS_4_X_16
;
359 case IMAGE_FORMAT_CLASS_4X32
:
360 return GL_IMAGE_CLASS_4_X_32
;
361 case IMAGE_FORMAT_CLASS_2_10_10_10
:
362 return GL_IMAGE_CLASS_10_10_10_2
;
364 assert(!"Invalid image_format_class");
370 _mesa_get_image_format_class(GLenum format
)
372 mesa_format tex_format
= _mesa_get_shader_image_format(format
);
373 if (tex_format
== MESA_FORMAT_NONE
)
376 enum image_format_class
class = get_image_format_class(tex_format
);
377 return _image_format_class_to_glenum(class);
381 _mesa_is_shader_image_format_supported(const struct gl_context
*ctx
,
385 /* Formats supported on both desktop and ES GL, c.f. table 8.27 of the
386 * OpenGL ES 3.1 specification.
403 /* Formats supported on unextended desktop GL and the original
404 * ARB_shader_image_load_store extension, c.f. table 3.21 of the OpenGL 4.2
405 * specification or by GLES 3.1 with GL_NV_image_formats extension.
409 case GL_R11F_G11F_B10F
:
429 /* Formats supported on unextended desktop GL and the original
430 * ARB_shader_image_load_store extension, c.f. table 3.21 of the OpenGL 4.2
433 * Following formats are supported by GLES 3.1 with GL_NV_image_formats &
434 * GL_EXT_texture_norm16 extensions.
437 case GL_RGBA16_SNORM
:
442 return _mesa_is_desktop_gl(ctx
) || _mesa_has_EXT_texture_norm16(ctx
);
450 _mesa_default_image_unit(struct gl_context
*ctx
)
452 const GLenum format
= _mesa_is_desktop_gl(ctx
) ? GL_R8
: GL_R32UI
;
453 const struct gl_image_unit u
= {
454 .Access
= GL_READ_ONLY
,
456 ._ActualFormat
= _mesa_get_shader_image_format(format
)
462 _mesa_init_image_units(struct gl_context
*ctx
)
466 ASSERT_BITFIELD_SIZE(struct gl_image_unit
, Format
, MESA_FORMAT_COUNT
);
468 for (i
= 0; i
< ARRAY_SIZE(ctx
->ImageUnits
); ++i
)
469 ctx
->ImageUnits
[i
] = _mesa_default_image_unit(ctx
);
473 _mesa_is_image_unit_valid(struct gl_context
*ctx
, struct gl_image_unit
*u
)
475 struct gl_texture_object
*t
= u
->TexObj
;
476 mesa_format tex_format
;
481 if (!t
->_BaseComplete
&& !t
->_MipmapComplete
)
482 _mesa_test_texobj_completeness(ctx
, t
);
484 if (u
->Level
< t
->BaseLevel
||
485 u
->Level
> t
->_MaxLevel
||
486 (u
->Level
== t
->BaseLevel
&& !t
->_BaseComplete
) ||
487 (u
->Level
!= t
->BaseLevel
&& !t
->_MipmapComplete
))
490 if (_mesa_tex_target_is_layered(t
->Target
) &&
491 u
->_Layer
>= _mesa_get_texture_layers(t
, u
->Level
))
494 if (t
->Target
== GL_TEXTURE_BUFFER
) {
495 tex_format
= _mesa_get_shader_image_format(t
->BufferObjectFormat
);
498 struct gl_texture_image
*img
= (t
->Target
== GL_TEXTURE_CUBE_MAP
?
499 t
->Image
[u
->_Layer
][u
->Level
] :
500 t
->Image
[0][u
->Level
]);
502 if (!img
|| img
->Border
|| img
->NumSamples
> ctx
->Const
.MaxImageSamples
)
505 tex_format
= _mesa_get_shader_image_format(img
->InternalFormat
);
511 switch (t
->ImageFormatCompatibilityType
) {
512 case GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE
:
513 if (_mesa_get_format_bytes(tex_format
) !=
514 _mesa_get_format_bytes(u
->_ActualFormat
))
518 case GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS
:
519 if (get_image_format_class(tex_format
) !=
520 get_image_format_class(u
->_ActualFormat
))
525 assert(!"Unexpected image format compatibility type");
532 validate_bind_image_texture(struct gl_context
*ctx
, GLuint unit
,
533 GLuint texture
, GLint level
, GLint layer
,
534 GLenum access
, GLenum format
)
536 assert(ctx
->Const
.MaxImageUnits
<= MAX_IMAGE_UNITS
);
538 if (unit
>= ctx
->Const
.MaxImageUnits
) {
539 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(unit)");
544 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(level)");
549 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(layer)");
553 if (access
!= GL_READ_ONLY
&&
554 access
!= GL_WRITE_ONLY
&&
555 access
!= GL_READ_WRITE
) {
556 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(access)");
560 if (!_mesa_is_shader_image_format_supported(ctx
, format
)) {
561 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(format)");
569 set_image_binding(struct gl_image_unit
*u
, struct gl_texture_object
*texObj
,
570 GLint level
, GLboolean layered
, GLint layer
, GLenum access
,
576 u
->_ActualFormat
= _mesa_get_shader_image_format(format
);
578 if (texObj
&& _mesa_tex_target_is_layered(texObj
->Target
)) {
579 u
->Layered
= layered
;
581 u
->_Layer
= (u
->Layered
? 0 : u
->Layer
);
583 u
->Layered
= GL_FALSE
;
587 _mesa_reference_texobj(&u
->TexObj
, texObj
);
591 bind_image_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
,
592 GLuint unit
, GLint level
, GLboolean layered
, GLint layer
,
593 GLenum access
, GLenum format
)
595 struct gl_image_unit
*u
;
597 u
= &ctx
->ImageUnits
[unit
];
599 FLUSH_VERTICES(ctx
, 0);
600 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewImageUnits
;
602 set_image_binding(u
, texObj
, level
, layered
, layer
, access
, format
);
606 _mesa_BindImageTexture_no_error(GLuint unit
, GLuint texture
, GLint level
,
607 GLboolean layered
, GLint layer
, GLenum access
,
610 struct gl_texture_object
*texObj
= NULL
;
612 GET_CURRENT_CONTEXT(ctx
);
615 texObj
= _mesa_lookup_texture(ctx
, texture
);
617 bind_image_texture(ctx
, texObj
, unit
, level
, layered
, layer
, access
, format
);
621 _mesa_BindImageTexture(GLuint unit
, GLuint texture
, GLint level
,
622 GLboolean layered
, GLint layer
, GLenum access
,
625 struct gl_texture_object
*texObj
= NULL
;
627 GET_CURRENT_CONTEXT(ctx
);
629 if (!validate_bind_image_texture(ctx
, unit
, texture
, level
, layer
, access
,
634 texObj
= _mesa_lookup_texture(ctx
, texture
);
637 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindImageTexture(texture)");
641 /* From section 8.22 "Texture Image Loads and Stores" of the OpenGL ES
644 * "An INVALID_OPERATION error is generated if texture is not the name
645 * of an immutable texture object."
647 * However note that issue 7 of the GL_OES_texture_buffer spec
648 * recognizes that there is no way to create immutable buffer textures,
649 * so those are excluded from this requirement.
651 if (_mesa_is_gles(ctx
) && !texObj
->Immutable
&&
652 texObj
->Target
!= GL_TEXTURE_BUFFER
) {
653 _mesa_error(ctx
, GL_INVALID_OPERATION
,
654 "glBindImageTexture(!immutable)");
659 bind_image_texture(ctx
, texObj
, unit
, level
, layered
, layer
, access
, format
);
662 static ALWAYS_INLINE
void
663 bind_image_textures(struct gl_context
*ctx
, GLuint first
, GLuint count
,
664 const GLuint
*textures
, bool no_error
)
668 /* Assume that at least one binding will be changed */
669 FLUSH_VERTICES(ctx
, 0);
670 ctx
->NewDriverState
|= ctx
->DriverFlags
.NewImageUnits
;
672 /* Note that the error semantics for multi-bind commands differ from
673 * those of other GL commands.
675 * The Issues section in the ARB_multi_bind spec says:
677 * "(11) Typically, OpenGL specifies that if an error is generated by
678 * a command, that command has no effect. This is somewhat
679 * unfortunate for multi-bind commands, because it would require
680 * a first pass to scan the entire list of bound objects for
681 * errors and then a second pass to actually perform the
682 * bindings. Should we have different error semantics?
684 * RESOLVED: Yes. In this specification, when the parameters for
685 * one of the <count> binding points are invalid, that binding
686 * point is not updated and an error will be generated. However,
687 * other binding points in the same command will be updated if
688 * their parameters are valid and no other error occurs."
691 _mesa_HashLockMutex(ctx
->Shared
->TexObjects
);
693 for (i
= 0; i
< count
; i
++) {
694 struct gl_image_unit
*u
= &ctx
->ImageUnits
[first
+ i
];
695 const GLuint texture
= textures
? textures
[i
] : 0;
698 struct gl_texture_object
*texObj
= u
->TexObj
;
701 if (!texObj
|| texObj
->Name
!= texture
) {
702 texObj
= _mesa_lookup_texture_locked(ctx
, texture
);
703 if (!no_error
&& !texObj
) {
704 /* The ARB_multi_bind spec says:
706 * "An INVALID_OPERATION error is generated if any value
707 * in <textures> is not zero or the name of an existing
708 * texture object (per binding)."
710 _mesa_error(ctx
, GL_INVALID_OPERATION
,
711 "glBindImageTextures(textures[%d]=%u "
712 "is not zero or the name of an existing texture "
713 "object)", i
, texture
);
718 if (texObj
->Target
== GL_TEXTURE_BUFFER
) {
719 tex_format
= texObj
->BufferObjectFormat
;
721 struct gl_texture_image
*image
= texObj
->Image
[0][0];
723 if (!no_error
&& (!image
|| image
->Width
== 0 ||
724 image
->Height
== 0 || image
->Depth
== 0)) {
725 /* The ARB_multi_bind spec says:
727 * "An INVALID_OPERATION error is generated if the width,
728 * height, or depth of the level zero texture image of
729 * any texture in <textures> is zero (per binding)."
731 _mesa_error(ctx
, GL_INVALID_OPERATION
,
732 "glBindImageTextures(the width, height or depth "
733 "of the level zero texture image of "
734 "textures[%d]=%u is zero)", i
, texture
);
738 tex_format
= image
->InternalFormat
;
742 !_mesa_is_shader_image_format_supported(ctx
, tex_format
)) {
743 /* The ARB_multi_bind spec says:
745 * "An INVALID_OPERATION error is generated if the internal
746 * format of the level zero texture image of any texture
747 * in <textures> is not found in table 8.33 (per binding)."
749 _mesa_error(ctx
, GL_INVALID_OPERATION
,
750 "glBindImageTextures(the internal format %s of "
751 "the level zero texture image of textures[%d]=%u "
753 _mesa_enum_to_string(tex_format
),
758 /* Update the texture binding */
759 set_image_binding(u
, texObj
, 0,
760 _mesa_tex_target_is_layered(texObj
->Target
),
761 0, GL_READ_WRITE
, tex_format
);
763 /* Unbind the texture from the unit */
764 set_image_binding(u
, NULL
, 0, GL_FALSE
, 0, GL_READ_ONLY
, GL_R8
);
768 _mesa_HashUnlockMutex(ctx
->Shared
->TexObjects
);
772 _mesa_BindImageTextures_no_error(GLuint first
, GLsizei count
,
773 const GLuint
*textures
)
775 GET_CURRENT_CONTEXT(ctx
);
777 bind_image_textures(ctx
, first
, count
, textures
, true);
781 _mesa_BindImageTextures(GLuint first
, GLsizei count
, const GLuint
*textures
)
783 GET_CURRENT_CONTEXT(ctx
);
785 if (!ctx
->Extensions
.ARB_shader_image_load_store
) {
786 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindImageTextures()");
790 if (first
+ count
> ctx
->Const
.MaxImageUnits
) {
791 /* The ARB_multi_bind spec says:
793 * "An INVALID_OPERATION error is generated if <first> + <count>
794 * is greater than the number of image units supported by
795 * the implementation."
797 _mesa_error(ctx
, GL_INVALID_OPERATION
,
798 "glBindImageTextures(first=%u + count=%d > the value of "
799 "GL_MAX_IMAGE_UNITS=%u)",
800 first
, count
, ctx
->Const
.MaxImageUnits
);
804 bind_image_textures(ctx
, first
, count
, textures
, false);