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 e
->ARB_texture_mirrored_repeat
) ||
67 (wrap
== GL_MIRROR_CLAMP_EXT
&&
68 (e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
)) ||
69 (wrap
== GL_MIRROR_CLAMP_TO_EDGE_EXT
&&
70 (e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
)) ||
71 (wrap
== GL_MIRROR_CLAMP_TO_BORDER_EXT
&&
72 (e
->EXT_texture_mirror_clamp
)))) {
73 /* non-rectangle texture */
77 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexParameter(param=0x%x)", wrap
);
83 * Get current texture object for given target.
84 * Return NULL if any error (and record the error).
85 * Note that this is different from _mesa_select_tex_object() in that proxy
86 * targets are not accepted.
87 * Only the glGetTexLevelParameter() functions accept proxy targets.
89 static struct gl_texture_object
*
90 get_texobj(struct gl_context
*ctx
, GLenum target
, GLboolean get
)
92 struct gl_texture_unit
*texUnit
;
94 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
95 _mesa_error(ctx
, GL_INVALID_OPERATION
,
96 "gl%sTexParameter(current unit)", get
? "Get" : "");
100 texUnit
= _mesa_get_current_tex_unit(ctx
);
104 return texUnit
->CurrentTex
[TEXTURE_1D_INDEX
];
106 return texUnit
->CurrentTex
[TEXTURE_2D_INDEX
];
108 return texUnit
->CurrentTex
[TEXTURE_3D_INDEX
];
109 case GL_TEXTURE_CUBE_MAP
:
110 if (ctx
->Extensions
.ARB_texture_cube_map
) {
111 return texUnit
->CurrentTex
[TEXTURE_CUBE_INDEX
];
114 case GL_TEXTURE_RECTANGLE_NV
:
115 if (ctx
->Extensions
.NV_texture_rectangle
) {
116 return texUnit
->CurrentTex
[TEXTURE_RECT_INDEX
];
119 case GL_TEXTURE_1D_ARRAY_EXT
:
120 if (ctx
->Extensions
.MESA_texture_array
||
121 ctx
->Extensions
.EXT_texture_array
) {
122 return texUnit
->CurrentTex
[TEXTURE_1D_ARRAY_INDEX
];
125 case GL_TEXTURE_2D_ARRAY_EXT
:
126 if (ctx
->Extensions
.MESA_texture_array
||
127 ctx
->Extensions
.EXT_texture_array
) {
128 return texUnit
->CurrentTex
[TEXTURE_2D_ARRAY_INDEX
];
135 _mesa_error(ctx
, GL_INVALID_ENUM
,
136 "gl%sTexParameter(target)", get
? "Get" : "");
142 * Convert GL_RED/GREEN/BLUE/ALPHA/ZERO/ONE to SWIZZLE_X/Y/Z/W/ZERO/ONE.
143 * \return -1 if error.
146 comp_to_swizzle(GLenum comp
)
168 set_swizzle_component(GLuint
*swizzle
, GLuint comp
, GLuint swz
)
171 ASSERT(swz
<= SWIZZLE_NIL
);
173 GLuint mask
= 0x7 << (3 * comp
);
174 GLuint s
= (*swizzle
& ~mask
) | (swz
<< (3 * comp
));
181 * This is called just prior to changing any texture object state which
182 * will not effect texture completeness.
185 flush(struct gl_context
*ctx
)
187 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
192 * This is called just prior to changing any texture object state which
193 * can effect texture completeness (texture base level, max level,
194 * minification filter).
195 * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
196 * state flag and then mark the texture object as 'incomplete' so that any
197 * per-texture derived state gets recomputed.
200 incomplete(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
202 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
203 texObj
->_Complete
= GL_FALSE
;
208 * Set an integer-valued texture parameter
209 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
212 set_tex_parameteri(struct gl_context
*ctx
,
213 struct gl_texture_object
*texObj
,
214 GLenum pname
, const GLint
*params
)
217 case GL_TEXTURE_MIN_FILTER
:
218 if (texObj
->Sampler
.MinFilter
== params
[0])
223 incomplete(ctx
, texObj
);
224 texObj
->Sampler
.MinFilter
= params
[0];
226 case GL_NEAREST_MIPMAP_NEAREST
:
227 case GL_LINEAR_MIPMAP_NEAREST
:
228 case GL_NEAREST_MIPMAP_LINEAR
:
229 case GL_LINEAR_MIPMAP_LINEAR
:
230 if (texObj
->Target
!= GL_TEXTURE_RECTANGLE_NV
) {
231 incomplete(ctx
, texObj
);
232 texObj
->Sampler
.MinFilter
= params
[0];
241 case GL_TEXTURE_MAG_FILTER
:
242 if (texObj
->Sampler
.MagFilter
== params
[0])
247 flush(ctx
); /* does not effect completeness */
248 texObj
->Sampler
.MagFilter
= params
[0];
255 case GL_TEXTURE_WRAP_S
:
256 if (texObj
->Sampler
.WrapS
== params
[0])
258 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
260 texObj
->Sampler
.WrapS
= params
[0];
265 case GL_TEXTURE_WRAP_T
:
266 if (texObj
->Sampler
.WrapT
== params
[0])
268 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
270 texObj
->Sampler
.WrapT
= params
[0];
275 case GL_TEXTURE_WRAP_R
:
276 if (texObj
->Sampler
.WrapR
== params
[0])
278 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
280 texObj
->Sampler
.WrapR
= params
[0];
285 case GL_TEXTURE_BASE_LEVEL
:
286 if (texObj
->BaseLevel
== params
[0])
289 (texObj
->Target
== GL_TEXTURE_RECTANGLE_ARB
&& params
[0] != 0)) {
290 _mesa_error(ctx
, GL_INVALID_VALUE
,
291 "glTexParameter(param=%d)", params
[0]);
294 incomplete(ctx
, texObj
);
295 texObj
->BaseLevel
= params
[0];
298 case GL_TEXTURE_MAX_LEVEL
:
299 if (texObj
->MaxLevel
== params
[0])
301 if (params
[0] < 0 || texObj
->Target
== GL_TEXTURE_RECTANGLE_ARB
) {
302 _mesa_error(ctx
, GL_INVALID_OPERATION
,
303 "glTexParameter(param=%d)", params
[0]);
306 incomplete(ctx
, texObj
);
307 texObj
->MaxLevel
= params
[0];
310 case GL_GENERATE_MIPMAP_SGIS
:
311 if (texObj
->GenerateMipmap
!= params
[0]) {
313 texObj
->GenerateMipmap
= params
[0] ? GL_TRUE
: GL_FALSE
;
318 case GL_TEXTURE_COMPARE_MODE_ARB
:
319 if (ctx
->Extensions
.ARB_shadow
) {
320 if (texObj
->Sampler
.CompareMode
== params
[0])
322 if (params
[0] == GL_NONE
||
323 params
[0] == GL_COMPARE_R_TO_TEXTURE_ARB
) {
325 texObj
->Sampler
.CompareMode
= params
[0];
332 case GL_TEXTURE_COMPARE_FUNC_ARB
:
333 if (ctx
->Extensions
.ARB_shadow
) {
334 if (texObj
->Sampler
.CompareFunc
== params
[0])
340 texObj
->Sampler
.CompareFunc
= params
[0];
348 if (ctx
->Extensions
.EXT_shadow_funcs
) {
350 texObj
->Sampler
.CompareFunc
= params
[0];
360 case GL_DEPTH_TEXTURE_MODE_ARB
:
361 if (ctx
->Extensions
.ARB_depth_texture
) {
362 if (texObj
->Sampler
.DepthMode
== params
[0])
364 if (params
[0] == GL_LUMINANCE
||
365 params
[0] == GL_INTENSITY
||
366 params
[0] == GL_ALPHA
||
367 (ctx
->Extensions
.ARB_texture_rg
&& params
[0] == GL_RED
)) {
369 texObj
->Sampler
.DepthMode
= params
[0];
376 #if FEATURE_OES_draw_texture
377 case GL_TEXTURE_CROP_RECT_OES
:
378 texObj
->CropRect
[0] = params
[0];
379 texObj
->CropRect
[1] = params
[1];
380 texObj
->CropRect
[2] = params
[2];
381 texObj
->CropRect
[3] = params
[3];
385 case GL_TEXTURE_SWIZZLE_R_EXT
:
386 case GL_TEXTURE_SWIZZLE_G_EXT
:
387 case GL_TEXTURE_SWIZZLE_B_EXT
:
388 case GL_TEXTURE_SWIZZLE_A_EXT
:
389 if (ctx
->Extensions
.EXT_texture_swizzle
) {
390 const GLuint comp
= pname
- GL_TEXTURE_SWIZZLE_R_EXT
;
391 const GLint swz
= comp_to_swizzle(params
[0]);
393 _mesa_error(ctx
, GL_INVALID_OPERATION
,
394 "glTexParameter(swizzle 0x%x)", params
[0]);
400 texObj
->Swizzle
[comp
] = params
[0];
401 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
407 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
408 if (ctx
->Extensions
.EXT_texture_swizzle
) {
411 for (comp
= 0; comp
< 4; comp
++) {
412 const GLint swz
= comp_to_swizzle(params
[comp
]);
414 texObj
->Swizzle
[comp
] = params
[comp
];
415 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
418 _mesa_error(ctx
, GL_INVALID_OPERATION
,
419 "glTexParameter(swizzle 0x%x)", params
[comp
]);
427 case GL_TEXTURE_SRGB_DECODE_EXT
:
428 if (ctx
->Extensions
.EXT_texture_sRGB_decode
) {
429 GLenum decode
= params
[0];
430 if (decode
== GL_DECODE_EXT
|| decode
== GL_SKIP_DECODE_EXT
) {
431 if (texObj
->Sampler
.sRGBDecode
!= decode
) {
433 texObj
->Sampler
.sRGBDecode
= decode
;
440 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
441 if (ctx
->Extensions
.AMD_seamless_cubemap_per_texture
) {
442 GLenum param
= params
[0];
443 if (param
!= GL_TRUE
&& param
!= GL_FALSE
) {
446 if (param
!= texObj
->Sampler
.CubeMapSeamless
) {
448 texObj
->Sampler
.CubeMapSeamless
= param
;
459 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(pname=%s)",
460 _mesa_lookup_enum_by_nr(pname
));
464 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(param=%s)",
465 _mesa_lookup_enum_by_nr(params
[0]));
471 * Set a float-valued texture parameter
472 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
475 set_tex_parameterf(struct gl_context
*ctx
,
476 struct gl_texture_object
*texObj
,
477 GLenum pname
, const GLfloat
*params
)
480 case GL_TEXTURE_MIN_LOD
:
481 if (texObj
->Sampler
.MinLod
== params
[0])
484 texObj
->Sampler
.MinLod
= params
[0];
487 case GL_TEXTURE_MAX_LOD
:
488 if (texObj
->Sampler
.MaxLod
== params
[0])
491 texObj
->Sampler
.MaxLod
= params
[0];
494 case GL_TEXTURE_PRIORITY
:
496 texObj
->Priority
= CLAMP(params
[0], 0.0F
, 1.0F
);
499 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
500 if (ctx
->Extensions
.EXT_texture_filter_anisotropic
) {
501 if (texObj
->Sampler
.MaxAnisotropy
== params
[0])
503 if (params
[0] < 1.0) {
504 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTexParameter(param)" );
508 /* clamp to max, that's what NVIDIA does */
509 texObj
->Sampler
.MaxAnisotropy
= MIN2(params
[0],
510 ctx
->Const
.MaxTextureMaxAnisotropy
);
514 static GLuint count
= 0;
516 _mesa_error(ctx
, GL_INVALID_ENUM
,
517 "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
521 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
522 if (ctx
->Extensions
.ARB_shadow_ambient
) {
523 if (texObj
->Sampler
.CompareFailValue
!= params
[0]) {
525 texObj
->Sampler
.CompareFailValue
= CLAMP(params
[0], 0.0F
, 1.0F
);
530 _mesa_error(ctx
, GL_INVALID_ENUM
,
531 "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)");
535 case GL_TEXTURE_LOD_BIAS
:
536 /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
537 if (ctx
->Extensions
.EXT_texture_lod_bias
) {
538 if (texObj
->Sampler
.LodBias
!= params
[0]) {
540 texObj
->Sampler
.LodBias
= params
[0];
547 case GL_TEXTURE_BORDER_COLOR
:
549 /* ARB_texture_float disables clamping */
550 if (ctx
->Extensions
.ARB_texture_float
) {
551 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = params
[0];
552 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = params
[1];
553 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = params
[2];
554 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = params
[3];
556 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = CLAMP(params
[0], 0.0F
, 1.0F
);
557 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = CLAMP(params
[1], 0.0F
, 1.0F
);
558 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = CLAMP(params
[2], 0.0F
, 1.0F
);
559 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = CLAMP(params
[3], 0.0F
, 1.0F
);
564 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(pname=0x%x)", pname
);
571 _mesa_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
573 GLboolean need_update
;
574 struct gl_texture_object
*texObj
;
575 GET_CURRENT_CONTEXT(ctx
);
576 ASSERT_OUTSIDE_BEGIN_END(ctx
);
578 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
583 case GL_TEXTURE_MIN_FILTER
:
584 case GL_TEXTURE_MAG_FILTER
:
585 case GL_TEXTURE_WRAP_S
:
586 case GL_TEXTURE_WRAP_T
:
587 case GL_TEXTURE_WRAP_R
:
588 case GL_TEXTURE_BASE_LEVEL
:
589 case GL_TEXTURE_MAX_LEVEL
:
590 case GL_GENERATE_MIPMAP_SGIS
:
591 case GL_TEXTURE_COMPARE_MODE_ARB
:
592 case GL_TEXTURE_COMPARE_FUNC_ARB
:
593 case GL_DEPTH_TEXTURE_MODE_ARB
:
594 case GL_TEXTURE_SRGB_DECODE_EXT
:
595 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
597 /* convert float param to int */
599 p
[0] = (GLint
) param
;
600 p
[1] = p
[2] = p
[3] = 0;
601 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
606 /* this will generate an error if pname is illegal */
609 p
[1] = p
[2] = p
[3] = 0.0F
;
610 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, p
);
614 if (ctx
->Driver
.TexParameter
&& need_update
) {
615 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, ¶m
);
621 _mesa_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
623 GLboolean need_update
;
624 struct gl_texture_object
*texObj
;
625 GET_CURRENT_CONTEXT(ctx
);
626 ASSERT_OUTSIDE_BEGIN_END(ctx
);
628 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
633 case GL_TEXTURE_MIN_FILTER
:
634 case GL_TEXTURE_MAG_FILTER
:
635 case GL_TEXTURE_WRAP_S
:
636 case GL_TEXTURE_WRAP_T
:
637 case GL_TEXTURE_WRAP_R
:
638 case GL_TEXTURE_BASE_LEVEL
:
639 case GL_TEXTURE_MAX_LEVEL
:
640 case GL_GENERATE_MIPMAP_SGIS
:
641 case GL_TEXTURE_COMPARE_MODE_ARB
:
642 case GL_TEXTURE_COMPARE_FUNC_ARB
:
643 case GL_DEPTH_TEXTURE_MODE_ARB
:
644 case GL_TEXTURE_SRGB_DECODE_EXT
:
645 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
647 /* convert float param to int */
649 p
[0] = (GLint
) params
[0];
650 p
[1] = p
[2] = p
[3] = 0;
651 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
655 #if FEATURE_OES_draw_texture
656 case GL_TEXTURE_CROP_RECT_OES
:
658 /* convert float params to int */
660 iparams
[0] = (GLint
) params
[0];
661 iparams
[1] = (GLint
) params
[1];
662 iparams
[2] = (GLint
) params
[2];
663 iparams
[3] = (GLint
) params
[3];
664 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparams
);
670 /* this will generate an error if pname is illegal */
671 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, params
);
674 if (ctx
->Driver
.TexParameter
&& need_update
) {
675 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, params
);
681 _mesa_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
683 GLboolean need_update
;
684 struct gl_texture_object
*texObj
;
685 GET_CURRENT_CONTEXT(ctx
);
686 ASSERT_OUTSIDE_BEGIN_END(ctx
);
688 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
693 case GL_TEXTURE_MIN_LOD
:
694 case GL_TEXTURE_MAX_LOD
:
695 case GL_TEXTURE_PRIORITY
:
696 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
697 case GL_TEXTURE_LOD_BIAS
:
698 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
701 fparam
[0] = (GLfloat
) param
;
702 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
703 /* convert int param to float */
704 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparam
);
708 /* this will generate an error if pname is illegal */
712 iparam
[1] = iparam
[2] = iparam
[3] = 0;
713 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparam
);
717 if (ctx
->Driver
.TexParameter
&& need_update
) {
718 GLfloat fparam
= (GLfloat
) param
;
719 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, &fparam
);
725 _mesa_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
727 GLboolean need_update
;
728 struct gl_texture_object
*texObj
;
729 GET_CURRENT_CONTEXT(ctx
);
730 ASSERT_OUTSIDE_BEGIN_END(ctx
);
732 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
737 case GL_TEXTURE_BORDER_COLOR
:
739 /* convert int params to float */
741 fparams
[0] = INT_TO_FLOAT(params
[0]);
742 fparams
[1] = INT_TO_FLOAT(params
[1]);
743 fparams
[2] = INT_TO_FLOAT(params
[2]);
744 fparams
[3] = INT_TO_FLOAT(params
[3]);
745 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
);
748 case GL_TEXTURE_MIN_LOD
:
749 case GL_TEXTURE_MAX_LOD
:
750 case GL_TEXTURE_PRIORITY
:
751 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
752 case GL_TEXTURE_LOD_BIAS
:
753 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
755 /* convert int param to float */
757 fparams
[0] = (GLfloat
) params
[0];
758 fparams
[1] = fparams
[2] = fparams
[3] = 0.0F
;
759 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
);
763 /* this will generate an error if pname is illegal */
764 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, params
);
767 if (ctx
->Driver
.TexParameter
&& need_update
) {
769 fparams
[0] = INT_TO_FLOAT(params
[0]);
770 if (pname
== GL_TEXTURE_BORDER_COLOR
||
771 pname
== GL_TEXTURE_CROP_RECT_OES
) {
772 fparams
[1] = INT_TO_FLOAT(params
[1]);
773 fparams
[2] = INT_TO_FLOAT(params
[2]);
774 fparams
[3] = INT_TO_FLOAT(params
[3]);
776 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, fparams
);
782 * Set tex parameter to integer value(s). Primarily intended to set
783 * integer-valued texture border color (for integer-valued textures).
787 _mesa_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
789 struct gl_texture_object
*texObj
;
790 GET_CURRENT_CONTEXT(ctx
);
791 ASSERT_OUTSIDE_BEGIN_END(ctx
);
793 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
798 case GL_TEXTURE_BORDER_COLOR
:
799 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
800 /* set the integer-valued border color */
801 COPY_4V(texObj
->Sampler
.BorderColor
.i
, params
);
804 _mesa_TexParameteriv(target
, pname
, params
);
807 /* XXX no driver hook for TexParameterIiv() yet */
812 * Set tex parameter to unsigned integer value(s). Primarily intended to set
813 * uint-valued texture border color (for integer-valued textures).
817 _mesa_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
819 struct gl_texture_object
*texObj
;
820 GET_CURRENT_CONTEXT(ctx
);
821 ASSERT_OUTSIDE_BEGIN_END(ctx
);
823 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
828 case GL_TEXTURE_BORDER_COLOR
:
829 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
830 /* set the unsigned integer-valued border color */
831 COPY_4V(texObj
->Sampler
.BorderColor
.ui
, params
);
834 _mesa_TexParameteriv(target
, pname
, (const GLint
*) params
);
837 /* XXX no driver hook for TexParameterIuiv() yet */
844 _mesa_GetTexLevelParameterfv( GLenum target
, GLint level
,
845 GLenum pname
, GLfloat
*params
)
848 _mesa_GetTexLevelParameteriv( target
, level
, pname
, &iparam
);
849 *params
= (GLfloat
) iparam
;
854 _mesa_GetTexLevelParameteriv( GLenum target
, GLint level
,
855 GLenum pname
, GLint
*params
)
857 const struct gl_texture_unit
*texUnit
;
858 struct gl_texture_object
*texObj
;
859 const struct gl_texture_image
*img
= NULL
;
862 GET_CURRENT_CONTEXT(ctx
);
863 ASSERT_OUTSIDE_BEGIN_END(ctx
);
865 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
866 _mesa_error(ctx
, GL_INVALID_OPERATION
,
867 "glGetTexLevelParameteriv(current unit)");
871 texUnit
= _mesa_get_current_tex_unit(ctx
);
873 /* this will catch bad target values */
874 maxLevels
= _mesa_max_texture_levels(ctx
, target
);
875 if (maxLevels
== 0) {
876 _mesa_error(ctx
, GL_INVALID_ENUM
,
877 "glGetTexLevelParameter[if]v(target=0x%x)", target
);
881 if (level
< 0 || level
>= maxLevels
) {
882 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGetTexLevelParameter[if]v" );
886 texObj
= _mesa_select_tex_object(ctx
, texUnit
, target
);
888 img
= _mesa_select_tex_image(ctx
, texObj
, target
, level
);
889 if (!img
|| img
->TexFormat
== MESA_FORMAT_NONE
) {
890 /* undefined texture image */
891 if (pname
== GL_TEXTURE_COMPONENTS
)
898 texFormat
= img
->TexFormat
;
901 case GL_TEXTURE_WIDTH
:
902 *params
= img
->Width
;
904 case GL_TEXTURE_HEIGHT
:
905 *params
= img
->Height
;
907 case GL_TEXTURE_DEPTH
:
908 *params
= img
->Depth
;
910 case GL_TEXTURE_INTERNAL_FORMAT
:
911 if (_mesa_is_format_compressed(texFormat
)) {
912 /* need to return the actual compressed format */
913 *params
= _mesa_compressed_format_to_glenum(ctx
, texFormat
);
916 /* If the true internal format is not compressed but the user
917 * requested a generic compressed format, we have to return the
918 * generic base format that matches.
920 * From page 119 (page 129 of the PDF) of the OpenGL 1.3 spec:
922 * "If no specific compressed format is available,
923 * internalformat is instead replaced by the corresponding base
926 * Otherwise just return the user's requested internal format
929 _mesa_gl_compressed_format_base_format(img
->InternalFormat
);
931 *params
= (f
!= 0) ? f
: img
->InternalFormat
;
934 case GL_TEXTURE_BORDER
:
935 *params
= img
->Border
;
937 case GL_TEXTURE_RED_SIZE
:
938 if (img
->_BaseFormat
== GL_RED
) {
939 *params
= _mesa_get_format_bits(texFormat
, pname
);
943 case GL_TEXTURE_GREEN_SIZE
:
944 if (img
->_BaseFormat
== GL_RG
) {
945 *params
= _mesa_get_format_bits(texFormat
, pname
);
949 case GL_TEXTURE_BLUE_SIZE
:
950 if (img
->_BaseFormat
== GL_RGB
|| img
->_BaseFormat
== GL_RGBA
)
951 *params
= _mesa_get_format_bits(texFormat
, pname
);
955 case GL_TEXTURE_ALPHA_SIZE
:
956 if (img
->_BaseFormat
== GL_ALPHA
||
957 img
->_BaseFormat
== GL_LUMINANCE_ALPHA
||
958 img
->_BaseFormat
== GL_RGBA
)
959 *params
= _mesa_get_format_bits(texFormat
, pname
);
963 case GL_TEXTURE_INTENSITY_SIZE
:
964 if (img
->_BaseFormat
!= GL_INTENSITY
)
967 *params
= _mesa_get_format_bits(texFormat
, pname
);
969 /* intensity probably stored as rgb texture */
970 *params
= MIN2(_mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
),
971 _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
));
975 case GL_TEXTURE_LUMINANCE_SIZE
:
976 if (img
->_BaseFormat
!= GL_LUMINANCE
&&
977 img
->_BaseFormat
!= GL_LUMINANCE_ALPHA
)
980 *params
= _mesa_get_format_bits(texFormat
, pname
);
982 /* luminance probably stored as rgb texture */
983 *params
= MIN2(_mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
),
984 _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
));
988 case GL_TEXTURE_DEPTH_SIZE_ARB
:
989 if (!ctx
->Extensions
.ARB_depth_texture
)
991 *params
= _mesa_get_format_bits(texFormat
, pname
);
993 case GL_TEXTURE_STENCIL_SIZE_EXT
:
994 if (!ctx
->Extensions
.EXT_packed_depth_stencil
&&
995 !ctx
->Extensions
.ARB_framebuffer_object
)
997 *params
= _mesa_get_format_bits(texFormat
, pname
);
999 case GL_TEXTURE_SHARED_SIZE
:
1000 if (ctx
->VersionMajor
< 3 &&
1001 !ctx
->Extensions
.EXT_texture_shared_exponent
)
1003 *params
= texFormat
== MESA_FORMAT_RGB9_E5_FLOAT
? 5 : 0;
1006 /* GL_ARB_texture_compression */
1007 case GL_TEXTURE_COMPRESSED_IMAGE_SIZE
:
1008 if (_mesa_is_format_compressed(texFormat
) &&
1009 !_mesa_is_proxy_texture(target
)) {
1010 *params
= _mesa_format_image_size(texFormat
, img
->Width
,
1011 img
->Height
, img
->Depth
);
1014 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1015 "glGetTexLevelParameter[if]v(pname)");
1018 case GL_TEXTURE_COMPRESSED
:
1019 *params
= (GLint
) _mesa_is_format_compressed(texFormat
);
1022 /* GL_ARB_texture_float */
1023 case GL_TEXTURE_RED_TYPE_ARB
:
1024 if (!ctx
->Extensions
.ARB_texture_float
)
1026 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
) ?
1027 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1029 case GL_TEXTURE_GREEN_TYPE_ARB
:
1030 if (!ctx
->Extensions
.ARB_texture_float
)
1032 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
) ?
1033 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1035 case GL_TEXTURE_BLUE_TYPE_ARB
:
1036 if (!ctx
->Extensions
.ARB_texture_float
)
1038 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_BLUE_SIZE
) ?
1039 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1041 case GL_TEXTURE_ALPHA_TYPE_ARB
:
1042 if (!ctx
->Extensions
.ARB_texture_float
)
1044 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_ALPHA_SIZE
) ?
1045 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1047 case GL_TEXTURE_LUMINANCE_TYPE_ARB
:
1048 if (!ctx
->Extensions
.ARB_texture_float
)
1050 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_LUMINANCE_SIZE
) ?
1051 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1053 case GL_TEXTURE_INTENSITY_TYPE_ARB
:
1054 if (!ctx
->Extensions
.ARB_texture_float
)
1056 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_INTENSITY_SIZE
) ?
1057 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1059 case GL_TEXTURE_DEPTH_TYPE_ARB
:
1060 if (!ctx
->Extensions
.ARB_texture_float
)
1062 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_DEPTH_SIZE
) ?
1063 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1070 /* no error if we get here */
1074 _mesa_error(ctx
, GL_INVALID_ENUM
,
1075 "glGetTexLevelParameter[if]v(pname=%s)",
1076 _mesa_lookup_enum_by_nr(pname
));
1082 _mesa_GetTexParameterfv( GLenum target
, GLenum pname
, GLfloat
*params
)
1084 struct gl_texture_object
*obj
;
1085 GET_CURRENT_CONTEXT(ctx
);
1086 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1088 obj
= get_texobj(ctx
, target
, GL_TRUE
);
1092 _mesa_lock_texture(ctx
, obj
);
1094 case GL_TEXTURE_MAG_FILTER
:
1095 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MagFilter
);
1097 case GL_TEXTURE_MIN_FILTER
:
1098 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MinFilter
);
1100 case GL_TEXTURE_WRAP_S
:
1101 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapS
);
1103 case GL_TEXTURE_WRAP_T
:
1104 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapT
);
1106 case GL_TEXTURE_WRAP_R
:
1107 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapR
);
1109 case GL_TEXTURE_BORDER_COLOR
:
1110 if (ctx
->NewState
& (_NEW_BUFFERS
| _NEW_FRAG_CLAMP
))
1111 _mesa_update_state_locked(ctx
);
1112 if (ctx
->Color
._ClampFragmentColor
) {
1113 params
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
1114 params
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
1115 params
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
1116 params
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
1119 params
[0] = obj
->Sampler
.BorderColor
.f
[0];
1120 params
[1] = obj
->Sampler
.BorderColor
.f
[1];
1121 params
[2] = obj
->Sampler
.BorderColor
.f
[2];
1122 params
[3] = obj
->Sampler
.BorderColor
.f
[3];
1125 case GL_TEXTURE_RESIDENT
:
1126 *params
= ctx
->Driver
.IsTextureResident
?
1127 ctx
->Driver
.IsTextureResident(ctx
, obj
) : 1.0F
;
1129 case GL_TEXTURE_PRIORITY
:
1130 *params
= obj
->Priority
;
1132 case GL_TEXTURE_MIN_LOD
:
1133 *params
= obj
->Sampler
.MinLod
;
1135 case GL_TEXTURE_MAX_LOD
:
1136 *params
= obj
->Sampler
.MaxLod
;
1138 case GL_TEXTURE_BASE_LEVEL
:
1139 *params
= (GLfloat
) obj
->BaseLevel
;
1141 case GL_TEXTURE_MAX_LEVEL
:
1142 *params
= (GLfloat
) obj
->MaxLevel
;
1144 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1145 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
1147 *params
= obj
->Sampler
.MaxAnisotropy
;
1149 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
1150 if (!ctx
->Extensions
.ARB_shadow_ambient
)
1152 *params
= obj
->Sampler
.CompareFailValue
;
1154 case GL_GENERATE_MIPMAP_SGIS
:
1155 *params
= (GLfloat
) obj
->GenerateMipmap
;
1157 case GL_TEXTURE_COMPARE_MODE_ARB
:
1158 if (!ctx
->Extensions
.ARB_shadow
)
1160 *params
= (GLfloat
) obj
->Sampler
.CompareMode
;
1162 case GL_TEXTURE_COMPARE_FUNC_ARB
:
1163 if (!ctx
->Extensions
.ARB_shadow
)
1165 *params
= (GLfloat
) obj
->Sampler
.CompareFunc
;
1167 case GL_DEPTH_TEXTURE_MODE_ARB
:
1168 if (!ctx
->Extensions
.ARB_depth_texture
)
1170 *params
= (GLfloat
) obj
->Sampler
.DepthMode
;
1172 case GL_TEXTURE_LOD_BIAS
:
1173 if (!ctx
->Extensions
.EXT_texture_lod_bias
)
1175 *params
= obj
->Sampler
.LodBias
;
1177 #if FEATURE_OES_draw_texture
1178 case GL_TEXTURE_CROP_RECT_OES
:
1179 params
[0] = obj
->CropRect
[0];
1180 params
[1] = obj
->CropRect
[1];
1181 params
[2] = obj
->CropRect
[2];
1182 params
[3] = obj
->CropRect
[3];
1186 case GL_TEXTURE_SWIZZLE_R_EXT
:
1187 case GL_TEXTURE_SWIZZLE_G_EXT
:
1188 case GL_TEXTURE_SWIZZLE_B_EXT
:
1189 case GL_TEXTURE_SWIZZLE_A_EXT
:
1190 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1192 *params
= (GLfloat
) obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
1195 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
1196 if (!ctx
->Extensions
.EXT_texture_swizzle
) {
1201 for (comp
= 0; comp
< 4; comp
++) {
1202 params
[comp
] = (GLfloat
) obj
->Swizzle
[comp
];
1207 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1208 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1210 *params
= (GLfloat
) obj
->Sampler
.CubeMapSeamless
;
1217 /* no error if we get here */
1218 _mesa_unlock_texture(ctx
, obj
);
1222 _mesa_unlock_texture(ctx
, obj
);
1223 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexParameterfv(pname=0x%x)", pname
);
1228 _mesa_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
1230 struct gl_texture_object
*obj
;
1231 GET_CURRENT_CONTEXT(ctx
);
1232 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1234 obj
= get_texobj(ctx
, target
, GL_TRUE
);
1238 _mesa_lock_texture(ctx
, obj
);
1240 case GL_TEXTURE_MAG_FILTER
:
1241 *params
= (GLint
) obj
->Sampler
.MagFilter
;
1243 case GL_TEXTURE_MIN_FILTER
:
1244 *params
= (GLint
) obj
->Sampler
.MinFilter
;
1246 case GL_TEXTURE_WRAP_S
:
1247 *params
= (GLint
) obj
->Sampler
.WrapS
;
1249 case GL_TEXTURE_WRAP_T
:
1250 *params
= (GLint
) obj
->Sampler
.WrapT
;
1252 case GL_TEXTURE_WRAP_R
:
1253 *params
= (GLint
) obj
->Sampler
.WrapR
;
1255 case GL_TEXTURE_BORDER_COLOR
:
1258 b
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
1259 b
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
1260 b
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
1261 b
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
1262 params
[0] = FLOAT_TO_INT(b
[0]);
1263 params
[1] = FLOAT_TO_INT(b
[1]);
1264 params
[2] = FLOAT_TO_INT(b
[2]);
1265 params
[3] = FLOAT_TO_INT(b
[3]);
1268 case GL_TEXTURE_RESIDENT
:
1269 *params
= ctx
->Driver
.IsTextureResident
?
1270 ctx
->Driver
.IsTextureResident(ctx
, obj
) : 1;
1272 case GL_TEXTURE_PRIORITY
:
1273 *params
= FLOAT_TO_INT(obj
->Priority
);
1275 case GL_TEXTURE_MIN_LOD
:
1276 *params
= (GLint
) obj
->Sampler
.MinLod
;
1278 case GL_TEXTURE_MAX_LOD
:
1279 *params
= (GLint
) obj
->Sampler
.MaxLod
;
1281 case GL_TEXTURE_BASE_LEVEL
:
1282 *params
= obj
->BaseLevel
;
1284 case GL_TEXTURE_MAX_LEVEL
:
1285 *params
= obj
->MaxLevel
;
1287 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1288 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
1290 *params
= (GLint
) obj
->Sampler
.MaxAnisotropy
;
1292 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
1293 if (!ctx
->Extensions
.ARB_shadow_ambient
)
1295 *params
= (GLint
) FLOAT_TO_INT(obj
->Sampler
.CompareFailValue
);
1297 case GL_GENERATE_MIPMAP_SGIS
:
1298 *params
= (GLint
) obj
->GenerateMipmap
;
1300 case GL_TEXTURE_COMPARE_MODE_ARB
:
1301 if (!ctx
->Extensions
.ARB_shadow
)
1303 *params
= (GLint
) obj
->Sampler
.CompareMode
;
1305 case GL_TEXTURE_COMPARE_FUNC_ARB
:
1306 if (!ctx
->Extensions
.ARB_shadow
)
1308 *params
= (GLint
) obj
->Sampler
.CompareFunc
;
1310 case GL_DEPTH_TEXTURE_MODE_ARB
:
1311 if (!ctx
->Extensions
.ARB_depth_texture
)
1313 *params
= (GLint
) obj
->Sampler
.DepthMode
;
1315 case GL_TEXTURE_LOD_BIAS
:
1316 if (!ctx
->Extensions
.EXT_texture_lod_bias
)
1318 *params
= (GLint
) obj
->Sampler
.LodBias
;
1320 #if FEATURE_OES_draw_texture
1321 case GL_TEXTURE_CROP_RECT_OES
:
1322 params
[0] = obj
->CropRect
[0];
1323 params
[1] = obj
->CropRect
[1];
1324 params
[2] = obj
->CropRect
[2];
1325 params
[3] = obj
->CropRect
[3];
1328 case GL_TEXTURE_SWIZZLE_R_EXT
:
1329 case GL_TEXTURE_SWIZZLE_G_EXT
:
1330 case GL_TEXTURE_SWIZZLE_B_EXT
:
1331 case GL_TEXTURE_SWIZZLE_A_EXT
:
1332 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1334 *params
= obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
1337 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
1338 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1340 COPY_4V(params
, obj
->Swizzle
);
1343 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1344 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1346 *params
= (GLint
) obj
->Sampler
.CubeMapSeamless
;
1353 /* no error if we get here */
1354 _mesa_unlock_texture(ctx
, obj
);
1358 _mesa_unlock_texture(ctx
, obj
);
1359 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexParameteriv(pname=0x%x)", pname
);
1363 /** New in GL 3.0 */
1365 _mesa_GetTexParameterIiv(GLenum target
, GLenum pname
, GLint
*params
)
1367 struct gl_texture_object
*texObj
;
1368 GET_CURRENT_CONTEXT(ctx
);
1369 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1371 texObj
= get_texobj(ctx
, target
, GL_TRUE
);
1376 case GL_TEXTURE_BORDER_COLOR
:
1377 COPY_4V(params
, texObj
->Sampler
.BorderColor
.i
);
1380 _mesa_GetTexParameteriv(target
, pname
, params
);
1385 /** New in GL 3.0 */
1387 _mesa_GetTexParameterIuiv(GLenum target
, GLenum pname
, GLuint
*params
)
1389 struct gl_texture_object
*texObj
;
1390 GET_CURRENT_CONTEXT(ctx
);
1391 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1393 texObj
= get_texobj(ctx
, target
, GL_TRUE
);
1398 case GL_TEXTURE_BORDER_COLOR
:
1399 COPY_4V(params
, texObj
->Sampler
.BorderColor
.i
);
1404 _mesa_GetTexParameteriv(target
, pname
, ip
);
1406 if (pname
== GL_TEXTURE_SWIZZLE_RGBA_EXT
||
1407 pname
== GL_TEXTURE_CROP_RECT_OES
) {