2 * Copyright © 2012 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.
26 #include "glformats.h"
30 #include "formatquery.h"
34 _is_renderable(struct gl_context
*ctx
, GLenum internalformat
)
36 /* Section 4.4.4 on page 212 of the GLES 3.0.4 spec says:
38 * "An internal format is color-renderable if it is one of the
39 * formats from table 3.13 noted as color-renderable or if it
40 * is unsized format RGBA or RGB."
42 * Therefore, we must accept GL_RGB and GL_RGBA here.
44 if (internalformat
!= GL_RGB
&& internalformat
!= GL_RGBA
&&
45 _mesa_base_fbo_format(ctx
, internalformat
) == 0)
51 /* Handles the cases where either ARB_internalformat_query or
52 * ARB_internalformat_query2 have to return an error.
55 _legal_parameters(struct gl_context
*ctx
, GLenum target
, GLenum internalformat
,
56 GLenum pname
, GLsizei bufSize
, GLint
*params
)
59 bool query2
= _mesa_has_ARB_internalformat_query2(ctx
);
61 /* The ARB_internalformat_query2 spec says:
63 * "The INVALID_ENUM error is generated if the <target> parameter to
64 * GetInternalformati*v is not one of the targets listed in Table 6.xx.
68 case GL_TEXTURE_1D_ARRAY
:
70 case GL_TEXTURE_2D_ARRAY
:
72 case GL_TEXTURE_CUBE_MAP
:
73 case GL_TEXTURE_CUBE_MAP_ARRAY
:
74 case GL_TEXTURE_RECTANGLE
:
75 case GL_TEXTURE_BUFFER
:
77 /* The ARB_internalformat_query spec says:
79 * "If the <target> parameter to GetInternalformativ is not one of
80 * TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY
81 * or RENDERBUFFER then an INVALID_ENUM error is generated.
83 _mesa_error(ctx
, GL_INVALID_ENUM
,
84 "glGetInternalformativ(target=%s)",
85 _mesa_enum_to_string(target
));
94 case GL_TEXTURE_2D_MULTISAMPLE
:
95 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY
:
96 /* The non-existence of ARB_texture_multisample is treated in
97 * ARB_internalformat_query implementation like an error.
100 !(_mesa_has_ARB_texture_multisample(ctx
) || _mesa_is_gles31(ctx
))) {
101 _mesa_error(ctx
, GL_INVALID_ENUM
,
102 "glGetInternalformativ(target=%s)",
103 _mesa_enum_to_string(target
));
110 _mesa_error(ctx
, GL_INVALID_ENUM
,
111 "glGetInternalformativ(target=%s)",
112 _mesa_enum_to_string(target
));
117 /* The ARB_internalformat_query2 spec says:
119 * "The INVALID_ENUM error is generated if the <pname> parameter is
120 * not one of the listed possibilities.
124 case GL_NUM_SAMPLE_COUNTS
:
127 case GL_SRGB_DECODE_ARB
:
128 /* The ARB_internalformat_query2 spec says:
130 * "If ARB_texture_sRGB_decode or EXT_texture_sRGB_decode or
131 * equivalent functionality is not supported, queries for the
132 * SRGB_DECODE_ARB <pname> set the INVALID_ENUM error.
134 if (!_mesa_has_EXT_texture_sRGB_decode(ctx
)) {
135 _mesa_error(ctx
, GL_INVALID_ENUM
,
136 "glGetInternalformativ(pname=%s)",
137 _mesa_enum_to_string(pname
));
141 case GL_INTERNALFORMAT_SUPPORTED
:
142 case GL_INTERNALFORMAT_PREFERRED
:
143 case GL_INTERNALFORMAT_RED_SIZE
:
144 case GL_INTERNALFORMAT_GREEN_SIZE
:
145 case GL_INTERNALFORMAT_BLUE_SIZE
:
146 case GL_INTERNALFORMAT_ALPHA_SIZE
:
147 case GL_INTERNALFORMAT_DEPTH_SIZE
:
148 case GL_INTERNALFORMAT_STENCIL_SIZE
:
149 case GL_INTERNALFORMAT_SHARED_SIZE
:
150 case GL_INTERNALFORMAT_RED_TYPE
:
151 case GL_INTERNALFORMAT_GREEN_TYPE
:
152 case GL_INTERNALFORMAT_BLUE_TYPE
:
153 case GL_INTERNALFORMAT_ALPHA_TYPE
:
154 case GL_INTERNALFORMAT_DEPTH_TYPE
:
155 case GL_INTERNALFORMAT_STENCIL_TYPE
:
160 case GL_MAX_COMBINED_DIMENSIONS
:
161 case GL_COLOR_COMPONENTS
:
162 case GL_DEPTH_COMPONENTS
:
163 case GL_STENCIL_COMPONENTS
:
164 case GL_COLOR_RENDERABLE
:
165 case GL_DEPTH_RENDERABLE
:
166 case GL_STENCIL_RENDERABLE
:
167 case GL_FRAMEBUFFER_RENDERABLE
:
168 case GL_FRAMEBUFFER_RENDERABLE_LAYERED
:
169 case GL_FRAMEBUFFER_BLEND
:
171 case GL_READ_PIXELS_FORMAT
:
172 case GL_READ_PIXELS_TYPE
:
173 case GL_TEXTURE_IMAGE_FORMAT
:
174 case GL_TEXTURE_IMAGE_TYPE
:
175 case GL_GET_TEXTURE_IMAGE_FORMAT
:
176 case GL_GET_TEXTURE_IMAGE_TYPE
:
178 case GL_MANUAL_GENERATE_MIPMAP
:
179 case GL_AUTO_GENERATE_MIPMAP
:
180 case GL_COLOR_ENCODING
:
184 case GL_VERTEX_TEXTURE
:
185 case GL_TESS_CONTROL_TEXTURE
:
186 case GL_TESS_EVALUATION_TEXTURE
:
187 case GL_GEOMETRY_TEXTURE
:
188 case GL_FRAGMENT_TEXTURE
:
189 case GL_COMPUTE_TEXTURE
:
190 case GL_TEXTURE_SHADOW
:
191 case GL_TEXTURE_GATHER
:
192 case GL_TEXTURE_GATHER_SHADOW
:
193 case GL_SHADER_IMAGE_LOAD
:
194 case GL_SHADER_IMAGE_STORE
:
195 case GL_SHADER_IMAGE_ATOMIC
:
196 case GL_IMAGE_TEXEL_SIZE
:
197 case GL_IMAGE_COMPATIBILITY_CLASS
:
198 case GL_IMAGE_PIXEL_FORMAT
:
199 case GL_IMAGE_PIXEL_TYPE
:
200 case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE
:
201 case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST
:
202 case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST
:
203 case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE
:
204 case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE
:
205 case GL_TEXTURE_COMPRESSED
:
206 case GL_TEXTURE_COMPRESSED_BLOCK_WIDTH
:
207 case GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT
:
208 case GL_TEXTURE_COMPRESSED_BLOCK_SIZE
:
209 case GL_CLEAR_BUFFER
:
210 case GL_TEXTURE_VIEW
:
211 case GL_VIEW_COMPATIBILITY_CLASS
:
212 /* The ARB_internalformat_query spec says:
214 * "If the <pname> parameter to GetInternalformativ is not SAMPLES
215 * or NUM_SAMPLE_COUNTS, then an INVALID_ENUM error is generated."
218 _mesa_error(ctx
, GL_INVALID_ENUM
,
219 "glGetInternalformativ(pname=%s)",
220 _mesa_enum_to_string(pname
));
227 _mesa_error(ctx
, GL_INVALID_ENUM
,
228 "glGetInternalformativ(pname=%s)",
229 _mesa_enum_to_string(pname
));
233 /* The ARB_internalformat_query spec says:
235 * "If the <bufSize> parameter to GetInternalformativ is negative, then
236 * an INVALID_VALUE error is generated."
238 * Nothing is said in ARB_internalformat_query2 but we assume the same.
241 _mesa_error(ctx
, GL_INVALID_VALUE
,
242 "glGetInternalformativ(target=%s)",
243 _mesa_enum_to_string(target
));
247 /* The ARB_internalformat_query spec says:
249 * "If the <internalformat> parameter to GetInternalformativ is not
250 * color-, depth- or stencil-renderable, then an INVALID_ENUM error is
253 if (!query2
&& !_is_renderable(ctx
, internalformat
)) {
254 _mesa_error(ctx
, GL_INVALID_ENUM
,
255 "glGetInternalformativ(internalformat=%s)",
256 _mesa_enum_to_string(internalformat
));
263 /* Sets the appropriate "unsupported" response as defined by the
264 * ARB_internalformat_query2 spec for each each <pname>.
267 _set_default_response(GLenum pname
, GLint buffer
[16])
269 /* The ARB_internalformat_query2 defines which is the reponse best
270 * representing "not supported" or "not applicable" for each <pname>.
273 * - size- or count-based queries will return zero,
274 * - support-, format- or type-based queries will return NONE,
275 * - boolean-based queries will return FALSE, and
276 * - list-based queries return no entries."
282 case GL_MAX_COMBINED_DIMENSIONS
:
283 case GL_NUM_SAMPLE_COUNTS
:
284 case GL_INTERNALFORMAT_RED_SIZE
:
285 case GL_INTERNALFORMAT_GREEN_SIZE
:
286 case GL_INTERNALFORMAT_BLUE_SIZE
:
287 case GL_INTERNALFORMAT_ALPHA_SIZE
:
288 case GL_INTERNALFORMAT_DEPTH_SIZE
:
289 case GL_INTERNALFORMAT_STENCIL_SIZE
:
290 case GL_INTERNALFORMAT_SHARED_SIZE
:
295 case GL_IMAGE_TEXEL_SIZE
:
296 case GL_TEXTURE_COMPRESSED_BLOCK_WIDTH
:
297 case GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT
:
298 case GL_TEXTURE_COMPRESSED_BLOCK_SIZE
:
302 case GL_INTERNALFORMAT_PREFERRED
:
303 case GL_INTERNALFORMAT_RED_TYPE
:
304 case GL_INTERNALFORMAT_GREEN_TYPE
:
305 case GL_INTERNALFORMAT_BLUE_TYPE
:
306 case GL_INTERNALFORMAT_ALPHA_TYPE
:
307 case GL_INTERNALFORMAT_DEPTH_TYPE
:
308 case GL_INTERNALFORMAT_STENCIL_TYPE
:
309 case GL_FRAMEBUFFER_RENDERABLE
:
310 case GL_FRAMEBUFFER_RENDERABLE_LAYERED
:
311 case GL_FRAMEBUFFER_BLEND
:
313 case GL_READ_PIXELS_FORMAT
:
314 case GL_READ_PIXELS_TYPE
:
315 case GL_TEXTURE_IMAGE_FORMAT
:
316 case GL_TEXTURE_IMAGE_TYPE
:
317 case GL_GET_TEXTURE_IMAGE_FORMAT
:
318 case GL_GET_TEXTURE_IMAGE_TYPE
:
319 case GL_MANUAL_GENERATE_MIPMAP
:
320 case GL_AUTO_GENERATE_MIPMAP
:
321 case GL_COLOR_ENCODING
:
324 case GL_SRGB_DECODE_ARB
:
326 case GL_VERTEX_TEXTURE
:
327 case GL_TESS_CONTROL_TEXTURE
:
328 case GL_TESS_EVALUATION_TEXTURE
:
329 case GL_GEOMETRY_TEXTURE
:
330 case GL_FRAGMENT_TEXTURE
:
331 case GL_COMPUTE_TEXTURE
:
332 case GL_TEXTURE_SHADOW
:
333 case GL_TEXTURE_GATHER
:
334 case GL_TEXTURE_GATHER_SHADOW
:
335 case GL_SHADER_IMAGE_LOAD
:
336 case GL_SHADER_IMAGE_STORE
:
337 case GL_SHADER_IMAGE_ATOMIC
:
338 case GL_IMAGE_COMPATIBILITY_CLASS
:
339 case GL_IMAGE_PIXEL_FORMAT
:
340 case GL_IMAGE_PIXEL_TYPE
:
341 case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE
:
342 case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST
:
343 case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST
:
344 case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE
:
345 case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE
:
346 case GL_CLEAR_BUFFER
:
347 case GL_TEXTURE_VIEW
:
348 case GL_VIEW_COMPATIBILITY_CLASS
:
352 case GL_INTERNALFORMAT_SUPPORTED
:
353 case GL_COLOR_COMPONENTS
:
354 case GL_DEPTH_COMPONENTS
:
355 case GL_STENCIL_COMPONENTS
:
356 case GL_COLOR_RENDERABLE
:
357 case GL_DEPTH_RENDERABLE
:
358 case GL_STENCIL_RENDERABLE
:
360 case GL_TEXTURE_COMPRESSED
:
361 buffer
[0] = GL_FALSE
;
365 unreachable("invalid 'pname'");
370 _is_target_supported(struct gl_context
*ctx
, GLenum target
)
372 /* The ARB_internalformat_query2 spec says:
374 * "if a particular type of <target> is not supported by the
375 * implementation the "unsupported" answer should be given.
376 * This is not an error."
384 if (!_mesa_is_desktop_gl(ctx
))
388 case GL_TEXTURE_1D_ARRAY
:
389 if (!_mesa_has_EXT_texture_array(ctx
))
393 case GL_TEXTURE_2D_ARRAY
:
394 if (!(_mesa_has_EXT_texture_array(ctx
) || _mesa_is_gles3(ctx
)))
398 case GL_TEXTURE_CUBE_MAP
:
399 if (!_mesa_has_ARB_texture_cube_map(ctx
))
403 case GL_TEXTURE_CUBE_MAP_ARRAY
:
404 if (!_mesa_has_ARB_texture_cube_map_array(ctx
))
408 case GL_TEXTURE_RECTANGLE
:
409 if (!_mesa_has_NV_texture_rectangle(ctx
))
413 case GL_TEXTURE_BUFFER
:
414 if (!_mesa_has_ARB_texture_buffer_object(ctx
))
418 case GL_RENDERBUFFER
:
419 if (!(_mesa_has_ARB_framebuffer_object(ctx
) ||
420 _mesa_is_gles3(ctx
)))
424 case GL_TEXTURE_2D_MULTISAMPLE
:
425 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY
:
426 if (!(_mesa_has_ARB_texture_multisample(ctx
) ||
427 _mesa_is_gles31(ctx
)))
432 unreachable("invalid target");
439 _is_resource_supported(struct gl_context
*ctx
, GLenum target
,
440 GLenum internalformat
, GLenum pname
)
442 /* From the ARB_internalformat_query2 spec:
444 * In the following descriptions, the term /resource/ is used to generically
445 * refer to an object of the appropriate type that has been created with
446 * <internalformat> and <target>. If the particular <target> and
447 * <internalformat> combination do not make sense, ... the "unsupported"
448 * answer should be given. This is not an error.
451 /* In the ARB_internalformat_query2 spec wording, some <pnames> do not care
452 * about the /resource/ being supported or not, we return 'true' for those.
455 case GL_INTERNALFORMAT_SUPPORTED
:
456 case GL_INTERNALFORMAT_PREFERRED
:
457 case GL_COLOR_COMPONENTS
:
458 case GL_DEPTH_COMPONENTS
:
459 case GL_STENCIL_COMPONENTS
:
460 case GL_COLOR_RENDERABLE
:
461 case GL_DEPTH_RENDERABLE
:
462 case GL_STENCIL_RENDERABLE
:
470 case GL_TEXTURE_1D_ARRAY
:
472 case GL_TEXTURE_2D_ARRAY
:
474 case GL_TEXTURE_CUBE_MAP
:
475 case GL_TEXTURE_CUBE_MAP_ARRAY
:
476 case GL_TEXTURE_RECTANGLE
:
477 /* Based on what Mesa does for glTexImage1D/2D/3D and
478 * glCompressedTexImage1D/2D/3D functions.
480 if (_mesa_base_tex_format(ctx
, internalformat
) < 0)
483 /* additional checks for depth textures */
484 if (!_mesa_legal_texture_base_format_for_target(ctx
, target
, internalformat
))
487 /* additional checks for compressed textures */
488 if (_mesa_is_compressed_format(ctx
, internalformat
) &&
489 (!_mesa_target_can_be_compressed(ctx
, target
, internalformat
, NULL
) ||
490 _mesa_format_no_online_compression(ctx
, internalformat
)))
494 case GL_TEXTURE_2D_MULTISAMPLE
:
495 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY
:
496 /* Based on what Mesa does for glTexImage2D/3DMultisample,
497 * glTexStorage2D/3DMultisample and
498 * glTextureStorage2D/3DMultisample functions.
500 if (!_mesa_is_renderable_texture_format(ctx
, internalformat
))
504 case GL_TEXTURE_BUFFER
:
505 /* Based on what Mesa does for the glTexBuffer function. */
506 if (_mesa_validate_texbuffer_format(ctx
, internalformat
) ==
511 case GL_RENDERBUFFER
:
512 /* Based on what Mesa does for glRenderbufferStorage(Multisample) and
513 * glNamedRenderbufferStorage functions.
515 if (!_mesa_base_fbo_format(ctx
, internalformat
))
520 unreachable("bad target");
527 _is_internalformat_supported(struct gl_context
*ctx
, GLenum target
,
528 GLenum internalformat
)
530 /* From the ARB_internalformat_query2 specification:
532 * "- INTERNALFORMAT_SUPPORTED: If <internalformat> is an internal format
533 * that is supported by the implementation in at least some subset of
534 * possible operations, TRUE is written to <params>. If <internalformat>
535 * if not a valid token for any internal format usage, FALSE is returned.
537 * <internalformats> that must be supported (in GL 4.2 or later) include
539 * - "sized internal formats" from Table 3.12, 3.13, and 3.15,
540 * - any specific "compressed internal format" from Table 3.14,
541 * - any "image unit format" from Table 3.21.
542 * - any generic "compressed internal format" from Table 3.14, if the
543 * implementation accepts it for any texture specification commands, and
544 * - unsized or base internal format, if the implementation accepts
545 * it for texture or image specification.
549 /* At this point a internalformat is valid if it is valid as a texture or
550 * as a renderbuffer format. The checks are different because those methods
551 * return different values when passing non supported internalformats */
552 if (_mesa_base_tex_format(ctx
, internalformat
) < 0 &&
553 _mesa_base_fbo_format(ctx
, internalformat
) == 0)
556 /* Let the driver have the final word */
557 ctx
->Driver
.QueryInternalFormat(ctx
, target
, internalformat
,
558 GL_INTERNALFORMAT_SUPPORTED
, buffer
);
560 return (buffer
[0] == GL_TRUE
);
563 /* default implementation of QueryInternalFormat driverfunc, for
564 * drivers not implementing ARB_internalformat_query2.
567 _mesa_query_internal_format_default(struct gl_context
*ctx
, GLenum target
,
568 GLenum internalFormat
, GLenum pname
,
573 (void) internalFormat
;
577 case GL_NUM_SAMPLE_COUNTS
:
581 _set_default_response(pname
, params
);
587 _mesa_GetInternalformativ(GLenum target
, GLenum internalformat
, GLenum pname
,
588 GLsizei bufSize
, GLint
*params
)
591 GET_CURRENT_CONTEXT(ctx
);
593 ASSERT_OUTSIDE_BEGIN_END(ctx
);
595 /* ARB_internalformat_query is also mandatory for ARB_internalformat_query2 */
596 if (!(_mesa_has_ARB_internalformat_query(ctx
) ||
597 _mesa_is_gles3(ctx
))) {
598 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetInternalformativ");
602 assert(ctx
->Driver
.QueryInternalFormat
!= NULL
);
604 if (!_legal_parameters(ctx
, target
, internalformat
, pname
, bufSize
, params
))
607 /* initialize the contents of the temporary buffer */
608 memcpy(buffer
, params
, MIN2(bufSize
, 16) * sizeof(GLint
));
610 /* Use the 'unsupported' response defined by the spec for every pname
611 * as the default answer.
613 _set_default_response(pname
, buffer
);
615 if (!_is_target_supported(ctx
, target
) ||
616 !_is_internalformat_supported(ctx
, target
, internalformat
) ||
617 !_is_resource_supported(ctx
, target
, internalformat
, pname
))
623 case GL_NUM_SAMPLE_COUNTS
:
624 /* The ARB_internalformat_query2 sets the response as 'unsupported' for
625 * SAMPLES and NUM_SAMPLE_COUNTS:
627 * "If <internalformat> is not color-renderable, depth-renderable, or
628 * stencil-renderable (as defined in section 4.4.4), or if <target>
629 * does not support multiple samples (ie other than
630 * TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY,
633 if ((target
!= GL_RENDERBUFFER
&&
634 target
!= GL_TEXTURE_2D_MULTISAMPLE
&&
635 target
!= GL_TEXTURE_2D_MULTISAMPLE_ARRAY
) ||
636 !_is_renderable(ctx
, internalformat
))
639 /* The GL ES 3.0 specification, section 6.1.15 page 236 says:
641 * "Since multisampling is not supported for signed and unsigned
642 * integer internal formats, the value of NUM_SAMPLE_COUNTS will be
643 * zero for such formats.
645 if (pname
== GL_NUM_SAMPLE_COUNTS
&& ctx
->API
== API_OPENGLES2
&&
646 ctx
->Version
== 30 && _mesa_is_enum_format_integer(internalformat
)) {
650 ctx
->Driver
.QueryInternalFormat(ctx
, target
, internalformat
, pname
,
654 case GL_INTERNALFORMAT_SUPPORTED
:
658 case GL_INTERNALFORMAT_PREFERRED
:
662 case GL_INTERNALFORMAT_RED_SIZE
:
666 case GL_INTERNALFORMAT_GREEN_SIZE
:
670 case GL_INTERNALFORMAT_BLUE_SIZE
:
674 case GL_INTERNALFORMAT_ALPHA_SIZE
:
678 case GL_INTERNALFORMAT_DEPTH_SIZE
:
682 case GL_INTERNALFORMAT_STENCIL_SIZE
:
686 case GL_INTERNALFORMAT_SHARED_SIZE
:
690 case GL_INTERNALFORMAT_RED_TYPE
:
694 case GL_INTERNALFORMAT_GREEN_TYPE
:
698 case GL_INTERNALFORMAT_BLUE_TYPE
:
702 case GL_INTERNALFORMAT_ALPHA_TYPE
:
706 case GL_INTERNALFORMAT_DEPTH_TYPE
:
710 case GL_INTERNALFORMAT_STENCIL_TYPE
:
730 case GL_MAX_COMBINED_DIMENSIONS
:
734 case GL_COLOR_COMPONENTS
:
738 case GL_DEPTH_COMPONENTS
:
742 case GL_STENCIL_COMPONENTS
:
746 case GL_COLOR_RENDERABLE
:
750 case GL_DEPTH_RENDERABLE
:
754 case GL_STENCIL_RENDERABLE
:
758 case GL_FRAMEBUFFER_RENDERABLE
:
762 case GL_FRAMEBUFFER_RENDERABLE_LAYERED
:
766 case GL_FRAMEBUFFER_BLEND
:
774 case GL_READ_PIXELS_FORMAT
:
778 case GL_READ_PIXELS_TYPE
:
782 case GL_TEXTURE_IMAGE_FORMAT
:
786 case GL_TEXTURE_IMAGE_TYPE
:
790 case GL_GET_TEXTURE_IMAGE_FORMAT
:
794 case GL_GET_TEXTURE_IMAGE_TYPE
:
802 case GL_MANUAL_GENERATE_MIPMAP
:
806 case GL_AUTO_GENERATE_MIPMAP
:
810 case GL_COLOR_ENCODING
:
822 case GL_SRGB_DECODE_ARB
:
830 case GL_VERTEX_TEXTURE
:
834 case GL_TESS_CONTROL_TEXTURE
:
838 case GL_TESS_EVALUATION_TEXTURE
:
842 case GL_GEOMETRY_TEXTURE
:
846 case GL_FRAGMENT_TEXTURE
:
850 case GL_COMPUTE_TEXTURE
:
854 case GL_TEXTURE_SHADOW
:
858 case GL_TEXTURE_GATHER
:
862 case GL_TEXTURE_GATHER_SHADOW
:
866 case GL_SHADER_IMAGE_LOAD
:
870 case GL_SHADER_IMAGE_STORE
:
874 case GL_SHADER_IMAGE_ATOMIC
:
878 case GL_IMAGE_TEXEL_SIZE
:
882 case GL_IMAGE_COMPATIBILITY_CLASS
:
886 case GL_IMAGE_PIXEL_FORMAT
:
890 case GL_IMAGE_PIXEL_TYPE
:
894 case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE
:
898 case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST
:
902 case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST
:
906 case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE
:
910 case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE
:
914 case GL_TEXTURE_COMPRESSED
:
918 case GL_TEXTURE_COMPRESSED_BLOCK_WIDTH
:
922 case GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT
:
926 case GL_TEXTURE_COMPRESSED_BLOCK_SIZE
:
930 case GL_CLEAR_BUFFER
:
934 case GL_TEXTURE_VIEW
:
938 case GL_VIEW_COMPATIBILITY_CLASS
:
943 unreachable("bad param");
947 if (bufSize
!= 0 && params
== NULL
) {
948 /* Emit a warning to aid application debugging, but go ahead and do the
949 * memcpy (and probably crash) anyway.
952 "glGetInternalformativ(bufSize = %d, but params = NULL)",
956 /* Copy the data from the temporary buffer to the buffer supplied by the
957 * application. Clamp the size of the copy to the size supplied by the
960 memcpy(params
, buffer
, MIN2(bufSize
, 16) * sizeof(GLint
));
966 _mesa_GetInternalformati64v(GLenum target
, GLenum internalformat
,
967 GLenum pname
, GLsizei bufSize
, GLint64
*params
)
969 GET_CURRENT_CONTEXT(ctx
);
971 ASSERT_OUTSIDE_BEGIN_END(ctx
);
973 if (!_mesa_has_ARB_internalformat_query2(ctx
)) {
974 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetInternalformati64v");
978 _mesa_debug(ctx
, "glGetInternalformati64v() not implemented");