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 (wrap
== GL_CLAMP
|| wrap
== GL_CLAMP_TO_EDGE
||
59 (wrap
== GL_CLAMP_TO_BORDER
&& e
->ARB_texture_border_clamp
)) {
60 /* any texture target */
63 else if (target
!= GL_TEXTURE_RECTANGLE_NV
&&
65 wrap
== GL_MIRRORED_REPEAT
||
66 (wrap
== GL_MIRROR_CLAMP_EXT
&&
67 (e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
)) ||
68 (wrap
== GL_MIRROR_CLAMP_TO_EDGE_EXT
&&
69 (e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
)) ||
70 (wrap
== GL_MIRROR_CLAMP_TO_BORDER_EXT
&&
71 (e
->EXT_texture_mirror_clamp
)))) {
72 /* non-rectangle texture */
76 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexParameter(param=0x%x)", wrap
);
82 * Get current texture object for given target.
83 * Return NULL if any error (and record the error).
84 * Note that this is different from _mesa_select_tex_object() in that proxy
85 * targets are not accepted.
86 * Only the glGetTexLevelParameter() functions accept proxy targets.
88 static struct gl_texture_object
*
89 get_texobj(struct gl_context
*ctx
, GLenum target
, GLboolean get
)
91 struct gl_texture_unit
*texUnit
;
93 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
94 _mesa_error(ctx
, GL_INVALID_OPERATION
,
95 "gl%sTexParameter(current unit)", get
? "Get" : "");
99 texUnit
= _mesa_get_current_tex_unit(ctx
);
103 return texUnit
->CurrentTex
[TEXTURE_1D_INDEX
];
105 return texUnit
->CurrentTex
[TEXTURE_2D_INDEX
];
107 return texUnit
->CurrentTex
[TEXTURE_3D_INDEX
];
108 case GL_TEXTURE_CUBE_MAP
:
109 if (ctx
->Extensions
.ARB_texture_cube_map
) {
110 return texUnit
->CurrentTex
[TEXTURE_CUBE_INDEX
];
113 case GL_TEXTURE_RECTANGLE_NV
:
114 if (ctx
->Extensions
.NV_texture_rectangle
) {
115 return texUnit
->CurrentTex
[TEXTURE_RECT_INDEX
];
118 case GL_TEXTURE_1D_ARRAY_EXT
:
119 if (ctx
->Extensions
.MESA_texture_array
||
120 ctx
->Extensions
.EXT_texture_array
) {
121 return texUnit
->CurrentTex
[TEXTURE_1D_ARRAY_INDEX
];
124 case GL_TEXTURE_2D_ARRAY_EXT
:
125 if (ctx
->Extensions
.MESA_texture_array
||
126 ctx
->Extensions
.EXT_texture_array
) {
127 return texUnit
->CurrentTex
[TEXTURE_2D_ARRAY_INDEX
];
134 _mesa_error(ctx
, GL_INVALID_ENUM
,
135 "gl%sTexParameter(target)", get
? "Get" : "");
141 * Convert GL_RED/GREEN/BLUE/ALPHA/ZERO/ONE to SWIZZLE_X/Y/Z/W/ZERO/ONE.
142 * \return -1 if error.
145 comp_to_swizzle(GLenum comp
)
167 set_swizzle_component(GLuint
*swizzle
, GLuint comp
, GLuint swz
)
170 ASSERT(swz
<= SWIZZLE_NIL
);
172 GLuint mask
= 0x7 << (3 * comp
);
173 GLuint s
= (*swizzle
& ~mask
) | (swz
<< (3 * comp
));
180 * This is called just prior to changing any texture object state which
181 * will not effect texture completeness.
184 flush(struct gl_context
*ctx
)
186 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
191 * This is called just prior to changing any texture object state which
192 * can effect texture completeness (texture base level, max level,
193 * minification filter).
194 * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
195 * state flag and then mark the texture object as 'incomplete' so that any
196 * per-texture derived state gets recomputed.
199 incomplete(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
201 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
202 texObj
->_Complete
= GL_FALSE
;
207 * Set an integer-valued texture parameter
208 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
211 set_tex_parameteri(struct gl_context
*ctx
,
212 struct gl_texture_object
*texObj
,
213 GLenum pname
, const GLint
*params
)
216 case GL_TEXTURE_MIN_FILTER
:
217 if (texObj
->Sampler
.MinFilter
== params
[0])
222 incomplete(ctx
, texObj
);
223 texObj
->Sampler
.MinFilter
= params
[0];
225 case GL_NEAREST_MIPMAP_NEAREST
:
226 case GL_LINEAR_MIPMAP_NEAREST
:
227 case GL_NEAREST_MIPMAP_LINEAR
:
228 case GL_LINEAR_MIPMAP_LINEAR
:
229 if (texObj
->Target
!= GL_TEXTURE_RECTANGLE_NV
) {
230 incomplete(ctx
, texObj
);
231 texObj
->Sampler
.MinFilter
= params
[0];
240 case GL_TEXTURE_MAG_FILTER
:
241 if (texObj
->Sampler
.MagFilter
== params
[0])
246 flush(ctx
); /* does not effect completeness */
247 texObj
->Sampler
.MagFilter
= params
[0];
254 case GL_TEXTURE_WRAP_S
:
255 if (texObj
->Sampler
.WrapS
== params
[0])
257 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
259 texObj
->Sampler
.WrapS
= params
[0];
264 case GL_TEXTURE_WRAP_T
:
265 if (texObj
->Sampler
.WrapT
== params
[0])
267 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
269 texObj
->Sampler
.WrapT
= params
[0];
274 case GL_TEXTURE_WRAP_R
:
275 if (texObj
->Sampler
.WrapR
== params
[0])
277 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
279 texObj
->Sampler
.WrapR
= params
[0];
284 case GL_TEXTURE_BASE_LEVEL
:
285 if (texObj
->BaseLevel
== params
[0])
288 (texObj
->Target
== GL_TEXTURE_RECTANGLE_ARB
&& params
[0] != 0)) {
289 _mesa_error(ctx
, GL_INVALID_VALUE
,
290 "glTexParameter(param=%d)", params
[0]);
293 incomplete(ctx
, texObj
);
294 texObj
->BaseLevel
= params
[0];
297 case GL_TEXTURE_MAX_LEVEL
:
298 if (texObj
->MaxLevel
== params
[0])
300 if (params
[0] < 0 || texObj
->Target
== GL_TEXTURE_RECTANGLE_ARB
) {
301 _mesa_error(ctx
, GL_INVALID_OPERATION
,
302 "glTexParameter(param=%d)", params
[0]);
305 incomplete(ctx
, texObj
);
306 texObj
->MaxLevel
= params
[0];
309 case GL_GENERATE_MIPMAP_SGIS
:
310 if (texObj
->GenerateMipmap
!= params
[0]) {
312 texObj
->GenerateMipmap
= params
[0] ? GL_TRUE
: GL_FALSE
;
317 case GL_TEXTURE_COMPARE_MODE_ARB
:
318 if (ctx
->Extensions
.ARB_shadow
) {
319 if (texObj
->Sampler
.CompareMode
== params
[0])
321 if (params
[0] == GL_NONE
||
322 params
[0] == GL_COMPARE_R_TO_TEXTURE_ARB
) {
324 texObj
->Sampler
.CompareMode
= params
[0];
331 case GL_TEXTURE_COMPARE_FUNC_ARB
:
332 if (ctx
->Extensions
.ARB_shadow
) {
333 if (texObj
->Sampler
.CompareFunc
== params
[0])
339 texObj
->Sampler
.CompareFunc
= params
[0];
347 if (ctx
->Extensions
.EXT_shadow_funcs
) {
349 texObj
->Sampler
.CompareFunc
= params
[0];
359 case GL_DEPTH_TEXTURE_MODE_ARB
:
360 if (ctx
->Extensions
.ARB_depth_texture
) {
361 if (texObj
->Sampler
.DepthMode
== params
[0])
363 if (params
[0] == GL_LUMINANCE
||
364 params
[0] == GL_INTENSITY
||
365 params
[0] == GL_ALPHA
||
366 (ctx
->Extensions
.ARB_texture_rg
&& params
[0] == GL_RED
)) {
368 texObj
->Sampler
.DepthMode
= params
[0];
375 #if FEATURE_OES_draw_texture
376 case GL_TEXTURE_CROP_RECT_OES
:
377 texObj
->CropRect
[0] = params
[0];
378 texObj
->CropRect
[1] = params
[1];
379 texObj
->CropRect
[2] = params
[2];
380 texObj
->CropRect
[3] = params
[3];
384 case GL_TEXTURE_SWIZZLE_R_EXT
:
385 case GL_TEXTURE_SWIZZLE_G_EXT
:
386 case GL_TEXTURE_SWIZZLE_B_EXT
:
387 case GL_TEXTURE_SWIZZLE_A_EXT
:
388 if (ctx
->Extensions
.EXT_texture_swizzle
) {
389 const GLuint comp
= pname
- GL_TEXTURE_SWIZZLE_R_EXT
;
390 const GLint swz
= comp_to_swizzle(params
[0]);
392 _mesa_error(ctx
, GL_INVALID_OPERATION
,
393 "glTexParameter(swizzle 0x%x)", params
[0]);
399 texObj
->Swizzle
[comp
] = params
[0];
400 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
405 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
406 if (ctx
->Extensions
.EXT_texture_swizzle
) {
409 for (comp
= 0; comp
< 4; comp
++) {
410 const GLint swz
= comp_to_swizzle(params
[comp
]);
412 texObj
->Swizzle
[comp
] = params
[comp
];
413 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
416 _mesa_error(ctx
, GL_INVALID_OPERATION
,
417 "glTexParameter(swizzle 0x%x)", params
[comp
]);
425 case GL_TEXTURE_SRGB_DECODE_EXT
:
426 if (ctx
->Extensions
.EXT_texture_sRGB_decode
) {
427 GLenum decode
= params
[0];
428 if (decode
== GL_DECODE_EXT
|| decode
== GL_SKIP_DECODE_EXT
) {
429 if (texObj
->Sampler
.sRGBDecode
!= decode
) {
431 texObj
->Sampler
.sRGBDecode
= decode
;
438 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
439 if (ctx
->Extensions
.AMD_seamless_cubemap_per_texture
) {
440 GLenum param
= params
[0];
441 if (param
!= GL_TRUE
&& param
!= GL_FALSE
) {
444 if (param
!= texObj
->Sampler
.CubeMapSeamless
) {
446 texObj
->Sampler
.CubeMapSeamless
= param
;
457 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(pname=%s)",
458 _mesa_lookup_enum_by_nr(pname
));
462 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(param=%s)",
463 _mesa_lookup_enum_by_nr(params
[0]));
469 * Set a float-valued texture parameter
470 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
473 set_tex_parameterf(struct gl_context
*ctx
,
474 struct gl_texture_object
*texObj
,
475 GLenum pname
, const GLfloat
*params
)
478 case GL_TEXTURE_MIN_LOD
:
479 if (texObj
->Sampler
.MinLod
== params
[0])
482 texObj
->Sampler
.MinLod
= params
[0];
485 case GL_TEXTURE_MAX_LOD
:
486 if (texObj
->Sampler
.MaxLod
== params
[0])
489 texObj
->Sampler
.MaxLod
= params
[0];
492 case GL_TEXTURE_PRIORITY
:
494 texObj
->Priority
= CLAMP(params
[0], 0.0F
, 1.0F
);
497 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
498 if (ctx
->Extensions
.EXT_texture_filter_anisotropic
) {
499 if (texObj
->Sampler
.MaxAnisotropy
== params
[0])
501 if (params
[0] < 1.0) {
502 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTexParameter(param)" );
506 /* clamp to max, that's what NVIDIA does */
507 texObj
->Sampler
.MaxAnisotropy
= MIN2(params
[0],
508 ctx
->Const
.MaxTextureMaxAnisotropy
);
512 static GLuint count
= 0;
514 _mesa_error(ctx
, GL_INVALID_ENUM
,
515 "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
519 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
520 if (ctx
->Extensions
.ARB_shadow_ambient
) {
521 if (texObj
->Sampler
.CompareFailValue
!= params
[0]) {
523 texObj
->Sampler
.CompareFailValue
= CLAMP(params
[0], 0.0F
, 1.0F
);
528 _mesa_error(ctx
, GL_INVALID_ENUM
,
529 "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)");
533 case GL_TEXTURE_LOD_BIAS
:
534 /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
535 if (texObj
->Sampler
.LodBias
!= params
[0]) {
537 texObj
->Sampler
.LodBias
= params
[0];
542 case GL_TEXTURE_BORDER_COLOR
:
544 /* ARB_texture_float disables clamping */
545 if (ctx
->Extensions
.ARB_texture_float
) {
546 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = params
[0];
547 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = params
[1];
548 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = params
[2];
549 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = params
[3];
551 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = CLAMP(params
[0], 0.0F
, 1.0F
);
552 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = CLAMP(params
[1], 0.0F
, 1.0F
);
553 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = CLAMP(params
[2], 0.0F
, 1.0F
);
554 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = CLAMP(params
[3], 0.0F
, 1.0F
);
559 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(pname=0x%x)", pname
);
566 _mesa_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
568 GLboolean need_update
;
569 struct gl_texture_object
*texObj
;
570 GET_CURRENT_CONTEXT(ctx
);
571 ASSERT_OUTSIDE_BEGIN_END(ctx
);
573 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
578 case GL_TEXTURE_MIN_FILTER
:
579 case GL_TEXTURE_MAG_FILTER
:
580 case GL_TEXTURE_WRAP_S
:
581 case GL_TEXTURE_WRAP_T
:
582 case GL_TEXTURE_WRAP_R
:
583 case GL_TEXTURE_BASE_LEVEL
:
584 case GL_TEXTURE_MAX_LEVEL
:
585 case GL_GENERATE_MIPMAP_SGIS
:
586 case GL_TEXTURE_COMPARE_MODE_ARB
:
587 case GL_TEXTURE_COMPARE_FUNC_ARB
:
588 case GL_DEPTH_TEXTURE_MODE_ARB
:
589 case GL_TEXTURE_SRGB_DECODE_EXT
:
590 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
592 /* convert float param to int */
594 p
[0] = (GLint
) param
;
595 p
[1] = p
[2] = p
[3] = 0;
596 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
601 /* this will generate an error if pname is illegal */
604 p
[1] = p
[2] = p
[3] = 0.0F
;
605 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, p
);
609 if (ctx
->Driver
.TexParameter
&& need_update
) {
610 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, ¶m
);
616 _mesa_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
618 GLboolean need_update
;
619 struct gl_texture_object
*texObj
;
620 GET_CURRENT_CONTEXT(ctx
);
621 ASSERT_OUTSIDE_BEGIN_END(ctx
);
623 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
628 case GL_TEXTURE_MIN_FILTER
:
629 case GL_TEXTURE_MAG_FILTER
:
630 case GL_TEXTURE_WRAP_S
:
631 case GL_TEXTURE_WRAP_T
:
632 case GL_TEXTURE_WRAP_R
:
633 case GL_TEXTURE_BASE_LEVEL
:
634 case GL_TEXTURE_MAX_LEVEL
:
635 case GL_GENERATE_MIPMAP_SGIS
:
636 case GL_TEXTURE_COMPARE_MODE_ARB
:
637 case GL_TEXTURE_COMPARE_FUNC_ARB
:
638 case GL_DEPTH_TEXTURE_MODE_ARB
:
639 case GL_TEXTURE_SRGB_DECODE_EXT
:
640 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
642 /* convert float param to int */
644 p
[0] = (GLint
) params
[0];
645 p
[1] = p
[2] = p
[3] = 0;
646 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
650 #if FEATURE_OES_draw_texture
651 case GL_TEXTURE_CROP_RECT_OES
:
653 /* convert float params to int */
655 iparams
[0] = (GLint
) params
[0];
656 iparams
[1] = (GLint
) params
[1];
657 iparams
[2] = (GLint
) params
[2];
658 iparams
[3] = (GLint
) params
[3];
659 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparams
);
665 /* this will generate an error if pname is illegal */
666 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, params
);
669 if (ctx
->Driver
.TexParameter
&& need_update
) {
670 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, params
);
676 _mesa_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
678 GLboolean need_update
;
679 struct gl_texture_object
*texObj
;
680 GET_CURRENT_CONTEXT(ctx
);
681 ASSERT_OUTSIDE_BEGIN_END(ctx
);
683 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
688 case GL_TEXTURE_MIN_LOD
:
689 case GL_TEXTURE_MAX_LOD
:
690 case GL_TEXTURE_PRIORITY
:
691 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
692 case GL_TEXTURE_LOD_BIAS
:
693 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
696 fparam
[0] = (GLfloat
) param
;
697 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
698 /* convert int param to float */
699 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparam
);
703 /* this will generate an error if pname is illegal */
707 iparam
[1] = iparam
[2] = iparam
[3] = 0;
708 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparam
);
712 if (ctx
->Driver
.TexParameter
&& need_update
) {
713 GLfloat fparam
= (GLfloat
) param
;
714 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, &fparam
);
720 _mesa_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
722 GLboolean need_update
;
723 struct gl_texture_object
*texObj
;
724 GET_CURRENT_CONTEXT(ctx
);
725 ASSERT_OUTSIDE_BEGIN_END(ctx
);
727 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
732 case GL_TEXTURE_BORDER_COLOR
:
734 /* convert int params to float */
736 fparams
[0] = INT_TO_FLOAT(params
[0]);
737 fparams
[1] = INT_TO_FLOAT(params
[1]);
738 fparams
[2] = INT_TO_FLOAT(params
[2]);
739 fparams
[3] = INT_TO_FLOAT(params
[3]);
740 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
);
743 case GL_TEXTURE_MIN_LOD
:
744 case GL_TEXTURE_MAX_LOD
:
745 case GL_TEXTURE_PRIORITY
:
746 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
747 case GL_TEXTURE_LOD_BIAS
:
748 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
750 /* convert int param to float */
752 fparams
[0] = (GLfloat
) params
[0];
753 fparams
[1] = fparams
[2] = fparams
[3] = 0.0F
;
754 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
);
758 /* this will generate an error if pname is illegal */
759 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, params
);
762 if (ctx
->Driver
.TexParameter
&& need_update
) {
764 fparams
[0] = INT_TO_FLOAT(params
[0]);
765 if (pname
== GL_TEXTURE_BORDER_COLOR
||
766 pname
== GL_TEXTURE_CROP_RECT_OES
) {
767 fparams
[1] = INT_TO_FLOAT(params
[1]);
768 fparams
[2] = INT_TO_FLOAT(params
[2]);
769 fparams
[3] = INT_TO_FLOAT(params
[3]);
771 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, fparams
);
777 * Set tex parameter to integer value(s). Primarily intended to set
778 * integer-valued texture border color (for integer-valued textures).
782 _mesa_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
784 struct gl_texture_object
*texObj
;
785 GET_CURRENT_CONTEXT(ctx
);
786 ASSERT_OUTSIDE_BEGIN_END(ctx
);
788 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
793 case GL_TEXTURE_BORDER_COLOR
:
794 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
795 /* set the integer-valued border color */
796 COPY_4V(texObj
->Sampler
.BorderColor
.i
, params
);
799 _mesa_TexParameteriv(target
, pname
, params
);
802 /* XXX no driver hook for TexParameterIiv() yet */
807 * Set tex parameter to unsigned integer value(s). Primarily intended to set
808 * uint-valued texture border color (for integer-valued textures).
812 _mesa_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
814 struct gl_texture_object
*texObj
;
815 GET_CURRENT_CONTEXT(ctx
);
816 ASSERT_OUTSIDE_BEGIN_END(ctx
);
818 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
823 case GL_TEXTURE_BORDER_COLOR
:
824 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
825 /* set the unsigned integer-valued border color */
826 COPY_4V(texObj
->Sampler
.BorderColor
.ui
, params
);
829 _mesa_TexParameteriv(target
, pname
, (const GLint
*) params
);
832 /* XXX no driver hook for TexParameterIuiv() yet */
839 _mesa_GetTexLevelParameterfv( GLenum target
, GLint level
,
840 GLenum pname
, GLfloat
*params
)
843 _mesa_GetTexLevelParameteriv( target
, level
, pname
, &iparam
);
844 *params
= (GLfloat
) iparam
;
849 _mesa_GetTexLevelParameteriv( GLenum target
, GLint level
,
850 GLenum pname
, GLint
*params
)
852 const struct gl_texture_unit
*texUnit
;
853 struct gl_texture_object
*texObj
;
854 const struct gl_texture_image
*img
= NULL
;
857 GET_CURRENT_CONTEXT(ctx
);
858 ASSERT_OUTSIDE_BEGIN_END(ctx
);
860 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
861 _mesa_error(ctx
, GL_INVALID_OPERATION
,
862 "glGetTexLevelParameteriv(current unit)");
866 texUnit
= _mesa_get_current_tex_unit(ctx
);
868 /* this will catch bad target values */
869 maxLevels
= _mesa_max_texture_levels(ctx
, target
);
870 if (maxLevels
== 0) {
871 _mesa_error(ctx
, GL_INVALID_ENUM
,
872 "glGetTexLevelParameter[if]v(target=0x%x)", target
);
876 if (level
< 0 || level
>= maxLevels
) {
877 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGetTexLevelParameter[if]v" );
881 texObj
= _mesa_select_tex_object(ctx
, texUnit
, target
);
883 img
= _mesa_select_tex_image(ctx
, texObj
, target
, level
);
884 if (!img
|| img
->TexFormat
== MESA_FORMAT_NONE
) {
885 /* undefined texture image */
886 if (pname
== GL_TEXTURE_COMPONENTS
)
893 texFormat
= img
->TexFormat
;
896 case GL_TEXTURE_WIDTH
:
897 *params
= img
->Width
;
899 case GL_TEXTURE_HEIGHT
:
900 *params
= img
->Height
;
902 case GL_TEXTURE_DEPTH
:
903 *params
= img
->Depth
;
905 case GL_TEXTURE_INTERNAL_FORMAT
:
906 if (_mesa_is_format_compressed(texFormat
)) {
907 /* need to return the actual compressed format */
908 *params
= _mesa_compressed_format_to_glenum(ctx
, texFormat
);
911 /* If the true internal format is not compressed but the user
912 * requested a generic compressed format, we have to return the
913 * generic base format that matches.
915 * From page 119 (page 129 of the PDF) of the OpenGL 1.3 spec:
917 * "If no specific compressed format is available,
918 * internalformat is instead replaced by the corresponding base
921 * Otherwise just return the user's requested internal format
924 _mesa_gl_compressed_format_base_format(img
->InternalFormat
);
926 *params
= (f
!= 0) ? f
: img
->InternalFormat
;
929 case GL_TEXTURE_BORDER
:
930 *params
= img
->Border
;
932 case GL_TEXTURE_RED_SIZE
:
933 if (img
->_BaseFormat
== GL_RED
) {
934 *params
= _mesa_get_format_bits(texFormat
, pname
);
938 case GL_TEXTURE_GREEN_SIZE
:
939 if (img
->_BaseFormat
== GL_RG
) {
940 *params
= _mesa_get_format_bits(texFormat
, pname
);
944 case GL_TEXTURE_BLUE_SIZE
:
945 if (img
->_BaseFormat
== GL_RGB
|| img
->_BaseFormat
== GL_RGBA
)
946 *params
= _mesa_get_format_bits(texFormat
, pname
);
950 case GL_TEXTURE_ALPHA_SIZE
:
951 if (img
->_BaseFormat
== GL_ALPHA
||
952 img
->_BaseFormat
== GL_LUMINANCE_ALPHA
||
953 img
->_BaseFormat
== GL_RGBA
)
954 *params
= _mesa_get_format_bits(texFormat
, pname
);
958 case GL_TEXTURE_INTENSITY_SIZE
:
959 if (img
->_BaseFormat
!= GL_INTENSITY
)
962 *params
= _mesa_get_format_bits(texFormat
, pname
);
964 /* intensity probably stored as rgb texture */
965 *params
= MIN2(_mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
),
966 _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
));
970 case GL_TEXTURE_LUMINANCE_SIZE
:
971 if (img
->_BaseFormat
!= GL_LUMINANCE
&&
972 img
->_BaseFormat
!= GL_LUMINANCE_ALPHA
)
975 *params
= _mesa_get_format_bits(texFormat
, pname
);
977 /* luminance probably stored as rgb texture */
978 *params
= MIN2(_mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
),
979 _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
));
983 case GL_TEXTURE_DEPTH_SIZE_ARB
:
984 if (!ctx
->Extensions
.ARB_depth_texture
)
986 *params
= _mesa_get_format_bits(texFormat
, pname
);
988 case GL_TEXTURE_STENCIL_SIZE_EXT
:
989 if (!ctx
->Extensions
.EXT_packed_depth_stencil
&&
990 !ctx
->Extensions
.ARB_framebuffer_object
)
992 *params
= _mesa_get_format_bits(texFormat
, pname
);
994 case GL_TEXTURE_SHARED_SIZE
:
995 if (ctx
->VersionMajor
< 3 &&
996 !ctx
->Extensions
.EXT_texture_shared_exponent
)
998 *params
= texFormat
== MESA_FORMAT_RGB9_E5_FLOAT
? 5 : 0;
1001 /* GL_ARB_texture_compression */
1002 case GL_TEXTURE_COMPRESSED_IMAGE_SIZE
:
1003 if (_mesa_is_format_compressed(texFormat
) &&
1004 !_mesa_is_proxy_texture(target
)) {
1005 *params
= _mesa_format_image_size(texFormat
, img
->Width
,
1006 img
->Height
, img
->Depth
);
1009 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1010 "glGetTexLevelParameter[if]v(pname)");
1013 case GL_TEXTURE_COMPRESSED
:
1014 *params
= (GLint
) _mesa_is_format_compressed(texFormat
);
1017 /* GL_ARB_texture_float */
1018 case GL_TEXTURE_RED_TYPE_ARB
:
1019 if (!ctx
->Extensions
.ARB_texture_float
)
1021 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
) ?
1022 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1024 case GL_TEXTURE_GREEN_TYPE_ARB
:
1025 if (!ctx
->Extensions
.ARB_texture_float
)
1027 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
) ?
1028 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1030 case GL_TEXTURE_BLUE_TYPE_ARB
:
1031 if (!ctx
->Extensions
.ARB_texture_float
)
1033 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_BLUE_SIZE
) ?
1034 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1036 case GL_TEXTURE_ALPHA_TYPE_ARB
:
1037 if (!ctx
->Extensions
.ARB_texture_float
)
1039 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_ALPHA_SIZE
) ?
1040 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1042 case GL_TEXTURE_LUMINANCE_TYPE_ARB
:
1043 if (!ctx
->Extensions
.ARB_texture_float
)
1045 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_LUMINANCE_SIZE
) ?
1046 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1048 case GL_TEXTURE_INTENSITY_TYPE_ARB
:
1049 if (!ctx
->Extensions
.ARB_texture_float
)
1051 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_INTENSITY_SIZE
) ?
1052 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1054 case GL_TEXTURE_DEPTH_TYPE_ARB
:
1055 if (!ctx
->Extensions
.ARB_texture_float
)
1057 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_DEPTH_SIZE
) ?
1058 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1065 /* no error if we get here */
1069 _mesa_error(ctx
, GL_INVALID_ENUM
,
1070 "glGetTexLevelParameter[if]v(pname=%s)",
1071 _mesa_lookup_enum_by_nr(pname
));
1077 _mesa_GetTexParameterfv( GLenum target
, GLenum pname
, GLfloat
*params
)
1079 struct gl_texture_object
*obj
;
1080 GET_CURRENT_CONTEXT(ctx
);
1081 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1083 obj
= get_texobj(ctx
, target
, GL_TRUE
);
1087 _mesa_lock_texture(ctx
, obj
);
1089 case GL_TEXTURE_MAG_FILTER
:
1090 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MagFilter
);
1092 case GL_TEXTURE_MIN_FILTER
:
1093 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MinFilter
);
1095 case GL_TEXTURE_WRAP_S
:
1096 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapS
);
1098 case GL_TEXTURE_WRAP_T
:
1099 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapT
);
1101 case GL_TEXTURE_WRAP_R
:
1102 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapR
);
1104 case GL_TEXTURE_BORDER_COLOR
:
1105 if (ctx
->NewState
& (_NEW_BUFFERS
| _NEW_FRAG_CLAMP
))
1106 _mesa_update_state_locked(ctx
);
1107 if (ctx
->Color
._ClampFragmentColor
) {
1108 params
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
1109 params
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
1110 params
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
1111 params
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
1114 params
[0] = obj
->Sampler
.BorderColor
.f
[0];
1115 params
[1] = obj
->Sampler
.BorderColor
.f
[1];
1116 params
[2] = obj
->Sampler
.BorderColor
.f
[2];
1117 params
[3] = obj
->Sampler
.BorderColor
.f
[3];
1120 case GL_TEXTURE_RESIDENT
:
1121 *params
= ctx
->Driver
.IsTextureResident
?
1122 ctx
->Driver
.IsTextureResident(ctx
, obj
) : 1.0F
;
1124 case GL_TEXTURE_PRIORITY
:
1125 *params
= obj
->Priority
;
1127 case GL_TEXTURE_MIN_LOD
:
1128 *params
= obj
->Sampler
.MinLod
;
1130 case GL_TEXTURE_MAX_LOD
:
1131 *params
= obj
->Sampler
.MaxLod
;
1133 case GL_TEXTURE_BASE_LEVEL
:
1134 *params
= (GLfloat
) obj
->BaseLevel
;
1136 case GL_TEXTURE_MAX_LEVEL
:
1137 *params
= (GLfloat
) obj
->MaxLevel
;
1139 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1140 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
1142 *params
= obj
->Sampler
.MaxAnisotropy
;
1144 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
1145 if (!ctx
->Extensions
.ARB_shadow_ambient
)
1147 *params
= obj
->Sampler
.CompareFailValue
;
1149 case GL_GENERATE_MIPMAP_SGIS
:
1150 *params
= (GLfloat
) obj
->GenerateMipmap
;
1152 case GL_TEXTURE_COMPARE_MODE_ARB
:
1153 if (!ctx
->Extensions
.ARB_shadow
)
1155 *params
= (GLfloat
) obj
->Sampler
.CompareMode
;
1157 case GL_TEXTURE_COMPARE_FUNC_ARB
:
1158 if (!ctx
->Extensions
.ARB_shadow
)
1160 *params
= (GLfloat
) obj
->Sampler
.CompareFunc
;
1162 case GL_DEPTH_TEXTURE_MODE_ARB
:
1163 if (!ctx
->Extensions
.ARB_depth_texture
)
1165 *params
= (GLfloat
) obj
->Sampler
.DepthMode
;
1167 case GL_TEXTURE_LOD_BIAS
:
1168 *params
= obj
->Sampler
.LodBias
;
1170 #if FEATURE_OES_draw_texture
1171 case GL_TEXTURE_CROP_RECT_OES
:
1172 params
[0] = obj
->CropRect
[0];
1173 params
[1] = obj
->CropRect
[1];
1174 params
[2] = obj
->CropRect
[2];
1175 params
[3] = obj
->CropRect
[3];
1179 case GL_TEXTURE_SWIZZLE_R_EXT
:
1180 case GL_TEXTURE_SWIZZLE_G_EXT
:
1181 case GL_TEXTURE_SWIZZLE_B_EXT
:
1182 case GL_TEXTURE_SWIZZLE_A_EXT
:
1183 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1185 *params
= (GLfloat
) obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
1188 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
1189 if (!ctx
->Extensions
.EXT_texture_swizzle
) {
1194 for (comp
= 0; comp
< 4; comp
++) {
1195 params
[comp
] = (GLfloat
) obj
->Swizzle
[comp
];
1200 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1201 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1203 *params
= (GLfloat
) obj
->Sampler
.CubeMapSeamless
;
1206 case GL_TEXTURE_IMMUTABLE_FORMAT
:
1207 if (!ctx
->Extensions
.ARB_texture_storage
)
1209 *params
= (GLfloat
) obj
->Immutable
;
1216 /* no error if we get here */
1217 _mesa_unlock_texture(ctx
, obj
);
1221 _mesa_unlock_texture(ctx
, obj
);
1222 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexParameterfv(pname=0x%x)", pname
);
1227 _mesa_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
1229 struct gl_texture_object
*obj
;
1230 GET_CURRENT_CONTEXT(ctx
);
1231 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1233 obj
= get_texobj(ctx
, target
, GL_TRUE
);
1237 _mesa_lock_texture(ctx
, obj
);
1239 case GL_TEXTURE_MAG_FILTER
:
1240 *params
= (GLint
) obj
->Sampler
.MagFilter
;
1242 case GL_TEXTURE_MIN_FILTER
:
1243 *params
= (GLint
) obj
->Sampler
.MinFilter
;
1245 case GL_TEXTURE_WRAP_S
:
1246 *params
= (GLint
) obj
->Sampler
.WrapS
;
1248 case GL_TEXTURE_WRAP_T
:
1249 *params
= (GLint
) obj
->Sampler
.WrapT
;
1251 case GL_TEXTURE_WRAP_R
:
1252 *params
= (GLint
) obj
->Sampler
.WrapR
;
1254 case GL_TEXTURE_BORDER_COLOR
:
1257 b
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
1258 b
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
1259 b
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
1260 b
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
1261 params
[0] = FLOAT_TO_INT(b
[0]);
1262 params
[1] = FLOAT_TO_INT(b
[1]);
1263 params
[2] = FLOAT_TO_INT(b
[2]);
1264 params
[3] = FLOAT_TO_INT(b
[3]);
1267 case GL_TEXTURE_RESIDENT
:
1268 *params
= ctx
->Driver
.IsTextureResident
?
1269 ctx
->Driver
.IsTextureResident(ctx
, obj
) : 1;
1271 case GL_TEXTURE_PRIORITY
:
1272 *params
= FLOAT_TO_INT(obj
->Priority
);
1274 case GL_TEXTURE_MIN_LOD
:
1275 *params
= (GLint
) obj
->Sampler
.MinLod
;
1277 case GL_TEXTURE_MAX_LOD
:
1278 *params
= (GLint
) obj
->Sampler
.MaxLod
;
1280 case GL_TEXTURE_BASE_LEVEL
:
1281 *params
= obj
->BaseLevel
;
1283 case GL_TEXTURE_MAX_LEVEL
:
1284 *params
= obj
->MaxLevel
;
1286 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1287 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
1289 *params
= (GLint
) obj
->Sampler
.MaxAnisotropy
;
1291 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
1292 if (!ctx
->Extensions
.ARB_shadow_ambient
)
1294 *params
= (GLint
) FLOAT_TO_INT(obj
->Sampler
.CompareFailValue
);
1296 case GL_GENERATE_MIPMAP_SGIS
:
1297 *params
= (GLint
) obj
->GenerateMipmap
;
1299 case GL_TEXTURE_COMPARE_MODE_ARB
:
1300 if (!ctx
->Extensions
.ARB_shadow
)
1302 *params
= (GLint
) obj
->Sampler
.CompareMode
;
1304 case GL_TEXTURE_COMPARE_FUNC_ARB
:
1305 if (!ctx
->Extensions
.ARB_shadow
)
1307 *params
= (GLint
) obj
->Sampler
.CompareFunc
;
1309 case GL_DEPTH_TEXTURE_MODE_ARB
:
1310 if (!ctx
->Extensions
.ARB_depth_texture
)
1312 *params
= (GLint
) obj
->Sampler
.DepthMode
;
1314 case GL_TEXTURE_LOD_BIAS
:
1315 *params
= (GLint
) obj
->Sampler
.LodBias
;
1317 #if FEATURE_OES_draw_texture
1318 case GL_TEXTURE_CROP_RECT_OES
:
1319 params
[0] = obj
->CropRect
[0];
1320 params
[1] = obj
->CropRect
[1];
1321 params
[2] = obj
->CropRect
[2];
1322 params
[3] = obj
->CropRect
[3];
1325 case GL_TEXTURE_SWIZZLE_R_EXT
:
1326 case GL_TEXTURE_SWIZZLE_G_EXT
:
1327 case GL_TEXTURE_SWIZZLE_B_EXT
:
1328 case GL_TEXTURE_SWIZZLE_A_EXT
:
1329 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1331 *params
= obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
1334 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
1335 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1337 COPY_4V(params
, obj
->Swizzle
);
1340 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1341 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1343 *params
= (GLint
) obj
->Sampler
.CubeMapSeamless
;
1346 case GL_TEXTURE_IMMUTABLE_FORMAT
:
1347 if (!ctx
->Extensions
.ARB_texture_storage
)
1349 *params
= (GLint
) obj
->Immutable
;
1356 /* no error if we get here */
1357 _mesa_unlock_texture(ctx
, obj
);
1361 _mesa_unlock_texture(ctx
, obj
);
1362 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexParameteriv(pname=0x%x)", pname
);
1366 /** New in GL 3.0 */
1368 _mesa_GetTexParameterIiv(GLenum target
, GLenum pname
, GLint
*params
)
1370 struct gl_texture_object
*texObj
;
1371 GET_CURRENT_CONTEXT(ctx
);
1372 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1374 texObj
= get_texobj(ctx
, target
, GL_TRUE
);
1379 case GL_TEXTURE_BORDER_COLOR
:
1380 COPY_4V(params
, texObj
->Sampler
.BorderColor
.i
);
1383 _mesa_GetTexParameteriv(target
, pname
, params
);
1388 /** New in GL 3.0 */
1390 _mesa_GetTexParameterIuiv(GLenum target
, GLenum pname
, GLuint
*params
)
1392 struct gl_texture_object
*texObj
;
1393 GET_CURRENT_CONTEXT(ctx
);
1394 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1396 texObj
= get_texobj(ctx
, target
, GL_TRUE
);
1401 case GL_TEXTURE_BORDER_COLOR
:
1402 COPY_4V(params
, texObj
->Sampler
.BorderColor
.i
);
1407 _mesa_GetTexParameteriv(target
, pname
, ip
);
1409 if (pname
== GL_TEXTURE_SWIZZLE_RGBA_EXT
||
1410 pname
== GL_TEXTURE_CROP_RECT_OES
) {