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 "main/texfetch.h"
47 #include "program/prog_instruction.h"
51 * Check if a coordinate wrap mode is supported for the texture target.
52 * \return GL_TRUE if legal, GL_FALSE otherwise
55 validate_texture_wrap_mode(struct gl_context
* ctx
, GLenum target
, GLenum wrap
)
57 const struct gl_extensions
* const e
= & ctx
->Extensions
;
59 if (wrap
== GL_CLAMP
|| wrap
== GL_CLAMP_TO_EDGE
||
60 (wrap
== GL_CLAMP_TO_BORDER
&& e
->ARB_texture_border_clamp
)) {
61 /* any texture target */
64 else if (target
!= GL_TEXTURE_RECTANGLE_NV
&&
66 (wrap
== GL_MIRRORED_REPEAT
&&
67 e
->ARB_texture_mirrored_repeat
) ||
68 (wrap
== GL_MIRROR_CLAMP_EXT
&&
69 (e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
)) ||
70 (wrap
== GL_MIRROR_CLAMP_TO_EDGE_EXT
&&
71 (e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
)) ||
72 (wrap
== GL_MIRROR_CLAMP_TO_BORDER_EXT
&&
73 (e
->EXT_texture_mirror_clamp
)))) {
74 /* non-rectangle texture */
78 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexParameter(param=0x%x)", wrap
);
84 * Get current texture object for given target.
85 * Return NULL if any error (and record the error).
86 * Note that this is different from _mesa_select_tex_object() in that proxy
87 * targets are not accepted.
88 * Only the glGetTexLevelParameter() functions accept proxy targets.
90 static struct gl_texture_object
*
91 get_texobj(struct gl_context
*ctx
, GLenum target
, GLboolean get
)
93 struct gl_texture_unit
*texUnit
;
95 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
96 _mesa_error(ctx
, GL_INVALID_OPERATION
,
97 "gl%sTexParameter(current unit)", get
? "Get" : "");
101 texUnit
= _mesa_get_current_tex_unit(ctx
);
105 return texUnit
->CurrentTex
[TEXTURE_1D_INDEX
];
107 return texUnit
->CurrentTex
[TEXTURE_2D_INDEX
];
109 return texUnit
->CurrentTex
[TEXTURE_3D_INDEX
];
110 case GL_TEXTURE_CUBE_MAP
:
111 if (ctx
->Extensions
.ARB_texture_cube_map
) {
112 return texUnit
->CurrentTex
[TEXTURE_CUBE_INDEX
];
115 case GL_TEXTURE_RECTANGLE_NV
:
116 if (ctx
->Extensions
.NV_texture_rectangle
) {
117 return texUnit
->CurrentTex
[TEXTURE_RECT_INDEX
];
120 case GL_TEXTURE_1D_ARRAY_EXT
:
121 if (ctx
->Extensions
.MESA_texture_array
||
122 ctx
->Extensions
.EXT_texture_array
) {
123 return texUnit
->CurrentTex
[TEXTURE_1D_ARRAY_INDEX
];
126 case GL_TEXTURE_2D_ARRAY_EXT
:
127 if (ctx
->Extensions
.MESA_texture_array
||
128 ctx
->Extensions
.EXT_texture_array
) {
129 return texUnit
->CurrentTex
[TEXTURE_2D_ARRAY_INDEX
];
136 _mesa_error(ctx
, GL_INVALID_ENUM
,
137 "gl%sTexParameter(target)", get
? "Get" : "");
143 * Convert GL_RED/GREEN/BLUE/ALPHA/ZERO/ONE to SWIZZLE_X/Y/Z/W/ZERO/ONE.
144 * \return -1 if error.
147 comp_to_swizzle(GLenum comp
)
169 set_swizzle_component(GLuint
*swizzle
, GLuint comp
, GLuint swz
)
172 ASSERT(swz
<= SWIZZLE_NIL
);
174 GLuint mask
= 0x7 << (3 * comp
);
175 GLuint s
= (*swizzle
& ~mask
) | (swz
<< (3 * comp
));
182 * This is called just prior to changing any texture object state which
183 * will not effect texture completeness.
186 flush(struct gl_context
*ctx
)
188 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
193 * This is called just prior to changing any texture object state which
194 * can effect texture completeness (texture base level, max level,
195 * minification filter).
196 * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
197 * state flag and then mark the texture object as 'incomplete' so that any
198 * per-texture derived state gets recomputed.
201 incomplete(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
203 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
204 texObj
->_Complete
= GL_FALSE
;
209 * Set an integer-valued texture parameter
210 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
213 set_tex_parameteri(struct gl_context
*ctx
,
214 struct gl_texture_object
*texObj
,
215 GLenum pname
, const GLint
*params
)
218 case GL_TEXTURE_MIN_FILTER
:
219 if (texObj
->Sampler
.MinFilter
== params
[0])
224 incomplete(ctx
, texObj
);
225 texObj
->Sampler
.MinFilter
= params
[0];
227 case GL_NEAREST_MIPMAP_NEAREST
:
228 case GL_LINEAR_MIPMAP_NEAREST
:
229 case GL_NEAREST_MIPMAP_LINEAR
:
230 case GL_LINEAR_MIPMAP_LINEAR
:
231 if (texObj
->Target
!= GL_TEXTURE_RECTANGLE_NV
) {
232 incomplete(ctx
, texObj
);
233 texObj
->Sampler
.MinFilter
= params
[0];
242 case GL_TEXTURE_MAG_FILTER
:
243 if (texObj
->Sampler
.MagFilter
== params
[0])
248 flush(ctx
); /* does not effect completeness */
249 texObj
->Sampler
.MagFilter
= params
[0];
256 case GL_TEXTURE_WRAP_S
:
257 if (texObj
->Sampler
.WrapS
== params
[0])
259 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
261 texObj
->Sampler
.WrapS
= params
[0];
266 case GL_TEXTURE_WRAP_T
:
267 if (texObj
->Sampler
.WrapT
== params
[0])
269 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
271 texObj
->Sampler
.WrapT
= params
[0];
276 case GL_TEXTURE_WRAP_R
:
277 if (texObj
->Sampler
.WrapR
== params
[0])
279 if (validate_texture_wrap_mode(ctx
, texObj
->Target
, params
[0])) {
281 texObj
->Sampler
.WrapR
= params
[0];
286 case GL_TEXTURE_BASE_LEVEL
:
287 if (texObj
->BaseLevel
== params
[0])
290 (texObj
->Target
== GL_TEXTURE_RECTANGLE_ARB
&& params
[0] != 0)) {
291 _mesa_error(ctx
, GL_INVALID_VALUE
,
292 "glTexParameter(param=%d)", params
[0]);
295 incomplete(ctx
, texObj
);
296 texObj
->BaseLevel
= params
[0];
299 case GL_TEXTURE_MAX_LEVEL
:
300 if (texObj
->MaxLevel
== params
[0])
302 if (params
[0] < 0 || texObj
->Target
== GL_TEXTURE_RECTANGLE_ARB
) {
303 _mesa_error(ctx
, GL_INVALID_OPERATION
,
304 "glTexParameter(param=%d)", params
[0]);
307 incomplete(ctx
, texObj
);
308 texObj
->MaxLevel
= params
[0];
311 case GL_GENERATE_MIPMAP_SGIS
:
312 if (texObj
->GenerateMipmap
!= params
[0]) {
314 texObj
->GenerateMipmap
= params
[0] ? GL_TRUE
: GL_FALSE
;
319 case GL_TEXTURE_COMPARE_MODE_ARB
:
320 if (ctx
->Extensions
.ARB_shadow
) {
321 if (texObj
->Sampler
.CompareMode
== params
[0])
323 if (params
[0] == GL_NONE
||
324 params
[0] == GL_COMPARE_R_TO_TEXTURE_ARB
) {
326 texObj
->Sampler
.CompareMode
= params
[0];
333 case GL_TEXTURE_COMPARE_FUNC_ARB
:
334 if (ctx
->Extensions
.ARB_shadow
) {
335 if (texObj
->Sampler
.CompareFunc
== params
[0])
341 texObj
->Sampler
.CompareFunc
= params
[0];
349 if (ctx
->Extensions
.EXT_shadow_funcs
) {
351 texObj
->Sampler
.CompareFunc
= params
[0];
361 case GL_DEPTH_TEXTURE_MODE_ARB
:
362 if (ctx
->Extensions
.ARB_depth_texture
) {
363 if (texObj
->Sampler
.DepthMode
== params
[0])
365 if (params
[0] == GL_LUMINANCE
||
366 params
[0] == GL_INTENSITY
||
367 params
[0] == GL_ALPHA
||
368 (ctx
->Extensions
.ARB_texture_rg
&& params
[0] == GL_RED
)) {
370 texObj
->Sampler
.DepthMode
= params
[0];
377 #if FEATURE_OES_draw_texture
378 case GL_TEXTURE_CROP_RECT_OES
:
379 texObj
->CropRect
[0] = params
[0];
380 texObj
->CropRect
[1] = params
[1];
381 texObj
->CropRect
[2] = params
[2];
382 texObj
->CropRect
[3] = params
[3];
386 case GL_TEXTURE_SWIZZLE_R_EXT
:
387 case GL_TEXTURE_SWIZZLE_G_EXT
:
388 case GL_TEXTURE_SWIZZLE_B_EXT
:
389 case GL_TEXTURE_SWIZZLE_A_EXT
:
390 if (ctx
->Extensions
.EXT_texture_swizzle
) {
391 const GLuint comp
= pname
- GL_TEXTURE_SWIZZLE_R_EXT
;
392 const GLint swz
= comp_to_swizzle(params
[0]);
394 _mesa_error(ctx
, GL_INVALID_OPERATION
,
395 "glTexParameter(swizzle 0x%x)", params
[0]);
401 texObj
->Swizzle
[comp
] = params
[0];
402 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
408 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
409 if (ctx
->Extensions
.EXT_texture_swizzle
) {
412 for (comp
= 0; comp
< 4; comp
++) {
413 const GLint swz
= comp_to_swizzle(params
[comp
]);
415 texObj
->Swizzle
[comp
] = params
[comp
];
416 set_swizzle_component(&texObj
->_Swizzle
, comp
, swz
);
419 _mesa_error(ctx
, GL_INVALID_OPERATION
,
420 "glTexParameter(swizzle 0x%x)", params
[comp
]);
428 case GL_TEXTURE_SRGB_DECODE_EXT
:
429 if (ctx
->Extensions
.EXT_texture_sRGB_decode
) {
430 GLenum decode
= params
[0];
431 if (decode
== GL_DECODE_EXT
|| decode
== GL_SKIP_DECODE_EXT
) {
432 if (texObj
->Sampler
.sRGBDecode
!= decode
) {
434 texObj
->Sampler
.sRGBDecode
= decode
;
435 _mesa_update_fetch_functions(texObj
);
442 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
443 if (ctx
->Extensions
.AMD_seamless_cubemap_per_texture
) {
444 GLenum param
= params
[0];
445 if (param
!= GL_TRUE
&& param
!= GL_FALSE
) {
448 if (param
!= texObj
->Sampler
.CubeMapSeamless
) {
450 texObj
->Sampler
.CubeMapSeamless
= param
;
461 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(pname=%s)",
462 _mesa_lookup_enum_by_nr(pname
));
466 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(param=%s)",
467 _mesa_lookup_enum_by_nr(params
[0]));
473 * Set a float-valued texture parameter
474 * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
477 set_tex_parameterf(struct gl_context
*ctx
,
478 struct gl_texture_object
*texObj
,
479 GLenum pname
, const GLfloat
*params
)
482 case GL_TEXTURE_MIN_LOD
:
483 if (texObj
->Sampler
.MinLod
== params
[0])
486 texObj
->Sampler
.MinLod
= params
[0];
489 case GL_TEXTURE_MAX_LOD
:
490 if (texObj
->Sampler
.MaxLod
== params
[0])
493 texObj
->Sampler
.MaxLod
= params
[0];
496 case GL_TEXTURE_PRIORITY
:
498 texObj
->Priority
= CLAMP(params
[0], 0.0F
, 1.0F
);
501 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
502 if (ctx
->Extensions
.EXT_texture_filter_anisotropic
) {
503 if (texObj
->Sampler
.MaxAnisotropy
== params
[0])
505 if (params
[0] < 1.0) {
506 _mesa_error(ctx
, GL_INVALID_VALUE
, "glTexParameter(param)" );
510 /* clamp to max, that's what NVIDIA does */
511 texObj
->Sampler
.MaxAnisotropy
= MIN2(params
[0],
512 ctx
->Const
.MaxTextureMaxAnisotropy
);
516 static GLuint count
= 0;
518 _mesa_error(ctx
, GL_INVALID_ENUM
,
519 "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
523 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
524 if (ctx
->Extensions
.ARB_shadow_ambient
) {
525 if (texObj
->Sampler
.CompareFailValue
!= params
[0]) {
527 texObj
->Sampler
.CompareFailValue
= CLAMP(params
[0], 0.0F
, 1.0F
);
532 _mesa_error(ctx
, GL_INVALID_ENUM
,
533 "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)");
537 case GL_TEXTURE_LOD_BIAS
:
538 /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
539 if (ctx
->Extensions
.EXT_texture_lod_bias
) {
540 if (texObj
->Sampler
.LodBias
!= params
[0]) {
542 texObj
->Sampler
.LodBias
= params
[0];
549 case GL_TEXTURE_BORDER_COLOR
:
551 /* ARB_texture_float disables clamping */
552 if (ctx
->Extensions
.ARB_texture_float
) {
553 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = params
[0];
554 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = params
[1];
555 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = params
[2];
556 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = params
[3];
558 texObj
->Sampler
.BorderColor
.f
[RCOMP
] = CLAMP(params
[0], 0.0F
, 1.0F
);
559 texObj
->Sampler
.BorderColor
.f
[GCOMP
] = CLAMP(params
[1], 0.0F
, 1.0F
);
560 texObj
->Sampler
.BorderColor
.f
[BCOMP
] = CLAMP(params
[2], 0.0F
, 1.0F
);
561 texObj
->Sampler
.BorderColor
.f
[ACOMP
] = CLAMP(params
[3], 0.0F
, 1.0F
);
566 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexParameter(pname=0x%x)", pname
);
573 _mesa_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
575 GLboolean need_update
;
576 struct gl_texture_object
*texObj
;
577 GET_CURRENT_CONTEXT(ctx
);
578 ASSERT_OUTSIDE_BEGIN_END(ctx
);
580 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
585 case GL_TEXTURE_MIN_FILTER
:
586 case GL_TEXTURE_MAG_FILTER
:
587 case GL_TEXTURE_WRAP_S
:
588 case GL_TEXTURE_WRAP_T
:
589 case GL_TEXTURE_WRAP_R
:
590 case GL_TEXTURE_BASE_LEVEL
:
591 case GL_TEXTURE_MAX_LEVEL
:
592 case GL_GENERATE_MIPMAP_SGIS
:
593 case GL_TEXTURE_COMPARE_MODE_ARB
:
594 case GL_TEXTURE_COMPARE_FUNC_ARB
:
595 case GL_DEPTH_TEXTURE_MODE_ARB
:
596 case GL_TEXTURE_SRGB_DECODE_EXT
:
597 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
599 /* convert float param to int */
601 p
[0] = (GLint
) param
;
602 p
[1] = p
[2] = p
[3] = 0;
603 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
608 /* this will generate an error if pname is illegal */
611 p
[1] = p
[2] = p
[3] = 0.0F
;
612 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, p
);
616 if (ctx
->Driver
.TexParameter
&& need_update
) {
617 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, ¶m
);
623 _mesa_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
625 GLboolean need_update
;
626 struct gl_texture_object
*texObj
;
627 GET_CURRENT_CONTEXT(ctx
);
628 ASSERT_OUTSIDE_BEGIN_END(ctx
);
630 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
635 case GL_TEXTURE_MIN_FILTER
:
636 case GL_TEXTURE_MAG_FILTER
:
637 case GL_TEXTURE_WRAP_S
:
638 case GL_TEXTURE_WRAP_T
:
639 case GL_TEXTURE_WRAP_R
:
640 case GL_TEXTURE_BASE_LEVEL
:
641 case GL_TEXTURE_MAX_LEVEL
:
642 case GL_GENERATE_MIPMAP_SGIS
:
643 case GL_TEXTURE_COMPARE_MODE_ARB
:
644 case GL_TEXTURE_COMPARE_FUNC_ARB
:
645 case GL_DEPTH_TEXTURE_MODE_ARB
:
646 case GL_TEXTURE_SRGB_DECODE_EXT
:
647 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
649 /* convert float param to int */
651 p
[0] = (GLint
) params
[0];
652 p
[1] = p
[2] = p
[3] = 0;
653 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, p
);
657 #if FEATURE_OES_draw_texture
658 case GL_TEXTURE_CROP_RECT_OES
:
660 /* convert float params to int */
662 iparams
[0] = (GLint
) params
[0];
663 iparams
[1] = (GLint
) params
[1];
664 iparams
[2] = (GLint
) params
[2];
665 iparams
[3] = (GLint
) params
[3];
666 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparams
);
672 /* this will generate an error if pname is illegal */
673 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, params
);
676 if (ctx
->Driver
.TexParameter
&& need_update
) {
677 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, params
);
683 _mesa_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
685 GLboolean need_update
;
686 struct gl_texture_object
*texObj
;
687 GET_CURRENT_CONTEXT(ctx
);
688 ASSERT_OUTSIDE_BEGIN_END(ctx
);
690 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
695 case GL_TEXTURE_MIN_LOD
:
696 case GL_TEXTURE_MAX_LOD
:
697 case GL_TEXTURE_PRIORITY
:
698 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
699 case GL_TEXTURE_LOD_BIAS
:
700 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
703 fparam
[0] = (GLfloat
) param
;
704 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
705 /* convert int param to float */
706 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparam
);
710 /* this will generate an error if pname is illegal */
714 iparam
[1] = iparam
[2] = iparam
[3] = 0;
715 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, iparam
);
719 if (ctx
->Driver
.TexParameter
&& need_update
) {
720 GLfloat fparam
= (GLfloat
) param
;
721 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, &fparam
);
727 _mesa_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
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_BORDER_COLOR
:
741 /* convert int params to float */
743 fparams
[0] = INT_TO_FLOAT(params
[0]);
744 fparams
[1] = INT_TO_FLOAT(params
[1]);
745 fparams
[2] = INT_TO_FLOAT(params
[2]);
746 fparams
[3] = INT_TO_FLOAT(params
[3]);
747 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
);
750 case GL_TEXTURE_MIN_LOD
:
751 case GL_TEXTURE_MAX_LOD
:
752 case GL_TEXTURE_PRIORITY
:
753 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
754 case GL_TEXTURE_LOD_BIAS
:
755 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
757 /* convert int param to float */
759 fparams
[0] = (GLfloat
) params
[0];
760 fparams
[1] = fparams
[2] = fparams
[3] = 0.0F
;
761 need_update
= set_tex_parameterf(ctx
, texObj
, pname
, fparams
);
765 /* this will generate an error if pname is illegal */
766 need_update
= set_tex_parameteri(ctx
, texObj
, pname
, params
);
769 if (ctx
->Driver
.TexParameter
&& need_update
) {
771 fparams
[0] = INT_TO_FLOAT(params
[0]);
772 if (pname
== GL_TEXTURE_BORDER_COLOR
||
773 pname
== GL_TEXTURE_CROP_RECT_OES
) {
774 fparams
[1] = INT_TO_FLOAT(params
[1]);
775 fparams
[2] = INT_TO_FLOAT(params
[2]);
776 fparams
[3] = INT_TO_FLOAT(params
[3]);
778 ctx
->Driver
.TexParameter(ctx
, target
, texObj
, pname
, fparams
);
784 * Set tex parameter to integer value(s). Primarily intended to set
785 * integer-valued texture border color (for integer-valued textures).
789 _mesa_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
791 struct gl_texture_object
*texObj
;
792 GET_CURRENT_CONTEXT(ctx
);
793 ASSERT_OUTSIDE_BEGIN_END(ctx
);
795 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
800 case GL_TEXTURE_BORDER_COLOR
:
801 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
802 /* set the integer-valued border color */
803 COPY_4V(texObj
->Sampler
.BorderColor
.i
, params
);
806 _mesa_TexParameteriv(target
, pname
, params
);
809 /* XXX no driver hook for TexParameterIiv() yet */
814 * Set tex parameter to unsigned integer value(s). Primarily intended to set
815 * uint-valued texture border color (for integer-valued textures).
819 _mesa_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
821 struct gl_texture_object
*texObj
;
822 GET_CURRENT_CONTEXT(ctx
);
823 ASSERT_OUTSIDE_BEGIN_END(ctx
);
825 texObj
= get_texobj(ctx
, target
, GL_FALSE
);
830 case GL_TEXTURE_BORDER_COLOR
:
831 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
832 /* set the unsigned integer-valued border color */
833 COPY_4V(texObj
->Sampler
.BorderColor
.ui
, params
);
836 _mesa_TexParameteriv(target
, pname
, (const GLint
*) params
);
839 /* XXX no driver hook for TexParameterIuiv() yet */
846 _mesa_GetTexLevelParameterfv( GLenum target
, GLint level
,
847 GLenum pname
, GLfloat
*params
)
850 _mesa_GetTexLevelParameteriv( target
, level
, pname
, &iparam
);
851 *params
= (GLfloat
) iparam
;
856 _mesa_GetTexLevelParameteriv( GLenum target
, GLint level
,
857 GLenum pname
, GLint
*params
)
859 const struct gl_texture_unit
*texUnit
;
860 struct gl_texture_object
*texObj
;
861 const struct gl_texture_image
*img
= NULL
;
864 GET_CURRENT_CONTEXT(ctx
);
865 ASSERT_OUTSIDE_BEGIN_END(ctx
);
867 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
868 _mesa_error(ctx
, GL_INVALID_OPERATION
,
869 "glGetTexLevelParameteriv(current unit)");
873 texUnit
= _mesa_get_current_tex_unit(ctx
);
875 /* this will catch bad target values */
876 maxLevels
= _mesa_max_texture_levels(ctx
, target
);
877 if (maxLevels
== 0) {
878 _mesa_error(ctx
, GL_INVALID_ENUM
,
879 "glGetTexLevelParameter[if]v(target=0x%x)", target
);
883 if (level
< 0 || level
>= maxLevels
) {
884 _mesa_error( ctx
, GL_INVALID_VALUE
, "glGetTexLevelParameter[if]v" );
888 texObj
= _mesa_select_tex_object(ctx
, texUnit
, target
);
890 img
= _mesa_select_tex_image(ctx
, texObj
, target
, level
);
891 if (!img
|| img
->TexFormat
== MESA_FORMAT_NONE
) {
892 /* undefined texture image */
893 if (pname
== GL_TEXTURE_COMPONENTS
)
900 texFormat
= img
->TexFormat
;
903 case GL_TEXTURE_WIDTH
:
904 *params
= img
->Width
;
906 case GL_TEXTURE_HEIGHT
:
907 *params
= img
->Height
;
909 case GL_TEXTURE_DEPTH
:
910 *params
= img
->Depth
;
912 case GL_TEXTURE_INTERNAL_FORMAT
:
913 if (_mesa_is_format_compressed(texFormat
)) {
914 /* need to return the actual compressed format */
915 *params
= _mesa_compressed_format_to_glenum(ctx
, texFormat
);
918 /* If the true internal format is not compressed but the user
919 * requested a generic compressed format, we have to return the
920 * generic base format that matches.
922 * From page 119 (page 129 of the PDF) of the OpenGL 1.3 spec:
924 * "If no specific compressed format is available,
925 * internalformat is instead replaced by the corresponding base
928 * Otherwise just return the user's requested internal format
931 _mesa_gl_compressed_format_base_format(img
->InternalFormat
);
933 *params
= (f
!= 0) ? f
: img
->InternalFormat
;
936 case GL_TEXTURE_BORDER
:
937 *params
= img
->Border
;
939 case GL_TEXTURE_RED_SIZE
:
940 if (img
->_BaseFormat
== GL_RED
) {
941 *params
= _mesa_get_format_bits(texFormat
, pname
);
945 case GL_TEXTURE_GREEN_SIZE
:
946 if (img
->_BaseFormat
== GL_RG
) {
947 *params
= _mesa_get_format_bits(texFormat
, pname
);
951 case GL_TEXTURE_BLUE_SIZE
:
952 if (img
->_BaseFormat
== GL_RGB
|| img
->_BaseFormat
== GL_RGBA
)
953 *params
= _mesa_get_format_bits(texFormat
, pname
);
957 case GL_TEXTURE_ALPHA_SIZE
:
958 if (img
->_BaseFormat
== GL_ALPHA
||
959 img
->_BaseFormat
== GL_LUMINANCE_ALPHA
||
960 img
->_BaseFormat
== GL_RGBA
)
961 *params
= _mesa_get_format_bits(texFormat
, pname
);
965 case GL_TEXTURE_INTENSITY_SIZE
:
966 if (img
->_BaseFormat
!= GL_INTENSITY
)
969 *params
= _mesa_get_format_bits(texFormat
, pname
);
971 /* intensity probably stored as rgb texture */
972 *params
= MIN2(_mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
),
973 _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
));
977 case GL_TEXTURE_LUMINANCE_SIZE
:
978 if (img
->_BaseFormat
!= GL_LUMINANCE
&&
979 img
->_BaseFormat
!= GL_LUMINANCE_ALPHA
)
982 *params
= _mesa_get_format_bits(texFormat
, pname
);
984 /* luminance probably stored as rgb texture */
985 *params
= MIN2(_mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
),
986 _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
));
990 case GL_TEXTURE_INDEX_SIZE_EXT
:
991 if (img
->_BaseFormat
== GL_COLOR_INDEX
)
992 *params
= _mesa_get_format_bits(texFormat
, pname
);
996 case GL_TEXTURE_DEPTH_SIZE_ARB
:
997 if (!ctx
->Extensions
.ARB_depth_texture
)
999 *params
= _mesa_get_format_bits(texFormat
, pname
);
1001 case GL_TEXTURE_STENCIL_SIZE_EXT
:
1002 if (!ctx
->Extensions
.EXT_packed_depth_stencil
&&
1003 !ctx
->Extensions
.ARB_framebuffer_object
)
1005 *params
= _mesa_get_format_bits(texFormat
, pname
);
1007 case GL_TEXTURE_SHARED_SIZE
:
1008 if (ctx
->VersionMajor
< 3 &&
1009 !ctx
->Extensions
.EXT_texture_shared_exponent
)
1011 *params
= texFormat
== MESA_FORMAT_RGB9_E5_FLOAT
? 5 : 0;
1014 /* GL_ARB_texture_compression */
1015 case GL_TEXTURE_COMPRESSED_IMAGE_SIZE
:
1016 if (_mesa_is_format_compressed(texFormat
) &&
1017 !_mesa_is_proxy_texture(target
)) {
1018 *params
= _mesa_format_image_size(texFormat
, img
->Width
,
1019 img
->Height
, img
->Depth
);
1022 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1023 "glGetTexLevelParameter[if]v(pname)");
1026 case GL_TEXTURE_COMPRESSED
:
1027 *params
= (GLint
) _mesa_is_format_compressed(texFormat
);
1030 /* GL_ARB_texture_float */
1031 case GL_TEXTURE_RED_TYPE_ARB
:
1032 if (!ctx
->Extensions
.ARB_texture_float
)
1034 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_RED_SIZE
) ?
1035 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1037 case GL_TEXTURE_GREEN_TYPE_ARB
:
1038 if (!ctx
->Extensions
.ARB_texture_float
)
1040 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_GREEN_SIZE
) ?
1041 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1043 case GL_TEXTURE_BLUE_TYPE_ARB
:
1044 if (!ctx
->Extensions
.ARB_texture_float
)
1046 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_BLUE_SIZE
) ?
1047 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1049 case GL_TEXTURE_ALPHA_TYPE_ARB
:
1050 if (!ctx
->Extensions
.ARB_texture_float
)
1052 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_ALPHA_SIZE
) ?
1053 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1055 case GL_TEXTURE_LUMINANCE_TYPE_ARB
:
1056 if (!ctx
->Extensions
.ARB_texture_float
)
1058 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_LUMINANCE_SIZE
) ?
1059 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1061 case GL_TEXTURE_INTENSITY_TYPE_ARB
:
1062 if (!ctx
->Extensions
.ARB_texture_float
)
1064 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_INTENSITY_SIZE
) ?
1065 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1067 case GL_TEXTURE_DEPTH_TYPE_ARB
:
1068 if (!ctx
->Extensions
.ARB_texture_float
)
1070 *params
= _mesa_get_format_bits(texFormat
, GL_TEXTURE_DEPTH_SIZE
) ?
1071 _mesa_get_format_datatype(texFormat
) : GL_NONE
;
1078 /* no error if we get here */
1082 _mesa_error(ctx
, GL_INVALID_ENUM
,
1083 "glGetTexLevelParameter[if]v(pname=%s)",
1084 _mesa_lookup_enum_by_nr(pname
));
1090 _mesa_GetTexParameterfv( GLenum target
, GLenum pname
, GLfloat
*params
)
1092 struct gl_texture_object
*obj
;
1093 GET_CURRENT_CONTEXT(ctx
);
1094 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1096 obj
= get_texobj(ctx
, target
, GL_TRUE
);
1100 _mesa_lock_texture(ctx
, obj
);
1102 case GL_TEXTURE_MAG_FILTER
:
1103 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MagFilter
);
1105 case GL_TEXTURE_MIN_FILTER
:
1106 *params
= ENUM_TO_FLOAT(obj
->Sampler
.MinFilter
);
1108 case GL_TEXTURE_WRAP_S
:
1109 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapS
);
1111 case GL_TEXTURE_WRAP_T
:
1112 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapT
);
1114 case GL_TEXTURE_WRAP_R
:
1115 *params
= ENUM_TO_FLOAT(obj
->Sampler
.WrapR
);
1117 case GL_TEXTURE_BORDER_COLOR
:
1118 if (ctx
->NewState
& (_NEW_BUFFERS
| _NEW_FRAG_CLAMP
))
1119 _mesa_update_state_locked(ctx
);
1120 if (ctx
->Color
._ClampFragmentColor
) {
1121 params
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
1122 params
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
1123 params
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
1124 params
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
1127 params
[0] = obj
->Sampler
.BorderColor
.f
[0];
1128 params
[1] = obj
->Sampler
.BorderColor
.f
[1];
1129 params
[2] = obj
->Sampler
.BorderColor
.f
[2];
1130 params
[3] = obj
->Sampler
.BorderColor
.f
[3];
1133 case GL_TEXTURE_RESIDENT
:
1134 *params
= ctx
->Driver
.IsTextureResident
?
1135 ctx
->Driver
.IsTextureResident(ctx
, obj
) : 1.0F
;
1137 case GL_TEXTURE_PRIORITY
:
1138 *params
= obj
->Priority
;
1140 case GL_TEXTURE_MIN_LOD
:
1141 *params
= obj
->Sampler
.MinLod
;
1143 case GL_TEXTURE_MAX_LOD
:
1144 *params
= obj
->Sampler
.MaxLod
;
1146 case GL_TEXTURE_BASE_LEVEL
:
1147 *params
= (GLfloat
) obj
->BaseLevel
;
1149 case GL_TEXTURE_MAX_LEVEL
:
1150 *params
= (GLfloat
) obj
->MaxLevel
;
1152 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1153 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
1155 *params
= obj
->Sampler
.MaxAnisotropy
;
1157 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
1158 if (!ctx
->Extensions
.ARB_shadow_ambient
)
1160 *params
= obj
->Sampler
.CompareFailValue
;
1162 case GL_GENERATE_MIPMAP_SGIS
:
1163 *params
= (GLfloat
) obj
->GenerateMipmap
;
1165 case GL_TEXTURE_COMPARE_MODE_ARB
:
1166 if (!ctx
->Extensions
.ARB_shadow
)
1168 *params
= (GLfloat
) obj
->Sampler
.CompareMode
;
1170 case GL_TEXTURE_COMPARE_FUNC_ARB
:
1171 if (!ctx
->Extensions
.ARB_shadow
)
1173 *params
= (GLfloat
) obj
->Sampler
.CompareFunc
;
1175 case GL_DEPTH_TEXTURE_MODE_ARB
:
1176 if (!ctx
->Extensions
.ARB_depth_texture
)
1178 *params
= (GLfloat
) obj
->Sampler
.DepthMode
;
1180 case GL_TEXTURE_LOD_BIAS
:
1181 if (!ctx
->Extensions
.EXT_texture_lod_bias
)
1183 *params
= obj
->Sampler
.LodBias
;
1185 #if FEATURE_OES_draw_texture
1186 case GL_TEXTURE_CROP_RECT_OES
:
1187 params
[0] = obj
->CropRect
[0];
1188 params
[1] = obj
->CropRect
[1];
1189 params
[2] = obj
->CropRect
[2];
1190 params
[3] = obj
->CropRect
[3];
1194 case GL_TEXTURE_SWIZZLE_R_EXT
:
1195 case GL_TEXTURE_SWIZZLE_G_EXT
:
1196 case GL_TEXTURE_SWIZZLE_B_EXT
:
1197 case GL_TEXTURE_SWIZZLE_A_EXT
:
1198 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1200 *params
= (GLfloat
) obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
1203 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
1204 if (!ctx
->Extensions
.EXT_texture_swizzle
) {
1209 for (comp
= 0; comp
< 4; comp
++) {
1210 params
[comp
] = (GLfloat
) obj
->Swizzle
[comp
];
1215 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1216 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1218 *params
= (GLfloat
) obj
->Sampler
.CubeMapSeamless
;
1225 /* no error if we get here */
1226 _mesa_unlock_texture(ctx
, obj
);
1230 _mesa_unlock_texture(ctx
, obj
);
1231 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexParameterfv(pname=0x%x)", pname
);
1236 _mesa_GetTexParameteriv( GLenum target
, GLenum pname
, GLint
*params
)
1238 struct gl_texture_object
*obj
;
1239 GET_CURRENT_CONTEXT(ctx
);
1240 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1242 obj
= get_texobj(ctx
, target
, GL_TRUE
);
1246 _mesa_lock_texture(ctx
, obj
);
1248 case GL_TEXTURE_MAG_FILTER
:
1249 *params
= (GLint
) obj
->Sampler
.MagFilter
;
1251 case GL_TEXTURE_MIN_FILTER
:
1252 *params
= (GLint
) obj
->Sampler
.MinFilter
;
1254 case GL_TEXTURE_WRAP_S
:
1255 *params
= (GLint
) obj
->Sampler
.WrapS
;
1257 case GL_TEXTURE_WRAP_T
:
1258 *params
= (GLint
) obj
->Sampler
.WrapT
;
1260 case GL_TEXTURE_WRAP_R
:
1261 *params
= (GLint
) obj
->Sampler
.WrapR
;
1263 case GL_TEXTURE_BORDER_COLOR
:
1266 b
[0] = CLAMP(obj
->Sampler
.BorderColor
.f
[0], 0.0F
, 1.0F
);
1267 b
[1] = CLAMP(obj
->Sampler
.BorderColor
.f
[1], 0.0F
, 1.0F
);
1268 b
[2] = CLAMP(obj
->Sampler
.BorderColor
.f
[2], 0.0F
, 1.0F
);
1269 b
[3] = CLAMP(obj
->Sampler
.BorderColor
.f
[3], 0.0F
, 1.0F
);
1270 params
[0] = FLOAT_TO_INT(b
[0]);
1271 params
[1] = FLOAT_TO_INT(b
[1]);
1272 params
[2] = FLOAT_TO_INT(b
[2]);
1273 params
[3] = FLOAT_TO_INT(b
[3]);
1276 case GL_TEXTURE_RESIDENT
:
1277 *params
= ctx
->Driver
.IsTextureResident
?
1278 ctx
->Driver
.IsTextureResident(ctx
, obj
) : 1;
1280 case GL_TEXTURE_PRIORITY
:
1281 *params
= FLOAT_TO_INT(obj
->Priority
);
1283 case GL_TEXTURE_MIN_LOD
:
1284 *params
= (GLint
) obj
->Sampler
.MinLod
;
1286 case GL_TEXTURE_MAX_LOD
:
1287 *params
= (GLint
) obj
->Sampler
.MaxLod
;
1289 case GL_TEXTURE_BASE_LEVEL
:
1290 *params
= obj
->BaseLevel
;
1292 case GL_TEXTURE_MAX_LEVEL
:
1293 *params
= obj
->MaxLevel
;
1295 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1296 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
1298 *params
= (GLint
) obj
->Sampler
.MaxAnisotropy
;
1300 case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB
:
1301 if (!ctx
->Extensions
.ARB_shadow_ambient
)
1303 *params
= (GLint
) FLOAT_TO_INT(obj
->Sampler
.CompareFailValue
);
1305 case GL_GENERATE_MIPMAP_SGIS
:
1306 *params
= (GLint
) obj
->GenerateMipmap
;
1308 case GL_TEXTURE_COMPARE_MODE_ARB
:
1309 if (!ctx
->Extensions
.ARB_shadow
)
1311 *params
= (GLint
) obj
->Sampler
.CompareMode
;
1313 case GL_TEXTURE_COMPARE_FUNC_ARB
:
1314 if (!ctx
->Extensions
.ARB_shadow
)
1316 *params
= (GLint
) obj
->Sampler
.CompareFunc
;
1318 case GL_DEPTH_TEXTURE_MODE_ARB
:
1319 if (!ctx
->Extensions
.ARB_depth_texture
)
1321 *params
= (GLint
) obj
->Sampler
.DepthMode
;
1323 case GL_TEXTURE_LOD_BIAS
:
1324 if (!ctx
->Extensions
.EXT_texture_lod_bias
)
1326 *params
= (GLint
) obj
->Sampler
.LodBias
;
1328 #if FEATURE_OES_draw_texture
1329 case GL_TEXTURE_CROP_RECT_OES
:
1330 params
[0] = obj
->CropRect
[0];
1331 params
[1] = obj
->CropRect
[1];
1332 params
[2] = obj
->CropRect
[2];
1333 params
[3] = obj
->CropRect
[3];
1336 case GL_TEXTURE_SWIZZLE_R_EXT
:
1337 case GL_TEXTURE_SWIZZLE_G_EXT
:
1338 case GL_TEXTURE_SWIZZLE_B_EXT
:
1339 case GL_TEXTURE_SWIZZLE_A_EXT
:
1340 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1342 *params
= obj
->Swizzle
[pname
- GL_TEXTURE_SWIZZLE_R_EXT
];
1345 case GL_TEXTURE_SWIZZLE_RGBA_EXT
:
1346 if (!ctx
->Extensions
.EXT_texture_swizzle
)
1348 COPY_4V(params
, obj
->Swizzle
);
1351 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1352 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1354 *params
= (GLint
) obj
->Sampler
.CubeMapSeamless
;
1361 /* no error if we get here */
1362 _mesa_unlock_texture(ctx
, obj
);
1366 _mesa_unlock_texture(ctx
, obj
);
1367 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexParameteriv(pname=0x%x)", pname
);
1371 /** New in GL 3.0 */
1373 _mesa_GetTexParameterIiv(GLenum target
, GLenum pname
, GLint
*params
)
1375 struct gl_texture_object
*texObj
;
1376 GET_CURRENT_CONTEXT(ctx
);
1377 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1379 texObj
= get_texobj(ctx
, target
, GL_TRUE
);
1384 case GL_TEXTURE_BORDER_COLOR
:
1385 COPY_4V(params
, texObj
->Sampler
.BorderColor
.i
);
1388 _mesa_GetTexParameteriv(target
, pname
, params
);
1393 /** New in GL 3.0 */
1395 _mesa_GetTexParameterIuiv(GLenum target
, GLenum pname
, GLuint
*params
)
1397 struct gl_texture_object
*texObj
;
1398 GET_CURRENT_CONTEXT(ctx
);
1399 ASSERT_OUTSIDE_BEGIN_END(ctx
);
1401 texObj
= get_texobj(ctx
, target
, GL_TRUE
);
1406 case GL_TEXTURE_BORDER_COLOR
:
1407 COPY_4V(params
, texObj
->Sampler
.BorderColor
.i
);
1412 _mesa_GetTexParameteriv(target
, pname
, ip
);
1414 if (pname
== GL_TEXTURE_SWIZZLE_RGBA_EXT
||
1415 pname
== GL_TEXTURE_CROP_RECT_OES
) {