2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 * glTexParameter-related functions
33 #include "main/glheader.h"
34 #include "main/colormac.h"
35 #include "main/context.h"
36 #include "main/enums.h"
37 #include "main/formats.h"
38 #include "main/macros.h"
39 #include "main/mfeatures.h"
40 #include "main/mtypes.h"
41 #include "main/state.h"
42 #include "main/texcompress.h"
43 #include "main/texparam.h"
44 #include "main/teximage.h"
45 #include "main/texstate.h"
46 #include "program/prog_instruction.h"
50 * Check if a coordinate wrap mode is supported for the texture target.
51 * \return GL_TRUE if legal, GL_FALSE otherwise
54 validate_texture_wrap_mode(struct gl_context
* ctx
, GLenum target
, GLenum wrap
)
56 const struct gl_extensions
* const e
= & ctx
->Extensions
;
58 if (target
== GL_TEXTURE_RECTANGLE_NV
) {
59 if (wrap
== GL_CLAMP
|| wrap
== GL_CLAMP_TO_EDGE
||
60 (wrap
== GL_CLAMP_TO_BORDER
&& e
->ARB_texture_border_clamp
))
63 else if (target
== GL_TEXTURE_EXTERNAL_OES
) {
64 if (wrap
== GL_CLAMP_TO_EDGE
)
71 case GL_CLAMP_TO_EDGE
:
72 case GL_MIRRORED_REPEAT
:
74 case GL_CLAMP_TO_BORDER
:
75 if (e
->ARB_texture_border_clamp
)
78 case GL_MIRROR_CLAMP_EXT
:
79 case GL_MIRROR_CLAMP_TO_EDGE_EXT
:
80 if (e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
)
83 case GL_MIRROR_CLAMP_TO_BORDER_EXT
:
84 if (e
->EXT_texture_mirror_clamp
)
92 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexParameter(param=0x%x)", wrap
);
98 * Get current texture object for given target.
99 * Return NULL if any error (and record the error).
100 * Note that this is different from _mesa_select_tex_object() in that proxy
101 * targets are not accepted.
102 * Only the glGetTexLevelParameter() functions accept proxy targets.
104 static struct gl_texture_object
*
105 get_texobj(struct gl_context
*ctx
, GLenum target
, GLboolean get
)
107 struct gl_texture_unit
*texUnit
;
109 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
110 _mesa_error(ctx
, GL_INVALID_OPERATION
,
111 "gl%sTexParameter(current unit)", get
? "Get" : "");
115 texUnit
= _mesa_get_current_tex_unit(ctx
);
119 return texUnit
->CurrentTex
[TEXTURE_1D_INDEX
];
121 return texUnit
->CurrentTex
[TEXTURE_2D_INDEX
];
123 return texUnit
->CurrentTex
[TEXTURE_3D_INDEX
];
124 case GL_TEXTURE_CUBE_MAP
:
125 if (ctx
->Extensions
.ARB_texture_cube_map
) {
126 return texUnit
->CurrentTex
[TEXTURE_CUBE_INDEX
];
129 case GL_TEXTURE_RECTANGLE_NV
:
130 if (ctx
->Extensions
.NV_texture_rectangle
) {
131 return texUnit
->CurrentTex
[TEXTURE_RECT_INDEX
];
134 case GL_TEXTURE_1D_ARRAY_EXT
:
135 if (ctx
->Extensions
.MESA_texture_array
||
136 ctx
->Extensions
.EXT_texture_array
) {
137 return texUnit
->CurrentTex
[TEXTURE_1D_ARRAY_INDEX
];
140 case GL_TEXTURE_2D_ARRAY_EXT
:
141 if (ctx
->Extensions
.MESA_texture_array
||
142 ctx
->Extensions
.EXT_texture_array
) {
143 return texUnit
->CurrentTex
[TEXTURE_2D_ARRAY_INDEX
];
146 case GL_TEXTURE_EXTERNAL_OES
:
147 if (ctx
->Extensions
.OES_EGL_image_external
) {
148 return texUnit
->CurrentTex
[TEXTURE_EXTERNAL_INDEX
];
155 _mesa_error(ctx
, GL_INVALID_ENUM
,
156 "gl%sTexParameter(target)", get
? "Get" : "");
162 * Convert GL_RED/GREEN/BLUE/ALPHA/ZERO/ONE to SWIZZLE_X/Y/Z/W/ZERO/ONE.
163 * \return -1 if error.
166 comp_to_swizzle(GLenum comp
)
188 set_swizzle_component(GLuint
*swizzle
, GLuint comp
, GLuint swz
)
191 ASSERT(swz
<= SWIZZLE_NIL
);
193 GLuint mask
= 0x7 << (3 * comp
);
194 GLuint s
= (*swizzle
& ~mask
) | (swz
<< (3 * comp
));
201 * This is called just prior to changing any texture object state which
202 * will not effect texture completeness.
205 flush(struct gl_context
*ctx
)
207 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
212 * This is called just prior to changing any texture object state which
213 * can effect texture completeness (texture base level, max level,
214 * minification filter).
215 * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
216 * state flag and then mark the texture object as 'incomplete' so that any
217 * per-texture derived state gets recomputed.
220 incomplete(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
222 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
223 texObj
->_Complete
= GL_FALSE
;
228 * Set an integer-valued texture parameter
229 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
232 set_tex_parameteri(struct gl_context
*ctx
,
233 struct gl_texture_object
*texObj
,
234 GLenum pname
, const GLint
*params
)
237 case GL_TEXTURE_MIN_FILTER
:
238 if (texObj
->Sampler
.MinFilter
== params
[0])
243 incomplete(ctx
, texObj
);
244 texObj
->Sampler
.MinFilter
= params
[0];
246 case GL_NEAREST_MIPMAP_NEAREST
:
247 case GL_LINEAR_MIPMAP_NEAREST
:
248 case GL_NEAREST_MIPMAP_LINEAR
:
249 case GL_LINEAR_MIPMAP_LINEAR
:
250 if (texObj
->Target
!= GL_TEXTURE_RECTANGLE_NV
&&
251 texObj
->Target
!= GL_TEXTURE_EXTERNAL_OES
) {
252 incomplete(ctx
, texObj
);
253 texObj
->Sampler
.MinFilter
= params
[0];
262 case GL_TEXTURE_MAG_FILTER
:
263 if (texObj
->Sampler
.MagFilter
== params
[0])
268 flush(ctx
); /* does not effect completeness */
269 texObj
->Sampler
.MagFilter
= params
[0];
276 case GL_TEXTURE_WRAP_S
:
277 if (texObj
->Sampler
.WrapS
== params
[0])
279 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
281 texObj
->Sampler
.WrapS
= params
[0];
286 case GL_TEXTURE_WRAP_T
:
287 if (texObj
->Sampler
.WrapT
== params
[0])
289 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
291 texObj
->Sampler
.WrapT
= params
[0];
296 case GL_TEXTURE_WRAP_R
:
297 if (texObj
->Sampler
.WrapR
== params
[0])
299 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
301 texObj
->Sampler
.WrapR
= params
[0];
306 case GL_TEXTURE_BASE_LEVEL
:
307 if (texObj
->BaseLevel
== params
[0])
310 (texObj
->Target
== GL_TEXTURE_RECTANGLE_ARB
&& params
[0] != 0)) {
311 _mesa_error(ctx
, GL_INVALID_VALUE
,
312 "glTexParameter(param=%d)", params
[0]);
315 incomplete(ctx
, texObj
);
316 texObj
->BaseLevel
= params
[0];
319 case GL_TEXTURE_MAX_LEVEL
:
320 if (texObj
->MaxLevel
== params
[0])
322 if (params
[0] < 0 || texObj
->Target
== GL_TEXTURE_RECTANGLE_ARB
) {
323 _mesa_error(ctx
, GL_INVALID_OPERATION
,
324 "glTexParameter(param=%d)", params
[0]);
327 incomplete(ctx
, texObj
);
328 texObj
->MaxLevel
= params
[0];
331 case GL_GENERATE_MIPMAP_SGIS
:
332 if (params
[0] && texObj
->Target
== GL_TEXTURE_EXTERNAL_OES
)
334 if (texObj
->GenerateMipmap
!= params
[0]) {
336 texObj
->GenerateMipmap
= params
[0] ? GL_TRUE
: GL_FALSE
;
341 case GL_TEXTURE_COMPARE_MODE_ARB
:
342 if (ctx
->Extensions
.ARB_shadow
) {
343 if (texObj
->Sampler
.CompareMode
== params
[0])
345 if (params
[0] == GL_NONE
||
346 params
[0] == GL_COMPARE_R_TO_TEXTURE_ARB
) {
348 texObj
->Sampler
.CompareMode
= params
[0];
355 case GL_TEXTURE_COMPARE_FUNC_ARB
:
356 if (ctx
->Extensions
.ARB_shadow
) {
357 if (texObj
->Sampler
.CompareFunc
== params
[0])
363 texObj
->Sampler
.CompareFunc
= params
[0];
371 if (ctx
->Extensions
.EXT_shadow_funcs
) {
373 texObj
->Sampler
.CompareFunc
= params
[0];
383 case GL_DEPTH_TEXTURE_MODE_ARB
:
384 if (ctx
->Extensions
.ARB_depth_texture
) {
385 if (texObj
->Sampler
.DepthMode
== params
[0])
387 if (params
[0] == GL_LUMINANCE
||
388 params
[0] == GL_INTENSITY
||
389 params
[0] == GL_ALPHA
||
390 (ctx
->Extensions
.ARB_texture_rg
&& params
[0] == GL_RED
)) {
392 texObj
->Sampler
.DepthMode
= params
[0];
399 #if FEATURE_OES_draw_texture
400 case GL_TEXTURE_CROP_RECT_OES
:
401 texObj
->CropRect
[0] = params
[0];
402 texObj
->CropRect
[1] = params
[1];
403 texObj
->CropRect
[2] = params
[2];
404 texObj
->CropRect
[3] = params
[3];
408 case GL_TEXTURE_SWIZZLE_R_EXT
:
409 case GL_TEXTURE_SWIZZLE_G_EXT
:
410 case GL_TEXTURE_SWIZZLE_B_EXT
:
411 case GL_TEXTURE_SWIZZLE_A_EXT
:
412 if (ctx
->Extensions
.EXT_texture_swizzle
) {
413 const GLuint comp
= pname
- GL_TEXTURE_SWIZZLE_R_EXT
;
414 const GLint swz
= comp_to_swizzle(params
[0]);
416 _mesa_error(ctx
, GL_INVALID_OPERATION
,
417 "glTexParameter(swizzle 0x%x)", params
[0]);
423 texObj
->Swizzle
[comp
] = params
[0];
424 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
429 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
430 if (ctx
->Extensions
.EXT_texture_swizzle
) {
433 for (comp
= 0; comp
< 4; comp
++) {
434 const GLint swz
= comp_to_swizzle(params
[comp
]);
436 texObj
->Swizzle
[comp
] = params
[comp
];
437 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
440 _mesa_error(ctx
, GL_INVALID_OPERATION
,
441 "glTexParameter(swizzle 0x%x)", params
[comp
]);
449 case GL_TEXTURE_SRGB_DECODE_EXT
:
450 if (ctx
->Extensions
.EXT_texture_sRGB_decode
) {
451 GLenum decode
= params
[0];
452 if (decode
== GL_DECODE_EXT
|| decode
== GL_SKIP_DECODE_EXT
) {
453 if (texObj
->Sampler
.sRGBDecode
!= decode
) {
455 texObj
->Sampler
.sRGBDecode
= decode
;
462 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
463 if (ctx
->Extensions
.AMD_seamless_cubemap_per_texture
) {
464 GLenum param
= params
[0];
465 if (param
!= GL_TRUE
&& param
!= GL_FALSE
) {
468 if (param
!= texObj
->Sampler
.CubeMapSeamless
) {
470 texObj
->Sampler
.CubeMapSeamless
= param
;
481 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(pname=%s)",
482 _mesa_lookup_enum_by_nr(pname
));
486 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(param=%s)",
487 _mesa_lookup_enum_by_nr(params
[0]));
493 * Set a float-valued texture parameter
494 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
497 set_tex_parameterf(struct gl_context
*ctx
,
498 struct gl_texture_object
*texObj
,
499 GLenum pname
, const GLfloat
*params
)
502 case GL_TEXTURE_MIN_LOD
:
503 if (texObj
->Sampler
.MinLod
== params
[0])
506 texObj
->Sampler
.MinLod
= params
[0];
509 case GL_TEXTURE_MAX_LOD
:
510 if (texObj
->Sampler
.MaxLod
== params
[0])
513 texObj
->Sampler
.MaxLod
= params
[0];
516 case GL_TEXTURE_PRIORITY
:
518 texObj
->Priority
= CLAMP(params
[0], 0.0F
, 1.0F
);
521 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
522 if (ctx
->Extensions
.EXT_texture_filter_anisotropic
) {
523 if (texObj
->Sampler
.MaxAnisotropy
== params
[0])
525 if (params
[0] < 1.0) {
526 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTexParameter(param)" );
530 /* clamp to max, that's what NVIDIA does */
531 texObj
->Sampler
.MaxAnisotropy
= MIN2(params
[0],
532 ctx
->Const
.MaxTextureMaxAnisotropy
);
536 static GLuint count
= 0;
538 _mesa_error(ctx
, GL_INVALID_ENUM
,
539 "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
543 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
544 if (ctx
->Extensions
.ARB_shadow_ambient
) {
545 if (texObj
->Sampler
.CompareFailValue
!= params
[0]) {
547 texObj
->Sampler
.CompareFailValue
= CLAMP(params
[0], 0.0F
, 1.0F
);
552 _mesa_error(ctx
, GL_INVALID_ENUM
,
553 "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)");
557 case GL_TEXTURE_LOD_BIAS
:
558 /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
559 if (texObj
->Sampler
.LodBias
!= params
[0]) {
561 texObj
->Sampler
.LodBias
= params
[0];
566 case GL_TEXTURE_BORDER_COLOR
:
568 /* ARB_texture_float disables clamping */
569 if (ctx
->Extensions
.ARB_texture_float
) {
570 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = params
[0];
571 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = params
[1];
572 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = params
[2];
573 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = params
[3];
575 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = CLAMP(params
[0], 0.0F
, 1.0F
);
576 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = CLAMP(params
[1], 0.0F
, 1.0F
);
577 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = CLAMP(params
[2], 0.0F
, 1.0F
);
578 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = CLAMP(params
[3], 0.0F
, 1.0F
);
583 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(pname=0x%x)", pname
);
590 _mesa_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
592 GLboolean need_update
;
593 struct gl_texture_object
*texObj
;
594 GET_CURRENT_CONTEXT(ctx
);
595 ASSERT_OUTSIDE_BEGIN_END(ctx
);
597 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
602 case GL_TEXTURE_MIN_FILTER
:
603 case GL_TEXTURE_MAG_FILTER
:
604 case GL_TEXTURE_WRAP_S
:
605 case GL_TEXTURE_WRAP_T
:
606 case GL_TEXTURE_WRAP_R
:
607 case GL_TEXTURE_BASE_LEVEL
:
608 case GL_TEXTURE_MAX_LEVEL
:
609 case GL_GENERATE_MIPMAP_SGIS
:
610 case GL_TEXTURE_COMPARE_MODE_ARB
:
611 case GL_TEXTURE_COMPARE_FUNC_ARB
:
612 case GL_DEPTH_TEXTURE_MODE_ARB
:
613 case GL_TEXTURE_SRGB_DECODE_EXT
:
614 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
616 /* convert float param to int */
618 p
[0] = (GLint
) param
;
619 p
[1] = p
[2] = p
[3] = 0;
620 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
623 case GL_TEXTURE_SWIZZLE_R_EXT
:
624 case GL_TEXTURE_SWIZZLE_G_EXT
:
625 case GL_TEXTURE_SWIZZLE_B_EXT
:
626 case GL_TEXTURE_SWIZZLE_A_EXT
:
629 p
[0] = (GLint
) param
;
630 p
[1] = p
[2] = p
[3] = 0;
631 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
636 /* this will generate an error if pname is illegal */
639 p
[1] = p
[2] = p
[3] = 0.0F
;
640 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, p
);
644 if (ctx
->Driver
.TexParameter
&& need_update
) {
645 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, ¶m
);
651 _mesa_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
653 GLboolean need_update
;
654 struct gl_texture_object
*texObj
;
655 GET_CURRENT_CONTEXT(ctx
);
656 ASSERT_OUTSIDE_BEGIN_END(ctx
);
658 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
663 case GL_TEXTURE_MIN_FILTER
:
664 case GL_TEXTURE_MAG_FILTER
:
665 case GL_TEXTURE_WRAP_S
:
666 case GL_TEXTURE_WRAP_T
:
667 case GL_TEXTURE_WRAP_R
:
668 case GL_TEXTURE_BASE_LEVEL
:
669 case GL_TEXTURE_MAX_LEVEL
:
670 case GL_GENERATE_MIPMAP_SGIS
:
671 case GL_TEXTURE_COMPARE_MODE_ARB
:
672 case GL_TEXTURE_COMPARE_FUNC_ARB
:
673 case GL_DEPTH_TEXTURE_MODE_ARB
:
674 case GL_TEXTURE_SRGB_DECODE_EXT
:
675 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
677 /* convert float param to int */
679 p
[0] = (GLint
) params
[0];
680 p
[1] = p
[2] = p
[3] = 0;
681 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
685 #if FEATURE_OES_draw_texture
686 case GL_TEXTURE_CROP_RECT_OES
:
688 /* convert float params to int */
690 iparams
[0] = (GLint
) params
[0];
691 iparams
[1] = (GLint
) params
[1];
692 iparams
[2] = (GLint
) params
[2];
693 iparams
[3] = (GLint
) params
[3];
694 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparams
);
699 case GL_TEXTURE_SWIZZLE_R_EXT
:
700 case GL_TEXTURE_SWIZZLE_G_EXT
:
701 case GL_TEXTURE_SWIZZLE_B_EXT
:
702 case GL_TEXTURE_SWIZZLE_A_EXT
:
703 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
705 GLint p
[4] = {0, 0, 0, 0};
706 p
[0] = (GLint
) params
[0];
707 if (pname
== GL_TEXTURE_SWIZZLE_RGBA_EXT
) {
708 p
[1] = (GLint
) params
[1];
709 p
[2] = (GLint
) params
[2];
710 p
[3] = (GLint
) params
[3];
712 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
716 /* this will generate an error if pname is illegal */
717 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, params
);
720 if (ctx
->Driver
.TexParameter
&& need_update
) {
721 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, params
);
727 _mesa_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
729 GLboolean need_update
;
730 struct gl_texture_object
*texObj
;
731 GET_CURRENT_CONTEXT(ctx
);
732 ASSERT_OUTSIDE_BEGIN_END(ctx
);
734 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
739 case GL_TEXTURE_MIN_LOD
:
740 case GL_TEXTURE_MAX_LOD
:
741 case GL_TEXTURE_PRIORITY
:
742 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
743 case GL_TEXTURE_LOD_BIAS
:
744 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
747 fparam
[0] = (GLfloat
) param
;
748 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
749 /* convert int param to float */
750 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparam
);
754 /* this will generate an error if pname is illegal */
758 iparam
[1] = iparam
[2] = iparam
[3] = 0;
759 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparam
);
763 if (ctx
->Driver
.TexParameter
&& need_update
) {
764 GLfloat fparam
= (GLfloat
) param
;
765 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, &fparam
);
771 _mesa_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
773 GLboolean need_update
;
774 struct gl_texture_object
*texObj
;
775 GET_CURRENT_CONTEXT(ctx
);
776 ASSERT_OUTSIDE_BEGIN_END(ctx
);
778 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
783 case GL_TEXTURE_BORDER_COLOR
:
785 /* convert int params to float */
787 fparams
[0] = INT_TO_FLOAT(params
[0]);
788 fparams
[1] = INT_TO_FLOAT(params
[1]);
789 fparams
[2] = INT_TO_FLOAT(params
[2]);
790 fparams
[3] = INT_TO_FLOAT(params
[3]);
791 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
);
794 case GL_TEXTURE_MIN_LOD
:
795 case GL_TEXTURE_MAX_LOD
:
796 case GL_TEXTURE_PRIORITY
:
797 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
798 case GL_TEXTURE_LOD_BIAS
:
799 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
801 /* convert int param to float */
803 fparams
[0] = (GLfloat
) params
[0];
804 fparams
[1] = fparams
[2] = fparams
[3] = 0.0F
;
805 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
);
809 /* this will generate an error if pname is illegal */
810 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, params
);
813 if (ctx
->Driver
.TexParameter
&& need_update
) {
815 fparams
[0] = INT_TO_FLOAT(params
[0]);
816 if (pname
== GL_TEXTURE_BORDER_COLOR
||
817 pname
== GL_TEXTURE_CROP_RECT_OES
) {
818 fparams
[1] = INT_TO_FLOAT(params
[1]);
819 fparams
[2] = INT_TO_FLOAT(params
[2]);
820 fparams
[3] = INT_TO_FLOAT(params
[3]);
822 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, fparams
);
828 * Set tex parameter to integer value(s). Primarily intended to set
829 * integer-valued texture border color (for integer-valued textures).
833 _mesa_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
835 struct gl_texture_object
*texObj
;
836 GET_CURRENT_CONTEXT(ctx
);
837 ASSERT_OUTSIDE_BEGIN_END(ctx
);
839 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
844 case GL_TEXTURE_BORDER_COLOR
:
845 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
846 /* set the integer-valued border color */
847 COPY_4V(texObj
->Sampler
.BorderColor
.i
, params
);
850 _mesa_TexParameteriv(target
, pname
, params
);
853 /* XXX no driver hook for TexParameterIiv() yet */
858 * Set tex parameter to unsigned integer value(s). Primarily intended to set
859 * uint-valued texture border color (for integer-valued textures).
863 _mesa_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
865 struct gl_texture_object
*texObj
;
866 GET_CURRENT_CONTEXT(ctx
);
867 ASSERT_OUTSIDE_BEGIN_END(ctx
);
869 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
874 case GL_TEXTURE_BORDER_COLOR
:
875 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
876 /* set the unsigned integer-valued border color */
877 COPY_4V(texObj
->Sampler
.BorderColor
.ui
, params
);
880 _mesa_TexParameteriv(target
, pname
, (const GLint
*) params
);
883 /* XXX no driver hook for TexParameterIuiv() yet */
890 _mesa_GetTexLevelParameterfv( GLenum target
, GLint level
,
891 GLenum pname
, GLfloat
*params
)
894 _mesa_GetTexLevelParameteriv( target
, level
, pname
, &iparam
);
895 *params
= (GLfloat
) iparam
;
900 _mesa_GetTexLevelParameteriv( GLenum target
, GLint level
,
901 GLenum pname
, GLint
*params
)
903 const struct gl_texture_unit
*texUnit
;
904 struct gl_texture_object
*texObj
;
905 const struct gl_texture_image
*img
= NULL
;
908 GET_CURRENT_CONTEXT(ctx
);
909 ASSERT_OUTSIDE_BEGIN_END(ctx
);
911 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
912 _mesa_error(ctx
, GL_INVALID_OPERATION
,
913 "glGetTexLevelParameteriv(current unit)");
917 texUnit
= _mesa_get_current_tex_unit(ctx
);
919 /* this will catch bad target values */
920 maxLevels
= _mesa_max_texture_levels(ctx
, target
);
921 if (maxLevels
== 0) {
922 _mesa_error(ctx
, GL_INVALID_ENUM
,
923 "glGetTexLevelParameter[if]v(target=0x%x)", target
);
927 if (level
< 0 || level
>= maxLevels
) {
928 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGetTexLevelParameter[if]v" );
932 texObj
= _mesa_select_tex_object(ctx
, texUnit
, target
);
934 img
= _mesa_select_tex_image(ctx
, texObj
, target
, level
);
935 if (!img
|| img
->TexFormat
== MESA_FORMAT_NONE
) {
936 /* undefined texture image */
937 if (pname
== GL_TEXTURE_COMPONENTS
)
944 texFormat
= img
->TexFormat
;
947 case GL_TEXTURE_WIDTH
:
948 *params
= img
->Width
;
950 case GL_TEXTURE_HEIGHT
:
951 *params
= img
->Height
;
953 case GL_TEXTURE_DEPTH
:
954 *params
= img
->Depth
;
956 case GL_TEXTURE_INTERNAL_FORMAT
:
957 if (_mesa_is_format_compressed(texFormat
)) {
958 /* need to return the actual compressed format */
959 *params
= _mesa_compressed_format_to_glenum(ctx
, texFormat
);
962 /* If the true internal format is not compressed but the user
963 * requested a generic compressed format, we have to return the
964 * generic base format that matches.
966 * From page 119 (page 129 of the PDF) of the OpenGL 1.3 spec:
968 * "If no specific compressed format is available,
969 * internalformat is instead replaced by the corresponding base
972 * Otherwise just return the user's requested internal format
975 _mesa_gl_compressed_format_base_format(img
->InternalFormat
);
977 *params
= (f
!= 0) ? f
: img
->InternalFormat
;
980 case GL_TEXTURE_BORDER
:
981 *params
= img
->Border
;
983 case GL_TEXTURE_RED_SIZE
:
984 if (img
->_BaseFormat
== GL_RED
) {
985 *params
= _mesa_get_format_bits(texFormat
, pname
);
989 case GL_TEXTURE_GREEN_SIZE
:
990 if (img
->_BaseFormat
== GL_RG
) {
991 *params
= _mesa_get_format_bits(texFormat
, pname
);
995 case GL_TEXTURE_BLUE_SIZE
:
996 if (img
->_BaseFormat
== GL_RGB
|| img
->_BaseFormat
== GL_RGBA
)
997 *params
= _mesa_get_format_bits(texFormat
, pname
);
1001 case GL_TEXTURE_ALPHA_SIZE
:
1002 if (img
->_BaseFormat
== GL_ALPHA
||
1003 img
->_BaseFormat
== GL_LUMINANCE_ALPHA
||
1004 img
->_BaseFormat
== GL_RGBA
)
1005 *params
= _mesa_get_format_bits(texFormat
, pname
);
1009 case GL_TEXTURE_INTENSITY_SIZE
:
1010 if (img
->_BaseFormat
!= GL_INTENSITY
)
1013 *params
= _mesa_get_format_bits(texFormat
, pname
);
1015 /* intensity probably stored as rgb texture */
1016 *params
= MIN2(_mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
),
1017 _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
));
1021 case GL_TEXTURE_LUMINANCE_SIZE
:
1022 if (img
->_BaseFormat
!= GL_LUMINANCE
&&
1023 img
->_BaseFormat
!= GL_LUMINANCE_ALPHA
)
1026 *params
= _mesa_get_format_bits(texFormat
, pname
);
1028 /* luminance probably stored as rgb texture */
1029 *params
= MIN2(_mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
),
1030 _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
));
1034 case GL_TEXTURE_DEPTH_SIZE_ARB
:
1035 if (!ctx
->Extensions
.ARB_depth_texture
)
1037 *params
= _mesa_get_format_bits(texFormat
, pname
);
1039 case GL_TEXTURE_STENCIL_SIZE_EXT
:
1040 if (!ctx
->Extensions
.EXT_packed_depth_stencil
&&
1041 !ctx
->Extensions
.ARB_framebuffer_object
)
1043 *params
= _mesa_get_format_bits(texFormat
, pname
);
1045 case GL_TEXTURE_SHARED_SIZE
:
1046 if (ctx
->VersionMajor
< 3 &&
1047 !ctx
->Extensions
.EXT_texture_shared_exponent
)
1049 *params
= texFormat
== MESA_FORMAT_RGB9_E5_FLOAT
? 5 : 0;
1052 /* GL_ARB_texture_compression */
1053 case GL_TEXTURE_COMPRESSED_IMAGE_SIZE
:
1054 if (_mesa_is_format_compressed(texFormat
) &&
1055 !_mesa_is_proxy_texture(target
)) {
1056 *params
= _mesa_format_image_size(texFormat
, img
->Width
,
1057 img
->Height
, img
->Depth
);
1060 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1061 "glGetTexLevelParameter[if]v(pname)");
1064 case GL_TEXTURE_COMPRESSED
:
1065 *params
= (GLint
) _mesa_is_format_compressed(texFormat
);
1068 /* GL_ARB_texture_float */
1069 case GL_TEXTURE_RED_TYPE_ARB
:
1070 if (!ctx
->Extensions
.ARB_texture_float
)
1072 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
) ?
1073 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1075 case GL_TEXTURE_GREEN_TYPE_ARB
:
1076 if (!ctx
->Extensions
.ARB_texture_float
)
1078 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
) ?
1079 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1081 case GL_TEXTURE_BLUE_TYPE_ARB
:
1082 if (!ctx
->Extensions
.ARB_texture_float
)
1084 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_BLUE_SIZE
) ?
1085 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1087 case GL_TEXTURE_ALPHA_TYPE_ARB
:
1088 if (!ctx
->Extensions
.ARB_texture_float
)
1090 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_ALPHA_SIZE
) ?
1091 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1093 case GL_TEXTURE_LUMINANCE_TYPE_ARB
:
1094 if (!ctx
->Extensions
.ARB_texture_float
)
1096 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_LUMINANCE_SIZE
) ?
1097 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1099 case GL_TEXTURE_INTENSITY_TYPE_ARB
:
1100 if (!ctx
->Extensions
.ARB_texture_float
)
1102 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_INTENSITY_SIZE
) ?
1103 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1105 case GL_TEXTURE_DEPTH_TYPE_ARB
:
1106 if (!ctx
->Extensions
.ARB_texture_float
)
1108 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_DEPTH_SIZE
) ?
1109 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1116 /* no error if we get here */
1120 _mesa_error(ctx
, GL_INVALID_ENUM
,
1121 "glGetTexLevelParameter[if]v(pname=%s)",
1122 _mesa_lookup_enum_by_nr(pname
));
1128 _mesa_GetTexParameterfv( GLenum target
, GLenum pname
, GLfloat
*params
)
1130 struct gl_texture_object
*obj
;
1131 GET_CURRENT_CONTEXT(ctx
);
1132 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1134 obj
= get_texobj(ctx
, target
, GL_TRUE
);
1138 _mesa_lock_texture(ctx
, obj
);
1140 case GL_TEXTURE_MAG_FILTER
:
1141 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MagFilter
);
1143 case GL_TEXTURE_MIN_FILTER
:
1144 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MinFilter
);
1146 case GL_TEXTURE_WRAP_S
:
1147 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapS
);
1149 case GL_TEXTURE_WRAP_T
:
1150 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapT
);
1152 case GL_TEXTURE_WRAP_R
:
1153 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapR
);
1155 case GL_TEXTURE_BORDER_COLOR
:
1156 if (ctx
->NewState
& (_NEW_BUFFERS
| _NEW_FRAG_CLAMP
))
1157 _mesa_update_state_locked(ctx
);
1158 if (ctx
->Color
._ClampFragmentColor
) {
1159 params
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
1160 params
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
1161 params
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
1162 params
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
1165 params
[0] = obj
->Sampler
.BorderColor
.f
[0];
1166 params
[1] = obj
->Sampler
.BorderColor
.f
[1];
1167 params
[2] = obj
->Sampler
.BorderColor
.f
[2];
1168 params
[3] = obj
->Sampler
.BorderColor
.f
[3];
1171 case GL_TEXTURE_RESIDENT
:
1172 *params
= ctx
->Driver
.IsTextureResident
?
1173 ctx
->Driver
.IsTextureResident(ctx
, obj
) : 1.0F
;
1175 case GL_TEXTURE_PRIORITY
:
1176 *params
= obj
->Priority
;
1178 case GL_TEXTURE_MIN_LOD
:
1179 *params
= obj
->Sampler
.MinLod
;
1181 case GL_TEXTURE_MAX_LOD
:
1182 *params
= obj
->Sampler
.MaxLod
;
1184 case GL_TEXTURE_BASE_LEVEL
:
1185 *params
= (GLfloat
) obj
->BaseLevel
;
1187 case GL_TEXTURE_MAX_LEVEL
:
1188 *params
= (GLfloat
) obj
->MaxLevel
;
1190 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1191 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
1193 *params
= obj
->Sampler
.MaxAnisotropy
;
1195 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
1196 if (!ctx
->Extensions
.ARB_shadow_ambient
)
1198 *params
= obj
->Sampler
.CompareFailValue
;
1200 case GL_GENERATE_MIPMAP_SGIS
:
1201 *params
= (GLfloat
) obj
->GenerateMipmap
;
1203 case GL_TEXTURE_COMPARE_MODE_ARB
:
1204 if (!ctx
->Extensions
.ARB_shadow
)
1206 *params
= (GLfloat
) obj
->Sampler
.CompareMode
;
1208 case GL_TEXTURE_COMPARE_FUNC_ARB
:
1209 if (!ctx
->Extensions
.ARB_shadow
)
1211 *params
= (GLfloat
) obj
->Sampler
.CompareFunc
;
1213 case GL_DEPTH_TEXTURE_MODE_ARB
:
1214 if (!ctx
->Extensions
.ARB_depth_texture
)
1216 *params
= (GLfloat
) obj
->Sampler
.DepthMode
;
1218 case GL_TEXTURE_LOD_BIAS
:
1219 *params
= obj
->Sampler
.LodBias
;
1221 #if FEATURE_OES_draw_texture
1222 case GL_TEXTURE_CROP_RECT_OES
:
1223 params
[0] = obj
->CropRect
[0];
1224 params
[1] = obj
->CropRect
[1];
1225 params
[2] = obj
->CropRect
[2];
1226 params
[3] = obj
->CropRect
[3];
1230 case GL_TEXTURE_SWIZZLE_R_EXT
:
1231 case GL_TEXTURE_SWIZZLE_G_EXT
:
1232 case GL_TEXTURE_SWIZZLE_B_EXT
:
1233 case GL_TEXTURE_SWIZZLE_A_EXT
:
1234 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1236 *params
= (GLfloat
) obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
1239 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
1240 if (!ctx
->Extensions
.EXT_texture_swizzle
) {
1245 for (comp
= 0; comp
< 4; comp
++) {
1246 params
[comp
] = (GLfloat
) obj
->Swizzle
[comp
];
1251 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1252 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1254 *params
= (GLfloat
) obj
->Sampler
.CubeMapSeamless
;
1257 case GL_TEXTURE_IMMUTABLE_FORMAT
:
1258 if (!ctx
->Extensions
.ARB_texture_storage
)
1260 *params
= (GLfloat
) obj
->Immutable
;
1267 /* no error if we get here */
1268 _mesa_unlock_texture(ctx
, obj
);
1272 _mesa_unlock_texture(ctx
, obj
);
1273 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexParameterfv(pname=0x%x)", pname
);
1278 _mesa_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
1280 struct gl_texture_object
*obj
;
1281 GET_CURRENT_CONTEXT(ctx
);
1282 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1284 obj
= get_texobj(ctx
, target
, GL_TRUE
);
1288 _mesa_lock_texture(ctx
, obj
);
1290 case GL_TEXTURE_MAG_FILTER
:
1291 *params
= (GLint
) obj
->Sampler
.MagFilter
;
1293 case GL_TEXTURE_MIN_FILTER
:
1294 *params
= (GLint
) obj
->Sampler
.MinFilter
;
1296 case GL_TEXTURE_WRAP_S
:
1297 *params
= (GLint
) obj
->Sampler
.WrapS
;
1299 case GL_TEXTURE_WRAP_T
:
1300 *params
= (GLint
) obj
->Sampler
.WrapT
;
1302 case GL_TEXTURE_WRAP_R
:
1303 *params
= (GLint
) obj
->Sampler
.WrapR
;
1305 case GL_TEXTURE_BORDER_COLOR
:
1308 b
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
1309 b
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
1310 b
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
1311 b
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
1312 params
[0] = FLOAT_TO_INT(b
[0]);
1313 params
[1] = FLOAT_TO_INT(b
[1]);
1314 params
[2] = FLOAT_TO_INT(b
[2]);
1315 params
[3] = FLOAT_TO_INT(b
[3]);
1318 case GL_TEXTURE_RESIDENT
:
1319 *params
= ctx
->Driver
.IsTextureResident
?
1320 ctx
->Driver
.IsTextureResident(ctx
, obj
) : 1;
1322 case GL_TEXTURE_PRIORITY
:
1323 *params
= FLOAT_TO_INT(obj
->Priority
);
1325 case GL_TEXTURE_MIN_LOD
:
1326 *params
= (GLint
) obj
->Sampler
.MinLod
;
1328 case GL_TEXTURE_MAX_LOD
:
1329 *params
= (GLint
) obj
->Sampler
.MaxLod
;
1331 case GL_TEXTURE_BASE_LEVEL
:
1332 *params
= obj
->BaseLevel
;
1334 case GL_TEXTURE_MAX_LEVEL
:
1335 *params
= obj
->MaxLevel
;
1337 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1338 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
1340 *params
= (GLint
) obj
->Sampler
.MaxAnisotropy
;
1342 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
1343 if (!ctx
->Extensions
.ARB_shadow_ambient
)
1345 *params
= (GLint
) FLOAT_TO_INT(obj
->Sampler
.CompareFailValue
);
1347 case GL_GENERATE_MIPMAP_SGIS
:
1348 *params
= (GLint
) obj
->GenerateMipmap
;
1350 case GL_TEXTURE_COMPARE_MODE_ARB
:
1351 if (!ctx
->Extensions
.ARB_shadow
)
1353 *params
= (GLint
) obj
->Sampler
.CompareMode
;
1355 case GL_TEXTURE_COMPARE_FUNC_ARB
:
1356 if (!ctx
->Extensions
.ARB_shadow
)
1358 *params
= (GLint
) obj
->Sampler
.CompareFunc
;
1360 case GL_DEPTH_TEXTURE_MODE_ARB
:
1361 if (!ctx
->Extensions
.ARB_depth_texture
)
1363 *params
= (GLint
) obj
->Sampler
.DepthMode
;
1365 case GL_TEXTURE_LOD_BIAS
:
1366 *params
= (GLint
) obj
->Sampler
.LodBias
;
1368 #if FEATURE_OES_draw_texture
1369 case GL_TEXTURE_CROP_RECT_OES
:
1370 params
[0] = obj
->CropRect
[0];
1371 params
[1] = obj
->CropRect
[1];
1372 params
[2] = obj
->CropRect
[2];
1373 params
[3] = obj
->CropRect
[3];
1376 case GL_TEXTURE_SWIZZLE_R_EXT
:
1377 case GL_TEXTURE_SWIZZLE_G_EXT
:
1378 case GL_TEXTURE_SWIZZLE_B_EXT
:
1379 case GL_TEXTURE_SWIZZLE_A_EXT
:
1380 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1382 *params
= obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
1385 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
1386 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1388 COPY_4V(params
, obj
->Swizzle
);
1391 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1392 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1394 *params
= (GLint
) obj
->Sampler
.CubeMapSeamless
;
1397 case GL_TEXTURE_IMMUTABLE_FORMAT
:
1398 if (!ctx
->Extensions
.ARB_texture_storage
)
1400 *params
= (GLint
) obj
->Immutable
;
1403 case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES
:
1404 if (!ctx
->Extensions
.OES_EGL_image_external
)
1406 *params
= obj
->RequiredTextureImageUnits
;
1413 /* no error if we get here */
1414 _mesa_unlock_texture(ctx
, obj
);
1418 _mesa_unlock_texture(ctx
, obj
);
1419 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexParameteriv(pname=0x%x)", pname
);
1423 /** New in GL 3.0 */
1425 _mesa_GetTexParameterIiv(GLenum target
, GLenum pname
, GLint
*params
)
1427 struct gl_texture_object
*texObj
;
1428 GET_CURRENT_CONTEXT(ctx
);
1429 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1431 texObj
= get_texobj(ctx
, target
, GL_TRUE
);
1436 case GL_TEXTURE_BORDER_COLOR
:
1437 COPY_4V(params
, texObj
->Sampler
.BorderColor
.i
);
1440 _mesa_GetTexParameteriv(target
, pname
, params
);
1445 /** New in GL 3.0 */
1447 _mesa_GetTexParameterIuiv(GLenum target
, GLenum pname
, GLuint
*params
)
1449 struct gl_texture_object
*texObj
;
1450 GET_CURRENT_CONTEXT(ctx
);
1451 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1453 texObj
= get_texobj(ctx
, target
, GL_TRUE
);
1458 case GL_TEXTURE_BORDER_COLOR
:
1459 COPY_4V(params
, texObj
->Sampler
.BorderColor
.i
);
1464 _mesa_GetTexParameteriv(target
, pname
, ip
);
1466 if (pname
== GL_TEXTURE_SWIZZLE_RGBA_EXT
||
1467 pname
== GL_TEXTURE_CROP_RECT_OES
) {