2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * glTexParameter-related functions
33 #include "main/glheader.h"
34 #include "main/blend.h"
35 #include "main/context.h"
36 #include "main/enums.h"
37 #include "main/formats.h"
38 #include "main/glformats.h"
39 #include "main/macros.h"
40 #include "main/mtypes.h"
41 #include "main/state.h"
42 #include "main/texcompress.h"
43 #include "main/texobj.h"
44 #include "main/texparam.h"
45 #include "main/teximage.h"
46 #include "main/texstate.h"
47 #include "program/prog_instruction.h"
48 #include "util/u_math.h"
52 * Check if a coordinate wrap mode is supported for the texture target.
53 * \return GL_TRUE if legal, GL_FALSE otherwise
56 validate_texture_wrap_mode(struct gl_context
* ctx
, GLenum target
, GLenum wrap
)
58 const struct gl_extensions
* const e
= & ctx
->Extensions
;
59 const bool is_desktop_gl
= _mesa_is_desktop_gl(ctx
);
64 /* GL_CLAMP was removed in the core profile, and it has never existed in
67 supported
= (ctx
->API
== API_OPENGL_COMPAT
)
68 && (target
!= GL_TEXTURE_EXTERNAL_OES
);
71 case GL_CLAMP_TO_EDGE
:
75 case GL_CLAMP_TO_BORDER
:
76 supported
= ctx
->API
!= API_OPENGLES
&& e
->ARB_texture_border_clamp
77 && (target
!= GL_TEXTURE_EXTERNAL_OES
);
81 case GL_MIRRORED_REPEAT
:
82 supported
= (target
!= GL_TEXTURE_RECTANGLE_NV
)
83 && (target
!= GL_TEXTURE_EXTERNAL_OES
);
86 case GL_MIRROR_CLAMP_EXT
:
87 supported
= is_desktop_gl
88 && (e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
)
89 && (target
!= GL_TEXTURE_RECTANGLE_NV
)
90 && (target
!= GL_TEXTURE_EXTERNAL_OES
);
93 case GL_MIRROR_CLAMP_TO_EDGE_EXT
:
94 supported
= is_desktop_gl
95 && (e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
|| e
->ARB_texture_mirror_clamp_to_edge
)
96 && (target
!= GL_TEXTURE_RECTANGLE_NV
)
97 && (target
!= GL_TEXTURE_EXTERNAL_OES
);
100 case GL_MIRROR_CLAMP_TO_BORDER_EXT
:
101 supported
= is_desktop_gl
&& e
->EXT_texture_mirror_clamp
102 && (target
!= GL_TEXTURE_RECTANGLE_NV
)
103 && (target
!= GL_TEXTURE_EXTERNAL_OES
);
112 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexParameter(param=0x%x)", wrap
);
119 is_texparameteri_target_valid(GLenum target
)
123 case GL_TEXTURE_1D_ARRAY
:
125 case GL_TEXTURE_2D_ARRAY
:
126 case GL_TEXTURE_2D_MULTISAMPLE
:
127 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY
:
129 case GL_TEXTURE_CUBE_MAP
:
130 case GL_TEXTURE_CUBE_MAP_ARRAY
:
131 case GL_TEXTURE_RECTANGLE
:
140 * Get current texture object for given name.
141 * Return NULL if any error (and record the error).
142 * Note that proxy targets are not accepted.
143 * Only the glGetTexLevelParameter() functions accept proxy targets.
145 static struct gl_texture_object
*
146 get_texobj_by_name(struct gl_context
*ctx
, GLuint texture
, const char *name
)
148 struct gl_texture_object
*texObj
;
150 texObj
= _mesa_lookup_texture_err(ctx
, texture
, name
);
154 if (!is_texparameteri_target_valid(texObj
->Target
)) {
155 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(target)", name
);
164 * Convert GL_RED/GREEN/BLUE/ALPHA/ZERO/ONE to SWIZZLE_X/Y/Z/W/ZERO/ONE.
165 * \return -1 if error.
168 comp_to_swizzle(GLenum comp
)
190 set_swizzle_component(GLushort
*swizzle
, GLuint comp
, GLuint swz
)
193 assert(swz
<= SWIZZLE_NIL
);
195 GLuint mask
= 0x7 << (3 * comp
);
196 GLuint s
= (*swizzle
& ~mask
) | (swz
<< (3 * comp
));
203 * This is called just prior to changing any texture object state which
204 * will not affect texture completeness.
207 flush(struct gl_context
*ctx
)
209 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
214 * This is called just prior to changing any texture object state which
215 * could affect texture completeness (texture base level, max level).
216 * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE_OBJECT
217 * state flag and then mark the texture object as 'incomplete' so that any
218 * per-texture derived state gets recomputed.
221 incomplete(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
223 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
224 _mesa_dirty_texobj(ctx
, texObj
);
229 _mesa_target_allows_setting_sampler_parameters(GLenum target
)
232 case GL_TEXTURE_2D_MULTISAMPLE
:
233 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY
:
243 * Set an integer-valued texture parameter
244 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
247 set_tex_parameteri(struct gl_context
*ctx
,
248 struct gl_texture_object
*texObj
,
249 GLenum pname
, const GLint
*params
, bool dsa
)
251 const char *suffix
= dsa
? "ture" : "";
253 if (texObj
->HandleAllocated
) {
254 /* The ARB_bindless_texture spec says:
256 * "The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
257 * CompressedTexImage*, TexBuffer*, TexParameter*, as well as other
258 * functions defined in terms of these, if the texture object to be
259 * modified is referenced by one or more texture or image handles."
261 _mesa_error(ctx
, GL_INVALID_OPERATION
,
262 "glTex%sParameter(immutable texture)", suffix
);
267 case GL_TEXTURE_MIN_FILTER
:
268 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
271 if (texObj
->Sampler
.MinFilter
== params
[0])
277 texObj
->Sampler
.MinFilter
= params
[0];
279 case GL_NEAREST_MIPMAP_NEAREST
:
280 case GL_LINEAR_MIPMAP_NEAREST
:
281 case GL_NEAREST_MIPMAP_LINEAR
:
282 case GL_LINEAR_MIPMAP_LINEAR
:
283 if (texObj
->Target
!= GL_TEXTURE_RECTANGLE_NV
&&
284 texObj
->Target
!= GL_TEXTURE_EXTERNAL_OES
) {
286 texObj
->Sampler
.MinFilter
= params
[0];
295 case GL_TEXTURE_MAG_FILTER
:
296 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
299 if (texObj
->Sampler
.MagFilter
== params
[0])
304 flush(ctx
); /* does not effect completeness */
305 texObj
->Sampler
.MagFilter
= params
[0];
312 case GL_TEXTURE_WRAP_S
:
313 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
316 if (texObj
->Sampler
.WrapS
== params
[0])
318 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
320 texObj
->Sampler
.WrapS
= params
[0];
325 case GL_TEXTURE_WRAP_T
:
326 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
329 if (texObj
->Sampler
.WrapT
== params
[0])
331 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
333 texObj
->Sampler
.WrapT
= params
[0];
338 case GL_TEXTURE_WRAP_R
:
339 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
342 if (texObj
->Sampler
.WrapR
== params
[0])
344 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
346 texObj
->Sampler
.WrapR
= params
[0];
351 case GL_TEXTURE_BASE_LEVEL
:
352 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
355 if (texObj
->BaseLevel
== params
[0])
358 /* Section 8.10 (Texture Parameters) of the OpenGL 4.5 Core Profile spec
361 * An INVALID_OPERATION error is generated if the effective target is
362 * TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY, or
363 * TEXTURE_RECTANGLE, and pname TEXTURE_BASE_LEVEL is set to a value
366 * Note that section 3.8.8 (Texture Parameters) of the OpenGL 3.3 Core
369 * The error INVALID_VALUE is generated if TEXTURE_BASE_LEVEL is set
370 * to any value other than zero.
372 * We take the 4.5 language as a correction to 3.3, and we implement
373 * that on all GL versions.
375 if ((texObj
->Target
== GL_TEXTURE_2D_MULTISAMPLE
||
376 texObj
->Target
== GL_TEXTURE_2D_MULTISAMPLE_ARRAY
||
377 texObj
->Target
== GL_TEXTURE_RECTANGLE
) && params
[0] != 0)
378 goto invalid_operation
;
381 _mesa_error(ctx
, GL_INVALID_VALUE
,
382 "glTex%sParameter(param=%d)", suffix
, params
[0]);
385 incomplete(ctx
, texObj
);
387 /** See note about ARB_texture_storage below */
388 if (texObj
->Immutable
)
389 texObj
->BaseLevel
= MIN2(texObj
->ImmutableLevels
- 1, params
[0]);
391 texObj
->BaseLevel
= params
[0];
395 case GL_TEXTURE_MAX_LEVEL
:
396 if (texObj
->MaxLevel
== params
[0])
400 (texObj
->Target
== GL_TEXTURE_RECTANGLE_ARB
&& params
[0] > 0)) {
401 _mesa_error(ctx
, GL_INVALID_VALUE
,
402 "glTex%sParameter(param=%d)", suffix
,
406 incomplete(ctx
, texObj
);
408 /** From ARB_texture_storage:
409 * However, if TEXTURE_IMMUTABLE_FORMAT is TRUE, then level_base is
410 * clamped to the range [0, <levels> - 1] and level_max is then clamped to
411 * the range [level_base, <levels> - 1], where <levels> is the parameter
412 * passed the call to TexStorage* for the texture object.
414 if (texObj
->Immutable
)
415 texObj
->MaxLevel
= CLAMP(params
[0], texObj
->BaseLevel
,
416 texObj
->ImmutableLevels
- 1);
418 texObj
->MaxLevel
= params
[0];
422 case GL_GENERATE_MIPMAP_SGIS
:
423 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
426 if (params
[0] && texObj
->Target
== GL_TEXTURE_EXTERNAL_OES
)
428 if (texObj
->GenerateMipmap
!= params
[0]) {
430 texObj
->GenerateMipmap
= params
[0] ? GL_TRUE
: GL_FALSE
;
435 case GL_TEXTURE_COMPARE_MODE_ARB
:
436 if ((_mesa_is_desktop_gl(ctx
) && ctx
->Extensions
.ARB_shadow
)
437 || _mesa_is_gles3(ctx
)) {
439 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
442 if (texObj
->Sampler
.CompareMode
== params
[0])
444 if (params
[0] == GL_NONE
||
445 params
[0] == GL_COMPARE_R_TO_TEXTURE_ARB
) {
447 texObj
->Sampler
.CompareMode
= params
[0];
454 case GL_TEXTURE_COMPARE_FUNC_ARB
:
455 if ((_mesa_is_desktop_gl(ctx
) && ctx
->Extensions
.ARB_shadow
)
456 || _mesa_is_gles3(ctx
)) {
458 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
461 if (texObj
->Sampler
.CompareFunc
== params
[0])
473 texObj
->Sampler
.CompareFunc
= params
[0];
481 case GL_DEPTH_TEXTURE_MODE_ARB
:
482 /* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has never
483 * existed in OpenGL ES.
485 if (ctx
->API
== API_OPENGL_COMPAT
&& ctx
->Extensions
.ARB_depth_texture
) {
486 if (texObj
->DepthMode
== params
[0])
488 if (params
[0] == GL_LUMINANCE
||
489 params
[0] == GL_INTENSITY
||
490 params
[0] == GL_ALPHA
||
491 (ctx
->Extensions
.ARB_texture_rg
&& params
[0] == GL_RED
)) {
493 texObj
->DepthMode
= params
[0];
500 case GL_DEPTH_STENCIL_TEXTURE_MODE
:
501 if (_mesa_has_ARB_stencil_texturing(ctx
) || _mesa_is_gles31(ctx
)) {
502 bool stencil
= params
[0] == GL_STENCIL_INDEX
;
503 if (!stencil
&& params
[0] != GL_DEPTH_COMPONENT
)
506 if (texObj
->StencilSampling
== stencil
)
509 texObj
->StencilSampling
= stencil
;
514 case GL_TEXTURE_CROP_RECT_OES
:
515 if (ctx
->API
!= API_OPENGLES
|| !ctx
->Extensions
.OES_draw_texture
)
518 texObj
->CropRect
[0] = params
[0];
519 texObj
->CropRect
[1] = params
[1];
520 texObj
->CropRect
[2] = params
[2];
521 texObj
->CropRect
[3] = params
[3];
524 case GL_TEXTURE_SWIZZLE_R_EXT
:
525 case GL_TEXTURE_SWIZZLE_G_EXT
:
526 case GL_TEXTURE_SWIZZLE_B_EXT
:
527 case GL_TEXTURE_SWIZZLE_A_EXT
:
528 if ((_mesa_is_desktop_gl(ctx
) && ctx
->Extensions
.EXT_texture_swizzle
)
529 || _mesa_is_gles3(ctx
)) {
530 const GLuint comp
= pname
- GL_TEXTURE_SWIZZLE_R_EXT
;
531 const GLint swz
= comp_to_swizzle(params
[0]);
533 _mesa_error(ctx
, GL_INVALID_ENUM
,
534 "glTex%sParameter(swizzle 0x%x)", suffix
, params
[0]);
540 texObj
->Swizzle
[comp
] = params
[0];
541 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
546 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
547 if ((_mesa_is_desktop_gl(ctx
) && ctx
->Extensions
.EXT_texture_swizzle
)
548 || _mesa_is_gles3(ctx
)) {
551 for (comp
= 0; comp
< 4; comp
++) {
552 const GLint swz
= comp_to_swizzle(params
[comp
]);
554 texObj
->Swizzle
[comp
] = params
[comp
];
555 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
558 _mesa_error(ctx
, GL_INVALID_ENUM
,
559 "glTex%sParameter(swizzle 0x%x)",
560 suffix
, params
[comp
]);
568 case GL_TEXTURE_SRGB_DECODE_EXT
:
569 if (ctx
->Extensions
.EXT_texture_sRGB_decode
) {
570 GLenum decode
= params
[0];
572 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
575 if (decode
== GL_DECODE_EXT
|| decode
== GL_SKIP_DECODE_EXT
) {
576 if (texObj
->Sampler
.sRGBDecode
!= decode
) {
578 texObj
->Sampler
.sRGBDecode
= decode
;
585 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
586 if (_mesa_is_desktop_gl(ctx
)
587 && ctx
->Extensions
.AMD_seamless_cubemap_per_texture
) {
588 GLenum param
= params
[0];
590 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
593 if (param
!= GL_TRUE
&& param
!= GL_FALSE
) {
596 if (param
!= texObj
->Sampler
.CubeMapSeamless
) {
598 texObj
->Sampler
.CubeMapSeamless
= param
;
604 case GL_TEXTURE_TILING_EXT
:
605 if (ctx
->Extensions
.EXT_memory_object
) {
606 texObj
->TextureTiling
= params
[0];
617 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTex%sParameter(pname=%s)",
618 suffix
, _mesa_enum_to_string(pname
));
622 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTex%sParameter(param=%s)",
623 suffix
, _mesa_enum_to_string(params
[0]));
627 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glTex%sParameter(pname=%s)",
628 suffix
, _mesa_enum_to_string(pname
));
632 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTex%sParameter(pname=%s)",
633 suffix
, _mesa_enum_to_string(pname
));
639 * Set a float-valued texture parameter
640 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
643 set_tex_parameterf(struct gl_context
*ctx
,
644 struct gl_texture_object
*texObj
,
645 GLenum pname
, const GLfloat
*params
, bool dsa
)
647 const char *suffix
= dsa
? "ture" : "";
649 if (texObj
->HandleAllocated
) {
650 /* The ARB_bindless_texture spec says:
652 * "The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
653 * CompressedTexImage*, TexBuffer*, TexParameter*, as well as other
654 * functions defined in terms of these, if the texture object to be
655 * modified is referenced by one or more texture or image handles."
657 _mesa_error(ctx
, GL_INVALID_OPERATION
,
658 "glTex%sParameter(immutable texture)", suffix
);
663 case GL_TEXTURE_MIN_LOD
:
664 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
667 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
670 if (texObj
->Sampler
.MinLod
== params
[0])
673 texObj
->Sampler
.MinLod
= params
[0];
676 case GL_TEXTURE_MAX_LOD
:
677 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
680 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
683 if (texObj
->Sampler
.MaxLod
== params
[0])
686 texObj
->Sampler
.MaxLod
= params
[0];
689 case GL_TEXTURE_PRIORITY
:
690 if (ctx
->API
!= API_OPENGL_COMPAT
)
694 texObj
->Priority
= CLAMP(params
[0], 0.0F
, 1.0F
);
697 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
698 if (ctx
->Extensions
.EXT_texture_filter_anisotropic
) {
699 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
702 if (texObj
->Sampler
.MaxAnisotropy
== params
[0])
704 if (params
[0] < 1.0F
) {
705 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTex%sParameter(param)",
710 /* clamp to max, that's what NVIDIA does */
711 texObj
->Sampler
.MaxAnisotropy
= MIN2(params
[0],
712 ctx
->Const
.MaxTextureMaxAnisotropy
);
716 static GLuint count
= 0;
722 case GL_TEXTURE_LOD_BIAS
:
723 /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias. */
724 if (_mesa_is_gles(ctx
))
727 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
730 if (texObj
->Sampler
.LodBias
!= params
[0]) {
732 texObj
->Sampler
.LodBias
= params
[0];
737 case GL_TEXTURE_BORDER_COLOR
:
738 /* Border color exists in desktop OpenGL since 1.0 for GL_CLAMP. In
739 * OpenGL ES 2.0+, it only exists in when GL_OES_texture_border_clamp is
740 * enabled. It is never available in OpenGL ES 1.x.
742 * FIXME: Every driver that supports GLES2 has this extension. Elide
745 if (ctx
->API
== API_OPENGLES
||
746 (ctx
->API
== API_OPENGLES2
&&
747 !ctx
->Extensions
.ARB_texture_border_clamp
))
750 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
))
754 /* ARB_texture_float disables clamping */
755 if (ctx
->Extensions
.ARB_texture_float
) {
756 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = params
[0];
757 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = params
[1];
758 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = params
[2];
759 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = params
[3];
761 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = CLAMP(params
[0], 0.0F
, 1.0F
);
762 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = CLAMP(params
[1], 0.0F
, 1.0F
);
763 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = CLAMP(params
[2], 0.0F
, 1.0F
);
764 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = CLAMP(params
[3], 0.0F
, 1.0F
);
768 case GL_TEXTURE_TILING_EXT
:
769 if (ctx
->Extensions
.EXT_memory_object
) {
770 texObj
->TextureTiling
= params
[0];
781 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTex%sParameter(pname=%s)",
782 suffix
, _mesa_enum_to_string(pname
));
786 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTex%sParameter(pname=%s)",
787 suffix
, _mesa_enum_to_string(pname
));
793 _mesa_texture_parameterf(struct gl_context
*ctx
,
794 struct gl_texture_object
*texObj
,
795 GLenum pname
, GLfloat param
, bool dsa
)
797 GLboolean need_update
;
800 case GL_TEXTURE_MIN_FILTER
:
801 case GL_TEXTURE_MAG_FILTER
:
802 case GL_TEXTURE_WRAP_S
:
803 case GL_TEXTURE_WRAP_T
:
804 case GL_TEXTURE_WRAP_R
:
805 case GL_TEXTURE_BASE_LEVEL
:
806 case GL_TEXTURE_MAX_LEVEL
:
807 case GL_GENERATE_MIPMAP_SGIS
:
808 case GL_TEXTURE_COMPARE_MODE_ARB
:
809 case GL_TEXTURE_COMPARE_FUNC_ARB
:
810 case GL_DEPTH_TEXTURE_MODE_ARB
:
811 case GL_DEPTH_STENCIL_TEXTURE_MODE
:
812 case GL_TEXTURE_SRGB_DECODE_EXT
:
813 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
814 case GL_TEXTURE_SWIZZLE_R_EXT
:
815 case GL_TEXTURE_SWIZZLE_G_EXT
:
816 case GL_TEXTURE_SWIZZLE_B_EXT
:
817 case GL_TEXTURE_SWIZZLE_A_EXT
:
821 ((param
> INT_MAX
) ? INT_MAX
: (GLint
) (param
+ 0.5)) :
822 ((param
< INT_MIN
) ? INT_MIN
: (GLint
) (param
- 0.5));
824 p
[1] = p
[2] = p
[3] = 0;
825 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
, dsa
);
828 case GL_TEXTURE_BORDER_COLOR
:
829 case GL_TEXTURE_SWIZZLE_RGBA
:
830 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTex%sParameterf(non-scalar pname)",
835 /* this will generate an error if pname is illegal */
838 p
[1] = p
[2] = p
[3] = 0.0F
;
839 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, p
, dsa
);
843 if (ctx
->Driver
.TexParameter
&& need_update
) {
844 ctx
->Driver
.TexParameter(ctx
, texObj
, pname
);
850 _mesa_texture_parameterfv(struct gl_context
*ctx
,
851 struct gl_texture_object
*texObj
,
852 GLenum pname
, const GLfloat
*params
, bool dsa
)
854 GLboolean need_update
;
856 case GL_TEXTURE_MIN_FILTER
:
857 case GL_TEXTURE_MAG_FILTER
:
858 case GL_TEXTURE_WRAP_S
:
859 case GL_TEXTURE_WRAP_T
:
860 case GL_TEXTURE_WRAP_R
:
861 case GL_TEXTURE_BASE_LEVEL
:
862 case GL_TEXTURE_MAX_LEVEL
:
863 case GL_GENERATE_MIPMAP_SGIS
:
864 case GL_TEXTURE_COMPARE_MODE_ARB
:
865 case GL_TEXTURE_COMPARE_FUNC_ARB
:
866 case GL_DEPTH_TEXTURE_MODE_ARB
:
867 case GL_DEPTH_STENCIL_TEXTURE_MODE
:
868 case GL_TEXTURE_SRGB_DECODE_EXT
:
869 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
871 /* convert float param to int */
873 p
[0] = (GLint
) params
[0];
874 p
[1] = p
[2] = p
[3] = 0;
875 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
, dsa
);
878 case GL_TEXTURE_CROP_RECT_OES
:
880 /* convert float params to int */
882 iparams
[0] = (GLint
) params
[0];
883 iparams
[1] = (GLint
) params
[1];
884 iparams
[2] = (GLint
) params
[2];
885 iparams
[3] = (GLint
) params
[3];
886 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparams
, dsa
);
889 case GL_TEXTURE_SWIZZLE_R_EXT
:
890 case GL_TEXTURE_SWIZZLE_G_EXT
:
891 case GL_TEXTURE_SWIZZLE_B_EXT
:
892 case GL_TEXTURE_SWIZZLE_A_EXT
:
893 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
895 GLint p
[4] = {0, 0, 0, 0};
896 p
[0] = (GLint
) params
[0];
897 if (pname
== GL_TEXTURE_SWIZZLE_RGBA_EXT
) {
898 p
[1] = (GLint
) params
[1];
899 p
[2] = (GLint
) params
[2];
900 p
[3] = (GLint
) params
[3];
902 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
, dsa
);
906 /* this will generate an error if pname is illegal */
907 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, params
, dsa
);
910 if (ctx
->Driver
.TexParameter
&& need_update
) {
911 ctx
->Driver
.TexParameter(ctx
, texObj
, pname
);
917 _mesa_texture_parameteri(struct gl_context
*ctx
,
918 struct gl_texture_object
*texObj
,
919 GLenum pname
, GLint param
, bool dsa
)
921 GLboolean need_update
;
923 case GL_TEXTURE_MIN_LOD
:
924 case GL_TEXTURE_MAX_LOD
:
925 case GL_TEXTURE_PRIORITY
:
926 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
927 case GL_TEXTURE_LOD_BIAS
:
930 fparam
[0] = (GLfloat
) param
;
931 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
932 /* convert int param to float */
933 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparam
, dsa
);
936 case GL_TEXTURE_BORDER_COLOR
:
937 case GL_TEXTURE_SWIZZLE_RGBA
:
939 _mesa_error(ctx
, GL_INVALID_ENUM
,
940 "glTex%sParameteri(non-scalar pname)",
945 /* this will generate an error if pname is illegal */
949 iparam
[1] = iparam
[2] = iparam
[3] = 0;
950 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparam
, dsa
);
954 if (ctx
->Driver
.TexParameter
&& need_update
) {
955 ctx
->Driver
.TexParameter(ctx
, texObj
, pname
);
961 _mesa_texture_parameteriv(struct gl_context
*ctx
,
962 struct gl_texture_object
*texObj
,
963 GLenum pname
, const GLint
*params
, bool dsa
)
965 GLboolean need_update
;
968 case GL_TEXTURE_BORDER_COLOR
:
970 /* convert int params to float */
972 fparams
[0] = INT_TO_FLOAT(params
[0]);
973 fparams
[1] = INT_TO_FLOAT(params
[1]);
974 fparams
[2] = INT_TO_FLOAT(params
[2]);
975 fparams
[3] = INT_TO_FLOAT(params
[3]);
976 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
, dsa
);
979 case GL_TEXTURE_MIN_LOD
:
980 case GL_TEXTURE_MAX_LOD
:
981 case GL_TEXTURE_PRIORITY
:
982 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
983 case GL_TEXTURE_LOD_BIAS
:
985 /* convert int param to float */
987 fparams
[0] = (GLfloat
) params
[0];
988 fparams
[1] = fparams
[2] = fparams
[3] = 0.0F
;
989 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
, dsa
);
993 /* this will generate an error if pname is illegal */
994 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, params
, dsa
);
997 if (ctx
->Driver
.TexParameter
&& need_update
) {
998 ctx
->Driver
.TexParameter(ctx
, texObj
, pname
);
1003 _mesa_texture_parameterIiv(struct gl_context
*ctx
,
1004 struct gl_texture_object
*texObj
,
1005 GLenum pname
, const GLint
*params
, bool dsa
)
1008 case GL_TEXTURE_BORDER_COLOR
:
1009 if (texObj
->HandleAllocated
) {
1010 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1011 "glTextureParameterIiv(immutable texture)");
1015 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
)) {
1016 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTextureParameterIiv(texture)");
1019 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
1020 /* set the integer-valued border color */
1021 COPY_4V(texObj
->Sampler
.BorderColor
.i
, params
);
1024 _mesa_texture_parameteriv(ctx
, texObj
, pname
, params
, dsa
);
1027 /* XXX no driver hook for TexParameterIiv() yet */
1031 _mesa_texture_parameterIuiv(struct gl_context
*ctx
,
1032 struct gl_texture_object
*texObj
,
1033 GLenum pname
, const GLuint
*params
, bool dsa
)
1036 case GL_TEXTURE_BORDER_COLOR
:
1037 if (texObj
->HandleAllocated
) {
1038 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1039 "glTextureParameterIuiv(immutable texture)");
1043 if (!_mesa_target_allows_setting_sampler_parameters(texObj
->Target
)) {
1044 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTextureParameterIuiv(texture)");
1047 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
1048 /* set the unsigned integer-valued border color */
1049 COPY_4V(texObj
->Sampler
.BorderColor
.ui
, params
);
1052 _mesa_texture_parameteriv(ctx
, texObj
, pname
, (const GLint
*) params
,
1056 /* XXX no driver hook for TexParameterIuiv() yet */
1060 _mesa_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1062 struct gl_texture_object
*texObj
;
1063 GET_CURRENT_CONTEXT(ctx
);
1065 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1066 ctx
->Texture
.CurrentUnit
,
1072 _mesa_texture_parameterf(ctx
, texObj
, pname
, param
, false);
1076 _mesa_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
1078 struct gl_texture_object
*texObj
;
1079 GET_CURRENT_CONTEXT(ctx
);
1081 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1082 ctx
->Texture
.CurrentUnit
,
1084 "glTexParameterfv");
1088 _mesa_texture_parameterfv(ctx
, texObj
, pname
, params
, false);
1092 _mesa_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
1094 struct gl_texture_object
*texObj
;
1095 GET_CURRENT_CONTEXT(ctx
);
1097 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1098 ctx
->Texture
.CurrentUnit
,
1104 _mesa_texture_parameteri(ctx
, texObj
, pname
, param
, false);
1108 _mesa_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1110 struct gl_texture_object
*texObj
;
1111 GET_CURRENT_CONTEXT(ctx
);
1113 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1114 ctx
->Texture
.CurrentUnit
,
1116 "glTexParameteriv");
1120 _mesa_texture_parameteriv(ctx
, texObj
, pname
, params
, false);
1124 * Set tex parameter to integer value(s). Primarily intended to set
1125 * integer-valued texture border color (for integer-valued textures).
1129 _mesa_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
1131 struct gl_texture_object
*texObj
;
1132 GET_CURRENT_CONTEXT(ctx
);
1134 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1135 ctx
->Texture
.CurrentUnit
,
1137 "glTexParameterIiv");
1141 _mesa_texture_parameterIiv(ctx
, texObj
, pname
, params
, false);
1145 * Set tex parameter to unsigned integer value(s). Primarily intended to set
1146 * uint-valued texture border color (for integer-valued textures).
1150 _mesa_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
1152 struct gl_texture_object
*texObj
;
1153 GET_CURRENT_CONTEXT(ctx
);
1155 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1156 ctx
->Texture
.CurrentUnit
,
1158 "glTexParameterIuiv");
1162 _mesa_texture_parameterIuiv(ctx
, texObj
, pname
, params
, false);
1166 _mesa_TextureParameterfvEXT(GLuint texture
, GLenum target
, GLenum pname
, const GLfloat
*params
)
1168 struct gl_texture_object
*texObj
;
1169 GET_CURRENT_CONTEXT(ctx
);
1171 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
1172 "glTextureParameterfvEXT");
1176 if (!is_texparameteri_target_valid(texObj
->Target
)) {
1177 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glTextureParameterfvEXT");
1181 _mesa_texture_parameterfv(ctx
, texObj
, pname
, params
, true);
1185 _mesa_TextureParameterfv(GLuint texture
, GLenum pname
, const GLfloat
*params
)
1187 struct gl_texture_object
*texObj
;
1188 GET_CURRENT_CONTEXT(ctx
);
1190 texObj
= get_texobj_by_name(ctx
, texture
, "glTextureParameterfv");
1194 _mesa_texture_parameterfv(ctx
, texObj
, pname
, params
, true);
1198 _mesa_MultiTexParameterfvEXT(GLenum texunit
, GLenum target
, GLenum pname
, const GLfloat
*params
)
1200 struct gl_texture_object
*texObj
;
1201 GET_CURRENT_CONTEXT(ctx
);
1203 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1204 texunit
- GL_TEXTURE0
,
1206 "glMultiTexParameterfvEXT");
1210 if (!is_texparameteri_target_valid(texObj
->Target
)) {
1211 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glMultiTexParameterifvEXT(target)");
1215 _mesa_texture_parameterfv(ctx
, texObj
, pname
, params
, true);
1219 _mesa_TextureParameterfEXT(GLuint texture
, GLenum target
, GLenum pname
, GLfloat param
)
1221 struct gl_texture_object
*texObj
;
1222 GET_CURRENT_CONTEXT(ctx
);
1224 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
1225 "glTextureParameterfEXT");
1229 if (!is_texparameteri_target_valid(texObj
->Target
)) {
1230 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glTextureParameterfEXT");
1234 _mesa_texture_parameterf(ctx
, texObj
, pname
, param
, true);
1238 _mesa_MultiTexParameterfEXT(GLenum texunit
, GLenum target
, GLenum pname
,
1241 struct gl_texture_object
*texObj
;
1242 GET_CURRENT_CONTEXT(ctx
);
1244 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1245 texunit
- GL_TEXTURE0
,
1247 "glMultiTexParameterfEXT");
1251 if (!is_texparameteri_target_valid(texObj
->Target
)) {
1252 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glMultiTexParameterfEXT");
1256 _mesa_texture_parameterf(ctx
, texObj
, pname
, param
, true);
1260 _mesa_TextureParameterf(GLuint texture
, GLenum pname
, GLfloat param
)
1262 struct gl_texture_object
*texObj
;
1263 GET_CURRENT_CONTEXT(ctx
);
1265 texObj
= get_texobj_by_name(ctx
, texture
, "glTextureParameterf");
1269 _mesa_texture_parameterf(ctx
, texObj
, pname
, param
, true);
1273 _mesa_TextureParameteriEXT(GLuint texture
, GLenum target
, GLenum pname
, GLint param
)
1275 struct gl_texture_object
*texObj
;
1276 GET_CURRENT_CONTEXT(ctx
);
1278 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
1279 "glTextureParameteriEXT");
1283 if (!is_texparameteri_target_valid(texObj
->Target
)) {
1284 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glTextureParameteriEXT(target)");
1288 _mesa_texture_parameteri(ctx
, texObj
, pname
, param
, true);
1292 _mesa_MultiTexParameteriEXT(GLenum texunit
, GLenum target
, GLenum pname
,
1295 struct gl_texture_object
*texObj
;
1296 GET_CURRENT_CONTEXT(ctx
);
1298 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1299 texunit
- GL_TEXTURE0
,
1301 "glMultiTexParameteriEXT");
1305 if (!is_texparameteri_target_valid(texObj
->Target
)) {
1306 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glMultiTexParameteriEXT(target)");
1310 _mesa_texture_parameteri(ctx
, texObj
, pname
, param
, true);
1314 _mesa_TextureParameteri(GLuint texture
, GLenum pname
, GLint param
)
1316 struct gl_texture_object
*texObj
;
1317 GET_CURRENT_CONTEXT(ctx
);
1319 texObj
= get_texobj_by_name(ctx
, texture
, "glTextureParameteri");
1323 _mesa_texture_parameteri(ctx
, texObj
, pname
, param
, true);
1327 _mesa_TextureParameterivEXT(GLuint texture
, GLenum target
, GLenum pname
,
1328 const GLint
*params
)
1330 struct gl_texture_object
*texObj
;
1331 GET_CURRENT_CONTEXT(ctx
);
1333 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
1334 "glTextureParameterivEXT");
1338 if (!is_texparameteri_target_valid(texObj
->Target
)) {
1339 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glTextureParameterivEXT(target)");
1343 _mesa_texture_parameteriv(ctx
, texObj
, pname
, params
, true);
1347 _mesa_MultiTexParameterivEXT(GLenum texunit
, GLenum target
, GLenum pname
,
1348 const GLint
*params
)
1350 struct gl_texture_object
*texObj
;
1351 GET_CURRENT_CONTEXT(ctx
);
1353 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1354 texunit
- GL_TEXTURE0
,
1356 "glMultiTexParameterivEXT");
1360 if (!is_texparameteri_target_valid(texObj
->Target
)) {
1361 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glMultiTexParameterivEXT(target)");
1365 _mesa_texture_parameteriv(ctx
, texObj
, pname
, params
, true);
1369 _mesa_TextureParameteriv(GLuint texture
, GLenum pname
,
1370 const GLint
*params
)
1372 struct gl_texture_object
*texObj
;
1373 GET_CURRENT_CONTEXT(ctx
);
1375 texObj
= get_texobj_by_name(ctx
, texture
, "glTextureParameteriv");
1379 _mesa_texture_parameteriv(ctx
, texObj
, pname
, params
, true);
1384 _mesa_TextureParameterIiv(GLuint texture
, GLenum pname
, const GLint
*params
)
1386 struct gl_texture_object
*texObj
;
1387 GET_CURRENT_CONTEXT(ctx
);
1389 texObj
= get_texobj_by_name(ctx
, texture
, "glTextureParameterIiv");
1393 _mesa_texture_parameterIiv(ctx
, texObj
, pname
, params
, true);
1397 _mesa_TextureParameterIivEXT(GLuint texture
, GLenum target
, GLenum pname
,
1398 const GLint
*params
)
1400 struct gl_texture_object
*texObj
;
1401 GET_CURRENT_CONTEXT(ctx
);
1403 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
1404 "glTextureParameterIivEXT");
1408 _mesa_texture_parameterIiv(ctx
, texObj
, pname
, params
, true);
1412 _mesa_MultiTexParameterIivEXT(GLenum texunit
, GLenum target
, GLenum pname
,
1413 const GLint
*params
)
1415 struct gl_texture_object
*texObj
;
1416 GET_CURRENT_CONTEXT(ctx
);
1418 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1419 texunit
- GL_TEXTURE0
,
1421 "glMultiTexParameterIivEXT");
1425 _mesa_texture_parameterIiv(ctx
, texObj
, pname
, params
, true);
1429 _mesa_TextureParameterIuiv(GLuint texture
, GLenum pname
, const GLuint
*params
)
1431 struct gl_texture_object
*texObj
;
1432 GET_CURRENT_CONTEXT(ctx
);
1434 texObj
= get_texobj_by_name(ctx
, texture
, "glTextureParameterIuiv");
1438 _mesa_texture_parameterIuiv(ctx
, texObj
, pname
, params
, true);
1442 _mesa_TextureParameterIuivEXT(GLuint texture
, GLenum target
, GLenum pname
,
1443 const GLuint
*params
)
1445 struct gl_texture_object
*texObj
;
1446 GET_CURRENT_CONTEXT(ctx
);
1448 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
1449 "glTextureParameterIuivEXT");
1453 _mesa_texture_parameterIuiv(ctx
, texObj
, pname
, params
, true);
1457 _mesa_MultiTexParameterIuivEXT(GLenum texunit
, GLenum target
, GLenum pname
,
1458 const GLuint
*params
)
1460 struct gl_texture_object
*texObj
;
1461 GET_CURRENT_CONTEXT(ctx
);
1463 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
1464 texunit
- GL_TEXTURE0
,
1466 "glMultiTexParameterIuivEXT");
1470 _mesa_texture_parameterIuiv(ctx
, texObj
, pname
, params
, true);
1474 _mesa_legal_get_tex_level_parameter_target(struct gl_context
*ctx
, GLenum target
,
1477 /* Common targets for desktop GL and GLES 3.1. */
1482 case GL_TEXTURE_2D_ARRAY_EXT
:
1483 return ctx
->Extensions
.EXT_texture_array
;
1484 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
1485 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
1486 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
1487 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
1488 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
1489 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
1490 return ctx
->Extensions
.ARB_texture_cube_map
;
1491 case GL_TEXTURE_2D_MULTISAMPLE
:
1492 case GL_TEXTURE_2D_MULTISAMPLE_ARRAY
:
1493 return ctx
->Extensions
.ARB_texture_multisample
;
1494 case GL_TEXTURE_BUFFER
:
1495 /* GetTexLevelParameter accepts GL_TEXTURE_BUFFER in GL 3.1+ contexts,
1496 * but not in earlier versions that expose ARB_texture_buffer_object.
1498 * From the ARB_texture_buffer_object spec:
1499 * "(7) Do buffer textures support texture parameters (TexParameter) or
1500 * queries (GetTexParameter, GetTexLevelParameter, GetTexImage)?
1502 * RESOLVED: No. [...] Note that the spec edits above don't add
1503 * explicit error language for any of these cases. That is because
1504 * each of the functions enumerate the set of valid <target>
1505 * parameters. Not editing the spec to allow TEXTURE_BUFFER_ARB in
1506 * these cases means that target is not legal, and an INVALID_ENUM
1507 * error should be generated."
1509 * From the OpenGL 3.1 spec:
1510 * "target may also be TEXTURE_BUFFER, indicating the texture buffer."
1512 return (_mesa_is_desktop_gl(ctx
) && ctx
->Version
>= 31) ||
1513 _mesa_has_OES_texture_buffer(ctx
);
1514 case GL_TEXTURE_CUBE_MAP_ARRAY
:
1515 return _mesa_has_texture_cube_map_array(ctx
);
1518 if (!_mesa_is_desktop_gl(ctx
))
1521 /* Rest of the desktop GL targets. */
1524 case GL_PROXY_TEXTURE_1D
:
1525 case GL_PROXY_TEXTURE_2D
:
1526 case GL_PROXY_TEXTURE_3D
:
1528 case GL_PROXY_TEXTURE_CUBE_MAP
:
1529 return ctx
->Extensions
.ARB_texture_cube_map
;
1530 case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY
:
1531 return ctx
->Extensions
.ARB_texture_cube_map_array
;
1532 case GL_TEXTURE_RECTANGLE_NV
:
1533 case GL_PROXY_TEXTURE_RECTANGLE_NV
:
1534 return ctx
->Extensions
.NV_texture_rectangle
;
1535 case GL_TEXTURE_1D_ARRAY_EXT
:
1536 case GL_PROXY_TEXTURE_1D_ARRAY_EXT
:
1537 case GL_PROXY_TEXTURE_2D_ARRAY_EXT
:
1538 return ctx
->Extensions
.EXT_texture_array
;
1539 case GL_PROXY_TEXTURE_2D_MULTISAMPLE
:
1540 case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY
:
1541 return ctx
->Extensions
.ARB_texture_multisample
;
1543 /* This is a valid target for dsa, but the OpenGL 4.5 core spec
1544 * (30.10.2014) Section 8.11 Texture Queries says:
1545 * "For GetTextureLevelParameter* only, texture may also be a cube
1546 * map texture object. In this case the query is always performed
1547 * for face zero (the TEXTURE_CUBE_MAP_POSITIVE_X face), since there
1548 * is no way to specify another face."
1550 case GL_TEXTURE_CUBE_MAP
:
1559 get_tex_level_parameter_image(struct gl_context
*ctx
,
1560 const struct gl_texture_object
*texObj
,
1561 GLenum target
, GLint level
,
1562 GLenum pname
, GLint
*params
,
1565 const struct gl_texture_image
*img
= NULL
;
1566 struct gl_texture_image dummy_image
;
1567 mesa_format texFormat
;
1568 const char *suffix
= dsa
? "ture" : "";
1570 img
= _mesa_select_tex_image(texObj
, target
, level
);
1571 if (!img
|| img
->TexFormat
== MESA_FORMAT_NONE
) {
1572 /* In case of undefined texture image return the default values.
1574 * From OpenGL 4.0 spec, page 398:
1575 * "The initial internal format of a texel array is RGBA
1576 * instead of 1. TEXTURE_COMPONENTS is deprecated; always
1577 * use TEXTURE_INTERNAL_FORMAT."
1579 memset(&dummy_image
, 0, sizeof(dummy_image
));
1580 dummy_image
.TexFormat
= MESA_FORMAT_NONE
;
1581 dummy_image
.InternalFormat
= GL_RGBA
;
1582 dummy_image
._BaseFormat
= GL_NONE
;
1583 dummy_image
.FixedSampleLocations
= GL_TRUE
;
1588 texFormat
= img
->TexFormat
;
1591 case GL_TEXTURE_WIDTH
:
1592 *params
= img
->Width
;
1594 case GL_TEXTURE_HEIGHT
:
1595 *params
= img
->Height
;
1597 case GL_TEXTURE_DEPTH
:
1598 *params
= img
->Depth
;
1600 case GL_TEXTURE_INTERNAL_FORMAT
:
1601 if (_mesa_is_format_compressed(texFormat
)) {
1602 /* need to return the actual compressed format */
1603 *params
= _mesa_compressed_format_to_glenum(ctx
, texFormat
);
1606 /* If the true internal format is not compressed but the user
1607 * requested a generic compressed format, we have to return the
1608 * generic base format that matches.
1610 * From page 119 (page 129 of the PDF) of the OpenGL 1.3 spec:
1612 * "If no specific compressed format is available,
1613 * internalformat is instead replaced by the corresponding base
1616 * Otherwise just return the user's requested internal format
1619 _mesa_gl_compressed_format_base_format(img
->InternalFormat
);
1621 *params
= (f
!= 0) ? f
: img
->InternalFormat
;
1624 case GL_TEXTURE_BORDER
:
1625 if (ctx
->API
!= API_OPENGL_COMPAT
)
1627 *params
= img
->Border
;
1629 case GL_TEXTURE_RED_SIZE
:
1630 case GL_TEXTURE_GREEN_SIZE
:
1631 case GL_TEXTURE_BLUE_SIZE
:
1632 case GL_TEXTURE_ALPHA_SIZE
:
1633 if (_mesa_base_format_has_channel(img
->_BaseFormat
, pname
))
1634 *params
= _mesa_get_format_bits(texFormat
, pname
);
1638 case GL_TEXTURE_INTENSITY_SIZE
:
1639 case GL_TEXTURE_LUMINANCE_SIZE
:
1640 if (ctx
->API
!= API_OPENGL_COMPAT
)
1642 if (_mesa_base_format_has_channel(img
->_BaseFormat
, pname
)) {
1643 *params
= _mesa_get_format_bits(texFormat
, pname
);
1645 /* intensity or luminance is probably stored as RGB[A] */
1646 *params
= MIN2(_mesa_get_format_bits(texFormat
,
1647 GL_TEXTURE_RED_SIZE
),
1648 _mesa_get_format_bits(texFormat
,
1649 GL_TEXTURE_GREEN_SIZE
));
1651 if (*params
== 0 && pname
== GL_TEXTURE_INTENSITY_SIZE
) {
1652 /* Gallium may store intensity as LA */
1653 *params
= _mesa_get_format_bits(texFormat
,
1654 GL_TEXTURE_ALPHA_SIZE
);
1661 case GL_TEXTURE_DEPTH_SIZE_ARB
:
1662 if (!ctx
->Extensions
.ARB_depth_texture
)
1664 *params
= _mesa_get_format_bits(texFormat
, pname
);
1666 case GL_TEXTURE_STENCIL_SIZE
:
1667 *params
= _mesa_get_format_bits(texFormat
, pname
);
1669 case GL_TEXTURE_SHARED_SIZE
:
1670 if (ctx
->Version
< 30 &&
1671 !ctx
->Extensions
.EXT_texture_shared_exponent
)
1673 *params
= texFormat
== MESA_FORMAT_R9G9B9E5_FLOAT
? 5 : 0;
1676 /* GL_ARB_texture_compression */
1677 case GL_TEXTURE_COMPRESSED_IMAGE_SIZE
:
1678 if (_mesa_is_format_compressed(texFormat
) &&
1679 !_mesa_is_proxy_texture(target
)) {
1680 *params
= _mesa_format_image_size(texFormat
, img
->Width
,
1681 img
->Height
, img
->Depth
);
1683 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1684 "glGetTex%sLevelParameter[if]v(pname=%s)", suffix
,
1685 _mesa_enum_to_string(pname
));
1688 case GL_TEXTURE_COMPRESSED
:
1689 *params
= (GLint
) _mesa_is_format_compressed(texFormat
);
1692 /* GL_ARB_texture_float */
1693 case GL_TEXTURE_LUMINANCE_TYPE_ARB
:
1694 case GL_TEXTURE_INTENSITY_TYPE_ARB
:
1695 if (ctx
->API
!= API_OPENGL_COMPAT
)
1698 case GL_TEXTURE_RED_TYPE_ARB
:
1699 case GL_TEXTURE_GREEN_TYPE_ARB
:
1700 case GL_TEXTURE_BLUE_TYPE_ARB
:
1701 case GL_TEXTURE_ALPHA_TYPE_ARB
:
1702 case GL_TEXTURE_DEPTH_TYPE_ARB
:
1703 if (!ctx
->Extensions
.ARB_texture_float
)
1705 if (_mesa_base_format_has_channel(img
->_BaseFormat
, pname
))
1706 *params
= _mesa_get_format_datatype(texFormat
);
1711 /* GL_ARB_texture_multisample */
1712 case GL_TEXTURE_SAMPLES
:
1713 if (!ctx
->Extensions
.ARB_texture_multisample
)
1715 *params
= img
->NumSamples
;
1718 case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS
:
1719 if (!ctx
->Extensions
.ARB_texture_multisample
)
1721 *params
= img
->FixedSampleLocations
;
1724 /* There is never a buffer data store here, but these pnames still have
1728 /* GL_ARB_texture_buffer_object */
1729 case GL_TEXTURE_BUFFER_DATA_STORE_BINDING
:
1730 if (!ctx
->Extensions
.ARB_texture_buffer_object
)
1735 /* GL_ARB_texture_buffer_range */
1736 case GL_TEXTURE_BUFFER_OFFSET
:
1737 if (!ctx
->Extensions
.ARB_texture_buffer_range
)
1741 case GL_TEXTURE_BUFFER_SIZE
:
1742 if (!ctx
->Extensions
.ARB_texture_buffer_range
)
1751 /* no error if we get here */
1755 _mesa_error(ctx
, GL_INVALID_ENUM
,
1756 "glGetTex%sLevelParameter[if]v(pname=%s)", suffix
,
1757 _mesa_enum_to_string(pname
));
1762 * Handle a glGetTexLevelParamteriv() call for a texture buffer.
1765 get_tex_level_parameter_buffer(struct gl_context
*ctx
,
1766 const struct gl_texture_object
*texObj
,
1767 GLenum pname
, GLint
*params
, bool dsa
)
1769 const struct gl_buffer_object
*bo
= texObj
->BufferObject
;
1770 mesa_format texFormat
= texObj
->_BufferObjectFormat
;
1771 int bytes
= MAX2(1, _mesa_get_format_bytes(texFormat
));
1772 GLenum internalFormat
= texObj
->BufferObjectFormat
;
1773 GLenum baseFormat
= _mesa_get_format_base_format(texFormat
);
1774 const char *suffix
= dsa
? "ture" : "";
1776 assert(texObj
->Target
== GL_TEXTURE_BUFFER
);
1779 /* undefined texture buffer object */
1781 case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS
:
1784 case GL_TEXTURE_INTERNAL_FORMAT
:
1785 *params
= internalFormat
;
1795 case GL_TEXTURE_BUFFER_DATA_STORE_BINDING
:
1798 case GL_TEXTURE_WIDTH
:
1799 *params
= ((texObj
->BufferSize
== -1) ? bo
->Size
: texObj
->BufferSize
)
1802 case GL_TEXTURE_HEIGHT
:
1803 case GL_TEXTURE_DEPTH
:
1806 case GL_TEXTURE_BORDER
:
1807 case GL_TEXTURE_SHARED_SIZE
:
1808 case GL_TEXTURE_COMPRESSED
:
1811 case GL_TEXTURE_INTERNAL_FORMAT
:
1812 *params
= internalFormat
;
1814 case GL_TEXTURE_RED_SIZE
:
1815 case GL_TEXTURE_GREEN_SIZE
:
1816 case GL_TEXTURE_BLUE_SIZE
:
1817 case GL_TEXTURE_ALPHA_SIZE
:
1818 if (_mesa_base_format_has_channel(baseFormat
, pname
))
1819 *params
= _mesa_get_format_bits(texFormat
, pname
);
1823 case GL_TEXTURE_INTENSITY_SIZE
:
1824 case GL_TEXTURE_LUMINANCE_SIZE
:
1825 if (_mesa_base_format_has_channel(baseFormat
, pname
)) {
1826 *params
= _mesa_get_format_bits(texFormat
, pname
);
1828 /* intensity or luminance is probably stored as RGB[A] */
1829 *params
= MIN2(_mesa_get_format_bits(texFormat
,
1830 GL_TEXTURE_RED_SIZE
),
1831 _mesa_get_format_bits(texFormat
,
1832 GL_TEXTURE_GREEN_SIZE
));
1838 case GL_TEXTURE_DEPTH_SIZE_ARB
:
1839 case GL_TEXTURE_STENCIL_SIZE_EXT
:
1840 *params
= _mesa_get_format_bits(texFormat
, pname
);
1843 /* GL_ARB_texture_buffer_range */
1844 case GL_TEXTURE_BUFFER_OFFSET
:
1845 if (!ctx
->Extensions
.ARB_texture_buffer_range
)
1847 *params
= texObj
->BufferOffset
;
1849 case GL_TEXTURE_BUFFER_SIZE
:
1850 if (!ctx
->Extensions
.ARB_texture_buffer_range
)
1852 *params
= (texObj
->BufferSize
== -1) ? bo
->Size
: texObj
->BufferSize
;
1855 /* GL_ARB_texture_multisample */
1856 case GL_TEXTURE_SAMPLES
:
1857 if (!ctx
->Extensions
.ARB_texture_multisample
)
1862 case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS
:
1863 if (!ctx
->Extensions
.ARB_texture_multisample
)
1868 /* GL_ARB_texture_compression */
1869 case GL_TEXTURE_COMPRESSED_IMAGE_SIZE
:
1870 /* Always illegal for GL_TEXTURE_BUFFER */
1871 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1872 "glGetTex%sLevelParameter[if]v(pname=%s)", suffix
,
1873 _mesa_enum_to_string(pname
));
1876 /* GL_ARB_texture_float */
1877 case GL_TEXTURE_RED_TYPE_ARB
:
1878 case GL_TEXTURE_GREEN_TYPE_ARB
:
1879 case GL_TEXTURE_BLUE_TYPE_ARB
:
1880 case GL_TEXTURE_ALPHA_TYPE_ARB
:
1881 case GL_TEXTURE_LUMINANCE_TYPE_ARB
:
1882 case GL_TEXTURE_INTENSITY_TYPE_ARB
:
1883 case GL_TEXTURE_DEPTH_TYPE_ARB
:
1884 if (!ctx
->Extensions
.ARB_texture_float
)
1886 if (_mesa_base_format_has_channel(baseFormat
, pname
))
1887 *params
= _mesa_get_format_datatype(texFormat
);
1896 /* no error if we get here */
1900 _mesa_error(ctx
, GL_INVALID_ENUM
,
1901 "glGetTex%sLevelParameter[if]v(pname=%s)", suffix
,
1902 _mesa_enum_to_string(pname
));
1906 valid_tex_level_parameteriv_target(struct gl_context
*ctx
, GLenum target
,
1909 const char *suffix
= dsa
? "ture" : "";
1910 if (!_mesa_legal_get_tex_level_parameter_target(ctx
, target
, dsa
)) {
1911 _mesa_error(ctx
, GL_INVALID_ENUM
,
1912 "glGetTex%sLevelParameter[if]v(target=%s)", suffix
,
1913 _mesa_enum_to_string(target
));
1920 * This isn't exposed to the rest of the driver because it is a part of the
1921 * OpenGL API that is rarely used.
1924 get_tex_level_parameteriv(struct gl_context
*ctx
,
1925 struct gl_texture_object
*texObj
,
1926 GLenum target
, GLint level
,
1927 GLenum pname
, GLint
*params
,
1931 const char *suffix
= dsa
? "ture" : "";
1933 /* Check for errors */
1934 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
1935 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1936 "glGetTex%sLevelParameter[if]v("
1937 "current unit >= max combined texture units)", suffix
);
1941 maxLevels
= _mesa_max_texture_levels(ctx
, target
);
1942 assert(maxLevels
!= 0);
1944 if (level
< 0 || level
>= maxLevels
) {
1945 _mesa_error(ctx
, GL_INVALID_VALUE
,
1946 "glGetTex%sLevelParameter[if]v(level out of range)", suffix
);
1950 /* Get the level parameter */
1951 if (target
== GL_TEXTURE_BUFFER
) {
1952 get_tex_level_parameter_buffer(ctx
, texObj
, pname
, params
, dsa
);
1955 get_tex_level_parameter_image(ctx
, texObj
, target
,
1956 level
, pname
, params
, dsa
);
1961 _mesa_GetTexLevelParameterfv( GLenum target
, GLint level
,
1962 GLenum pname
, GLfloat
*params
)
1964 struct gl_texture_object
*texObj
;
1966 GET_CURRENT_CONTEXT(ctx
);
1968 if (!valid_tex_level_parameteriv_target(ctx
, target
, false))
1971 texObj
= _mesa_get_current_tex_object(ctx
, target
);
1975 get_tex_level_parameteriv(ctx
, texObj
, target
, level
,
1976 pname
, &iparam
, false);
1978 *params
= (GLfloat
) iparam
;
1982 _mesa_GetTexLevelParameteriv( GLenum target
, GLint level
,
1983 GLenum pname
, GLint
*params
)
1985 struct gl_texture_object
*texObj
;
1986 GET_CURRENT_CONTEXT(ctx
);
1988 if (!valid_tex_level_parameteriv_target(ctx
, target
, false))
1991 texObj
= _mesa_get_current_tex_object(ctx
, target
);
1995 get_tex_level_parameteriv(ctx
, texObj
, target
, level
,
1996 pname
, params
, false);
2000 _mesa_GetTextureLevelParameterfv(GLuint texture
, GLint level
,
2001 GLenum pname
, GLfloat
*params
)
2003 struct gl_texture_object
*texObj
;
2005 GET_CURRENT_CONTEXT(ctx
);
2007 texObj
= _mesa_lookup_texture_err(ctx
, texture
,
2008 "glGetTextureLevelParameterfv");
2012 if (!valid_tex_level_parameteriv_target(ctx
, texObj
->Target
, true))
2015 get_tex_level_parameteriv(ctx
, texObj
, texObj
->Target
, level
,
2016 pname
, &iparam
, true);
2018 *params
= (GLfloat
) iparam
;
2022 _mesa_GetTextureLevelParameterfvEXT(GLuint texture
, GLenum target
, GLint level
,
2023 GLenum pname
, GLfloat
*params
)
2025 struct gl_texture_object
*texObj
;
2027 GET_CURRENT_CONTEXT(ctx
);
2029 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
2030 "glGetTextureLevelParameterfvEXT");
2034 if (!valid_tex_level_parameteriv_target(ctx
, texObj
->Target
, true))
2037 get_tex_level_parameteriv(ctx
, texObj
, texObj
->Target
, level
,
2038 pname
, &iparam
, true);
2040 *params
= (GLfloat
) iparam
;
2044 _mesa_GetMultiTexLevelParameterfvEXT(GLenum texunit
, GLenum target
, GLint level
,
2045 GLenum pname
, GLfloat
*params
)
2047 struct gl_texture_object
*texObj
;
2049 GET_CURRENT_CONTEXT(ctx
);
2051 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2052 texunit
- GL_TEXTURE0
,
2054 "glGetMultiTexLevelParameterfvEXT");
2058 if (!valid_tex_level_parameteriv_target(ctx
, texObj
->Target
, true))
2061 get_tex_level_parameteriv(ctx
, texObj
, texObj
->Target
, level
,
2062 pname
, &iparam
, true);
2064 *params
= (GLfloat
) iparam
;
2068 _mesa_GetTextureLevelParameteriv(GLuint texture
, GLint level
,
2069 GLenum pname
, GLint
*params
)
2071 struct gl_texture_object
*texObj
;
2072 GET_CURRENT_CONTEXT(ctx
);
2074 texObj
= _mesa_lookup_texture_err(ctx
, texture
,
2075 "glGetTextureLevelParameteriv");
2079 if (!valid_tex_level_parameteriv_target(ctx
, texObj
->Target
, true))
2082 get_tex_level_parameteriv(ctx
, texObj
, texObj
->Target
, level
,
2083 pname
, params
, true);
2087 _mesa_GetTextureLevelParameterivEXT(GLuint texture
, GLenum target
, GLint level
,
2088 GLenum pname
, GLint
*params
)
2090 struct gl_texture_object
*texObj
;
2091 GET_CURRENT_CONTEXT(ctx
);
2093 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
2094 "glGetTextureLevelParameterivEXT");
2098 if (!valid_tex_level_parameteriv_target(ctx
, texObj
->Target
, true))
2101 get_tex_level_parameteriv(ctx
, texObj
, texObj
->Target
, level
,
2102 pname
, params
, true);
2106 _mesa_GetMultiTexLevelParameterivEXT(GLenum texunit
, GLenum target
, GLint level
,
2107 GLenum pname
, GLint
*params
)
2109 struct gl_texture_object
*texObj
;
2110 GET_CURRENT_CONTEXT(ctx
);
2112 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2113 texunit
- GL_TEXTURE0
,
2115 "glGetMultiTexLevelParameterivEXT");
2119 if (!valid_tex_level_parameteriv_target(ctx
, texObj
->Target
, true))
2122 get_tex_level_parameteriv(ctx
, texObj
, texObj
->Target
, level
,
2123 pname
, params
, true);
2128 * This isn't exposed to the rest of the driver because it is a part of the
2129 * OpenGL API that is rarely used.
2132 get_tex_parameterfv(struct gl_context
*ctx
,
2133 struct gl_texture_object
*obj
,
2134 GLenum pname
, GLfloat
*params
, bool dsa
)
2136 _mesa_lock_context_textures(ctx
);
2138 case GL_TEXTURE_MAG_FILTER
:
2139 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MagFilter
);
2141 case GL_TEXTURE_MIN_FILTER
:
2142 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MinFilter
);
2144 case GL_TEXTURE_WRAP_S
:
2145 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapS
);
2147 case GL_TEXTURE_WRAP_T
:
2148 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapT
);
2150 case GL_TEXTURE_WRAP_R
:
2151 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapR
);
2153 case GL_TEXTURE_BORDER_COLOR
:
2154 if (ctx
->API
== API_OPENGLES
||
2155 !ctx
->Extensions
.ARB_texture_border_clamp
)
2158 if (_mesa_get_clamp_fragment_color(ctx
, ctx
->DrawBuffer
)) {
2159 params
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
2160 params
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
2161 params
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
2162 params
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
2165 params
[0] = obj
->Sampler
.BorderColor
.f
[0];
2166 params
[1] = obj
->Sampler
.BorderColor
.f
[1];
2167 params
[2] = obj
->Sampler
.BorderColor
.f
[2];
2168 params
[3] = obj
->Sampler
.BorderColor
.f
[3];
2171 case GL_TEXTURE_RESIDENT
:
2172 if (ctx
->API
!= API_OPENGL_COMPAT
)
2177 case GL_TEXTURE_PRIORITY
:
2178 if (ctx
->API
!= API_OPENGL_COMPAT
)
2181 *params
= obj
->Priority
;
2183 case GL_TEXTURE_MIN_LOD
:
2184 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
2187 *params
= obj
->Sampler
.MinLod
;
2189 case GL_TEXTURE_MAX_LOD
:
2190 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
2193 *params
= obj
->Sampler
.MaxLod
;
2195 case GL_TEXTURE_BASE_LEVEL
:
2196 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
2199 *params
= (GLfloat
) obj
->BaseLevel
;
2201 case GL_TEXTURE_MAX_LEVEL
:
2202 *params
= (GLfloat
) obj
->MaxLevel
;
2204 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
2205 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
2207 *params
= obj
->Sampler
.MaxAnisotropy
;
2209 case GL_GENERATE_MIPMAP_SGIS
:
2210 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
2213 *params
= (GLfloat
) obj
->GenerateMipmap
;
2215 case GL_TEXTURE_COMPARE_MODE_ARB
:
2216 if ((!_mesa_is_desktop_gl(ctx
) || !ctx
->Extensions
.ARB_shadow
)
2217 && !_mesa_is_gles3(ctx
))
2219 *params
= (GLfloat
) obj
->Sampler
.CompareMode
;
2221 case GL_TEXTURE_COMPARE_FUNC_ARB
:
2222 if ((!_mesa_is_desktop_gl(ctx
) || !ctx
->Extensions
.ARB_shadow
)
2223 && !_mesa_is_gles3(ctx
))
2225 *params
= (GLfloat
) obj
->Sampler
.CompareFunc
;
2227 case GL_DEPTH_TEXTURE_MODE_ARB
:
2228 /* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has
2229 * never existed in OpenGL ES.
2231 if (ctx
->API
!= API_OPENGL_COMPAT
|| !ctx
->Extensions
.ARB_depth_texture
)
2233 *params
= (GLfloat
) obj
->DepthMode
;
2235 case GL_DEPTH_STENCIL_TEXTURE_MODE
:
2236 if (!_mesa_has_ARB_stencil_texturing(ctx
) && !_mesa_is_gles31(ctx
))
2239 (obj
->StencilSampling
? GL_STENCIL_INDEX
: GL_DEPTH_COMPONENT
);
2241 case GL_TEXTURE_LOD_BIAS
:
2242 if (_mesa_is_gles(ctx
))
2245 *params
= obj
->Sampler
.LodBias
;
2247 case GL_TEXTURE_CROP_RECT_OES
:
2248 if (ctx
->API
!= API_OPENGLES
|| !ctx
->Extensions
.OES_draw_texture
)
2251 params
[0] = (GLfloat
) obj
->CropRect
[0];
2252 params
[1] = (GLfloat
) obj
->CropRect
[1];
2253 params
[2] = (GLfloat
) obj
->CropRect
[2];
2254 params
[3] = (GLfloat
) obj
->CropRect
[3];
2257 case GL_TEXTURE_SWIZZLE_R_EXT
:
2258 case GL_TEXTURE_SWIZZLE_G_EXT
:
2259 case GL_TEXTURE_SWIZZLE_B_EXT
:
2260 case GL_TEXTURE_SWIZZLE_A_EXT
:
2261 if ((!_mesa_is_desktop_gl(ctx
)
2262 || !ctx
->Extensions
.EXT_texture_swizzle
)
2263 && !_mesa_is_gles3(ctx
))
2265 *params
= (GLfloat
) obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
2268 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
2269 if ((!_mesa_is_desktop_gl(ctx
)
2270 || !ctx
->Extensions
.EXT_texture_swizzle
)
2271 && !_mesa_is_gles3(ctx
)) {
2276 for (comp
= 0; comp
< 4; comp
++) {
2277 params
[comp
] = (GLfloat
) obj
->Swizzle
[comp
];
2282 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
2283 if (!_mesa_is_desktop_gl(ctx
)
2284 || !ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
2286 *params
= (GLfloat
) obj
->Sampler
.CubeMapSeamless
;
2289 case GL_TEXTURE_IMMUTABLE_FORMAT
:
2290 *params
= (GLfloat
) obj
->Immutable
;
2293 case GL_TEXTURE_IMMUTABLE_LEVELS
:
2294 if (_mesa_is_gles3(ctx
) || _mesa_has_texture_view(ctx
))
2295 *params
= (GLfloat
) obj
->ImmutableLevels
;
2300 case GL_TEXTURE_VIEW_MIN_LEVEL
:
2301 if (!_mesa_has_texture_view(ctx
))
2303 *params
= (GLfloat
) obj
->MinLevel
;
2306 case GL_TEXTURE_VIEW_NUM_LEVELS
:
2307 if (!_mesa_has_texture_view(ctx
))
2309 *params
= (GLfloat
) obj
->NumLevels
;
2312 case GL_TEXTURE_VIEW_MIN_LAYER
:
2313 if (!_mesa_has_texture_view(ctx
))
2315 *params
= (GLfloat
) obj
->MinLayer
;
2318 case GL_TEXTURE_VIEW_NUM_LAYERS
:
2319 if (!_mesa_has_texture_view(ctx
))
2321 *params
= (GLfloat
) obj
->NumLayers
;
2324 case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES
:
2325 if (!_mesa_is_gles(ctx
) || !ctx
->Extensions
.OES_EGL_image_external
)
2327 *params
= (GLfloat
) obj
->RequiredTextureImageUnits
;
2330 case GL_TEXTURE_SRGB_DECODE_EXT
:
2331 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
2333 *params
= (GLfloat
) obj
->Sampler
.sRGBDecode
;
2336 case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE
:
2337 if (!ctx
->Extensions
.ARB_shader_image_load_store
)
2339 *params
= (GLfloat
) obj
->ImageFormatCompatibilityType
;
2342 case GL_TEXTURE_TARGET
:
2343 if (ctx
->API
!= API_OPENGL_CORE
)
2345 *params
= ENUM_TO_FLOAT(obj
->Target
);
2348 case GL_TEXTURE_TILING_EXT
:
2349 if (!ctx
->Extensions
.EXT_memory_object
)
2351 *params
= ENUM_TO_FLOAT(obj
->TextureTiling
);
2358 /* no error if we get here */
2359 _mesa_unlock_context_textures(ctx
);
2363 _mesa_unlock_context_textures(ctx
);
2364 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTex%sParameterfv(pname=0x%x)",
2365 dsa
? "ture" : "", pname
);
2370 get_tex_parameteriv(struct gl_context
*ctx
,
2371 struct gl_texture_object
*obj
,
2372 GLenum pname
, GLint
*params
, bool dsa
)
2374 _mesa_lock_texture(ctx
, obj
);
2376 case GL_TEXTURE_MAG_FILTER
:
2377 *params
= (GLint
) obj
->Sampler
.MagFilter
;
2379 case GL_TEXTURE_MIN_FILTER
:
2380 *params
= (GLint
) obj
->Sampler
.MinFilter
;
2382 case GL_TEXTURE_WRAP_S
:
2383 *params
= (GLint
) obj
->Sampler
.WrapS
;
2385 case GL_TEXTURE_WRAP_T
:
2386 *params
= (GLint
) obj
->Sampler
.WrapT
;
2388 case GL_TEXTURE_WRAP_R
:
2389 *params
= (GLint
) obj
->Sampler
.WrapR
;
2391 case GL_TEXTURE_BORDER_COLOR
:
2392 if (ctx
->API
== API_OPENGLES
||
2393 !ctx
->Extensions
.ARB_texture_border_clamp
)
2398 b
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
2399 b
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
2400 b
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
2401 b
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
2402 params
[0] = FLOAT_TO_INT(b
[0]);
2403 params
[1] = FLOAT_TO_INT(b
[1]);
2404 params
[2] = FLOAT_TO_INT(b
[2]);
2405 params
[3] = FLOAT_TO_INT(b
[3]);
2408 case GL_TEXTURE_RESIDENT
:
2409 if (ctx
->API
!= API_OPENGL_COMPAT
)
2414 case GL_TEXTURE_PRIORITY
:
2415 if (ctx
->API
!= API_OPENGL_COMPAT
)
2418 *params
= FLOAT_TO_INT(obj
->Priority
);
2420 case GL_TEXTURE_MIN_LOD
:
2421 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
2423 /* GL spec 'Data Conversions' section specifies that floating-point
2424 * value in integer Get function is rounded to nearest integer
2426 * Section 2.2.2 (Data Conversions For State Query Commands) of the
2427 * OpenGL 4.5 spec says:
2429 * Following these steps, if a value is so large in magnitude that
2430 * it cannot be represented by the returned data type, then the
2431 * nearest value representable using that type is returned.
2433 *params
= CLAMP(lroundf(obj
->Sampler
.MinLod
), INT_MIN
, INT_MAX
);
2435 case GL_TEXTURE_MAX_LOD
:
2436 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
2438 /* GL spec 'Data Conversions' section specifies that floating-point
2439 * value in integer Get function is rounded to nearest integer
2441 * Section 2.2.2 (Data Conversions For State Query Commands) of the
2442 * OpenGL 4.5 spec says:
2444 * Following these steps, if a value is so large in magnitude that
2445 * it cannot be represented by the returned data type, then the
2446 * nearest value representable using that type is returned.
2448 *params
= CLAMP(lroundf(obj
->Sampler
.MaxLod
), INT_MIN
, INT_MAX
);
2450 case GL_TEXTURE_BASE_LEVEL
:
2451 if (!_mesa_is_desktop_gl(ctx
) && !_mesa_is_gles3(ctx
))
2454 *params
= obj
->BaseLevel
;
2456 case GL_TEXTURE_MAX_LEVEL
:
2457 *params
= obj
->MaxLevel
;
2459 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
2460 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
2462 /* GL spec 'Data Conversions' section specifies that floating-point
2463 * value in integer Get function is rounded to nearest integer
2465 * Section 2.2.2 (Data Conversions For State Query Commands) of the
2466 * OpenGL 4.5 spec says:
2468 * Following these steps, if a value is so large in magnitude that
2469 * it cannot be represented by the returned data type, then the
2470 * nearest value representable using that type is returned.
2472 *params
= CLAMP(lroundf(obj
->Sampler
.MaxAnisotropy
), INT_MIN
, INT_MAX
);
2474 case GL_GENERATE_MIPMAP_SGIS
:
2475 if (ctx
->API
!= API_OPENGL_COMPAT
&& ctx
->API
!= API_OPENGLES
)
2478 *params
= (GLint
) obj
->GenerateMipmap
;
2480 case GL_TEXTURE_COMPARE_MODE_ARB
:
2481 if ((!_mesa_is_desktop_gl(ctx
) || !ctx
->Extensions
.ARB_shadow
)
2482 && !_mesa_is_gles3(ctx
))
2484 *params
= (GLint
) obj
->Sampler
.CompareMode
;
2486 case GL_TEXTURE_COMPARE_FUNC_ARB
:
2487 if ((!_mesa_is_desktop_gl(ctx
) || !ctx
->Extensions
.ARB_shadow
)
2488 && !_mesa_is_gles3(ctx
))
2490 *params
= (GLint
) obj
->Sampler
.CompareFunc
;
2492 case GL_DEPTH_TEXTURE_MODE_ARB
:
2493 if (ctx
->API
!= API_OPENGL_COMPAT
|| !ctx
->Extensions
.ARB_depth_texture
)
2495 *params
= (GLint
) obj
->DepthMode
;
2497 case GL_DEPTH_STENCIL_TEXTURE_MODE
:
2498 if (!_mesa_has_ARB_stencil_texturing(ctx
) && !_mesa_is_gles31(ctx
))
2501 (obj
->StencilSampling
? GL_STENCIL_INDEX
: GL_DEPTH_COMPONENT
);
2503 case GL_TEXTURE_LOD_BIAS
:
2504 if (_mesa_is_gles(ctx
))
2507 /* GL spec 'Data Conversions' section specifies that floating-point
2508 * value in integer Get function is rounded to nearest integer
2510 * Section 2.2.2 (Data Conversions For State Query Commands) of the
2511 * OpenGL 4.5 spec says:
2513 * Following these steps, if a value is so large in magnitude that
2514 * it cannot be represented by the returned data type, then the
2515 * nearest value representable using that type is returned.
2517 *params
= CLAMP(lroundf(obj
->Sampler
.LodBias
), INT_MIN
, INT_MAX
);
2519 case GL_TEXTURE_CROP_RECT_OES
:
2520 if (ctx
->API
!= API_OPENGLES
|| !ctx
->Extensions
.OES_draw_texture
)
2523 params
[0] = obj
->CropRect
[0];
2524 params
[1] = obj
->CropRect
[1];
2525 params
[2] = obj
->CropRect
[2];
2526 params
[3] = obj
->CropRect
[3];
2528 case GL_TEXTURE_SWIZZLE_R_EXT
:
2529 case GL_TEXTURE_SWIZZLE_G_EXT
:
2530 case GL_TEXTURE_SWIZZLE_B_EXT
:
2531 case GL_TEXTURE_SWIZZLE_A_EXT
:
2532 if ((!_mesa_is_desktop_gl(ctx
)
2533 || !ctx
->Extensions
.EXT_texture_swizzle
)
2534 && !_mesa_is_gles3(ctx
))
2536 *params
= obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
2539 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
2540 if ((!_mesa_is_desktop_gl(ctx
)
2541 || !ctx
->Extensions
.EXT_texture_swizzle
)
2542 && !_mesa_is_gles3(ctx
))
2544 COPY_4V(params
, obj
->Swizzle
);
2547 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
2548 if (!_mesa_is_desktop_gl(ctx
)
2549 || !ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
2551 *params
= (GLint
) obj
->Sampler
.CubeMapSeamless
;
2554 case GL_TEXTURE_IMMUTABLE_FORMAT
:
2555 *params
= (GLint
) obj
->Immutable
;
2558 case GL_TEXTURE_IMMUTABLE_LEVELS
:
2559 if (_mesa_is_gles3(ctx
) ||
2560 (_mesa_is_desktop_gl(ctx
) && ctx
->Extensions
.ARB_texture_view
))
2561 *params
= obj
->ImmutableLevels
;
2566 case GL_TEXTURE_VIEW_MIN_LEVEL
:
2567 if (!ctx
->Extensions
.ARB_texture_view
)
2569 *params
= (GLint
) obj
->MinLevel
;
2572 case GL_TEXTURE_VIEW_NUM_LEVELS
:
2573 if (!ctx
->Extensions
.ARB_texture_view
)
2575 *params
= (GLint
) obj
->NumLevels
;
2578 case GL_TEXTURE_VIEW_MIN_LAYER
:
2579 if (!ctx
->Extensions
.ARB_texture_view
)
2581 *params
= (GLint
) obj
->MinLayer
;
2584 case GL_TEXTURE_VIEW_NUM_LAYERS
:
2585 if (!ctx
->Extensions
.ARB_texture_view
)
2587 *params
= (GLint
) obj
->NumLayers
;
2590 case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES
:
2591 if (!_mesa_is_gles(ctx
) || !ctx
->Extensions
.OES_EGL_image_external
)
2593 *params
= obj
->RequiredTextureImageUnits
;
2596 case GL_TEXTURE_SRGB_DECODE_EXT
:
2597 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
2599 *params
= obj
->Sampler
.sRGBDecode
;
2602 case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE
:
2603 if (!ctx
->Extensions
.ARB_shader_image_load_store
)
2605 *params
= obj
->ImageFormatCompatibilityType
;
2608 case GL_TEXTURE_TARGET
:
2609 if (ctx
->API
!= API_OPENGL_CORE
)
2611 *params
= (GLint
) obj
->Target
;
2614 case GL_TEXTURE_TILING_EXT
:
2615 if (!ctx
->Extensions
.EXT_memory_object
)
2617 *params
= (GLint
) obj
->TextureTiling
;
2624 /* no error if we get here */
2625 _mesa_unlock_texture(ctx
, obj
);
2629 _mesa_unlock_texture(ctx
, obj
);
2630 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTex%sParameteriv(pname=0x%x)",
2631 dsa
? "ture" : "", pname
);
2635 get_tex_parameterIiv(struct gl_context
*ctx
,
2636 struct gl_texture_object
*obj
,
2637 GLenum pname
, GLint
*params
, bool dsa
)
2640 case GL_TEXTURE_BORDER_COLOR
:
2641 COPY_4V(params
, obj
->Sampler
.BorderColor
.i
);
2644 get_tex_parameteriv(ctx
, obj
, pname
, params
, dsa
);
2649 _mesa_GetTexParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
2651 struct gl_texture_object
*obj
;
2652 GET_CURRENT_CONTEXT(ctx
);
2654 obj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2655 ctx
->Texture
.CurrentUnit
,
2657 "glGetTexParameterfv");
2661 get_tex_parameterfv(ctx
, obj
, pname
, params
, false);
2665 _mesa_GetTexParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
2667 struct gl_texture_object
*obj
;
2668 GET_CURRENT_CONTEXT(ctx
);
2670 obj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2671 ctx
->Texture
.CurrentUnit
,
2673 "glGetTexParameteriv");
2677 get_tex_parameteriv(ctx
, obj
, pname
, params
, false);
2680 /** New in GL 3.0 */
2682 _mesa_GetTexParameterIiv(GLenum target
, GLenum pname
, GLint
*params
)
2684 struct gl_texture_object
*texObj
;
2685 GET_CURRENT_CONTEXT(ctx
);
2687 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2688 ctx
->Texture
.CurrentUnit
,
2690 "glGetTexParameterIiv");
2694 get_tex_parameterIiv(ctx
, texObj
, pname
, params
, false);
2698 /** New in GL 3.0 */
2700 _mesa_GetTexParameterIuiv(GLenum target
, GLenum pname
, GLuint
*params
)
2702 struct gl_texture_object
*texObj
;
2703 GET_CURRENT_CONTEXT(ctx
);
2705 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2706 ctx
->Texture
.CurrentUnit
,
2708 "glGetTexParameterIuiv");
2712 get_tex_parameterIiv(ctx
, texObj
, pname
, (GLint
*) params
, false);
2716 _mesa_GetTextureParameterfvEXT(GLuint texture
, GLenum target
, GLenum pname
, GLfloat
*params
)
2718 struct gl_texture_object
*texObj
;
2719 GET_CURRENT_CONTEXT(ctx
);
2721 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
2722 "glGetTextureParameterfvEXT");
2726 if (!is_texparameteri_target_valid(texObj
->Target
)) {
2727 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetTextureParameterfvEXT");
2731 get_tex_parameterfv(ctx
, texObj
, pname
, params
, true);
2735 _mesa_GetMultiTexParameterfvEXT(GLenum texunit
, GLenum target
, GLenum pname
, GLfloat
*params
)
2737 struct gl_texture_object
*texObj
;
2738 GET_CURRENT_CONTEXT(ctx
);
2740 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2741 texunit
- GL_TEXTURE0
,
2743 "glGetMultiTexParameterfvEXT");
2747 if (!is_texparameteri_target_valid(texObj
->Target
)) {
2748 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetMultiTexParameterfvEXT");
2751 get_tex_parameterfv(ctx
, texObj
, pname
, params
, true);
2755 _mesa_GetTextureParameterfv(GLuint texture
, GLenum pname
, GLfloat
*params
)
2757 struct gl_texture_object
*obj
;
2758 GET_CURRENT_CONTEXT(ctx
);
2760 obj
= get_texobj_by_name(ctx
, texture
, "glGetTextureParameterfv");
2764 get_tex_parameterfv(ctx
, obj
, pname
, params
, true);
2768 _mesa_GetTextureParameterivEXT(GLuint texture
, GLenum target
, GLenum pname
, GLint
*params
)
2770 struct gl_texture_object
*texObj
;
2771 GET_CURRENT_CONTEXT(ctx
);
2773 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
2774 "glGetTextureParameterivEXT");
2778 if (!is_texparameteri_target_valid(texObj
->Target
)) {
2779 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetTextureParameterivEXT");
2782 get_tex_parameteriv(ctx
, texObj
, pname
, params
, true);
2786 _mesa_GetMultiTexParameterivEXT(GLenum texunit
, GLenum target
, GLenum pname
, GLint
*params
)
2788 struct gl_texture_object
*texObj
;
2789 GET_CURRENT_CONTEXT(ctx
);
2791 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2792 texunit
- GL_TEXTURE0
,
2794 "glGetMultiTexParameterivEXT");
2798 if (!is_texparameteri_target_valid(texObj
->Target
)) {
2799 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetMultiTexParameterivEXT");
2802 get_tex_parameteriv(ctx
, texObj
, pname
, params
, true);
2806 _mesa_GetTextureParameteriv(GLuint texture
, GLenum pname
, GLint
*params
)
2808 struct gl_texture_object
*obj
;
2809 GET_CURRENT_CONTEXT(ctx
);
2811 obj
= get_texobj_by_name(ctx
, texture
, "glGetTextureParameteriv");
2815 get_tex_parameteriv(ctx
, obj
, pname
, params
, true);
2819 _mesa_GetTextureParameterIiv(GLuint texture
, GLenum pname
, GLint
*params
)
2821 struct gl_texture_object
*texObj
;
2822 GET_CURRENT_CONTEXT(ctx
);
2824 texObj
= get_texobj_by_name(ctx
, texture
, "glGetTextureParameterIiv");
2828 get_tex_parameterIiv(ctx
, texObj
, pname
, params
, true);
2832 _mesa_GetTextureParameterIivEXT(GLuint texture
, GLenum target
, GLenum pname
, GLint
*params
)
2834 struct gl_texture_object
*texObj
;
2835 GET_CURRENT_CONTEXT(ctx
);
2837 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
2838 "glGetTextureParameterIivEXT");
2843 get_tex_parameterIiv(ctx
, texObj
, pname
, params
, true);
2847 _mesa_GetMultiTexParameterIivEXT(GLenum texunit
, GLenum target
, GLenum pname
,
2850 struct gl_texture_object
*texObj
;
2851 GET_CURRENT_CONTEXT(ctx
);
2853 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2854 texunit
- GL_TEXTURE0
,
2856 "glGetMultiTexParameterIiv");
2860 get_tex_parameterIiv(ctx
, texObj
, pname
, params
, true);
2864 _mesa_GetTextureParameterIuiv(GLuint texture
, GLenum pname
, GLuint
*params
)
2866 struct gl_texture_object
*texObj
;
2867 GET_CURRENT_CONTEXT(ctx
);
2869 texObj
= get_texobj_by_name(ctx
, texture
, "glGetTextureParameterIuiv");
2873 get_tex_parameterIiv(ctx
, texObj
, pname
, (GLint
*) params
, true);
2877 _mesa_GetTextureParameterIuivEXT(GLuint texture
, GLenum target
, GLenum pname
,
2880 struct gl_texture_object
*texObj
;
2881 GET_CURRENT_CONTEXT(ctx
);
2883 texObj
= _mesa_lookup_or_create_texture(ctx
, target
, texture
, false, true,
2884 "glGetTextureParameterIuvEXT");
2888 get_tex_parameterIiv(ctx
, texObj
, pname
, (GLint
*) params
, true);
2892 _mesa_GetMultiTexParameterIuivEXT(GLenum texunit
, GLenum target
, GLenum pname
,
2895 struct gl_texture_object
*texObj
;
2896 GET_CURRENT_CONTEXT(ctx
);
2898 texObj
= _mesa_get_texobj_by_target_and_texunit(ctx
, target
,
2899 texunit
- GL_TEXTURE0
,
2901 "glGetMultiTexParameterIuiv");
2905 get_tex_parameterIiv(ctx
, texObj
, pname
, (GLint
*) params
, true);