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 * glTexEnv-related functions
33 #include "main/glheader.h"
34 #include "main/context.h"
35 #include "main/enums.h"
36 #include "main/macros.h"
37 #include "main/texenv.h"
40 #define TE_ERROR(errCode, msg, value) \
41 _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value));
44 /** Set texture env mode */
46 set_env_mode(GLcontext
*ctx
,
47 struct gl_texture_unit
*texUnit
,
52 if (texUnit
->EnvMode
== mode
)
63 mode
= GL_REPLACE
; /* GL_REPLACE_EXT != GL_REPLACE */
67 legal
= ctx
->Extensions
.EXT_texture_env_add
;
70 legal
= (ctx
->Extensions
.EXT_texture_env_combine
||
71 ctx
->Extensions
.ARB_texture_env_combine
);
74 legal
= ctx
->Extensions
.NV_texture_env_combine4
;
81 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
82 texUnit
->EnvMode
= mode
;
85 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", mode
);
91 set_env_color(GLcontext
*ctx
,
92 struct gl_texture_unit
*texUnit
,
96 tmp
[0] = CLAMP(color
[0], 0.0F
, 1.0F
);
97 tmp
[1] = CLAMP(color
[1], 0.0F
, 1.0F
);
98 tmp
[2] = CLAMP(color
[2], 0.0F
, 1.0F
);
99 tmp
[3] = CLAMP(color
[3], 0.0F
, 1.0F
);
100 if (TEST_EQ_4V(tmp
, texUnit
->EnvColor
))
102 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
103 COPY_4FV(texUnit
->EnvColor
, tmp
);
107 /** Set an RGB or A combiner mode/function */
109 set_combiner_mode(GLcontext
*ctx
,
110 struct gl_texture_unit
*texUnit
,
111 GLenum pname
, GLenum mode
)
115 if (!ctx
->Extensions
.EXT_texture_env_combine
&&
116 !ctx
->Extensions
.ARB_texture_env_combine
) {
117 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)");
130 legal
= ctx
->Extensions
.ARB_texture_env_combine
;
132 case GL_DOT3_RGB_EXT
:
133 case GL_DOT3_RGBA_EXT
:
134 legal
= (ctx
->Extensions
.EXT_texture_env_dot3
&&
135 pname
== GL_COMBINE_RGB
);
139 legal
= (ctx
->Extensions
.ARB_texture_env_dot3
&&
140 pname
== GL_COMBINE_RGB
);
142 case GL_MODULATE_ADD_ATI
:
143 case GL_MODULATE_SIGNED_ADD_ATI
:
144 case GL_MODULATE_SUBTRACT_ATI
:
145 legal
=ctx
->Extensions
.ATI_texture_env_combine3
;
152 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", mode
);
158 if (texUnit
->Combine
.ModeRGB
== mode
)
160 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
161 texUnit
->Combine
.ModeRGB
= mode
;
164 case GL_COMBINE_ALPHA
:
165 if (texUnit
->Combine
.ModeA
== mode
)
167 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
168 texUnit
->Combine
.ModeA
= mode
;
171 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
177 /** Set an RGB or A combiner source term */
179 set_combiner_source(GLcontext
*ctx
,
180 struct gl_texture_unit
*texUnit
,
181 GLenum pname
, GLenum param
)
184 GLboolean alpha
, legal
;
186 if (!ctx
->Extensions
.EXT_texture_env_combine
&&
187 !ctx
->Extensions
.ARB_texture_env_combine
) {
188 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)");
193 * Translate pname to (src, alpha).
208 case GL_SOURCE3_RGB_NV
:
209 if (ctx
->Extensions
.NV_texture_env_combine4
) {
214 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
218 case GL_SOURCE0_ALPHA
:
222 case GL_SOURCE1_ALPHA
:
226 case GL_SOURCE2_ALPHA
:
230 case GL_SOURCE3_ALPHA_NV
:
231 if (ctx
->Extensions
.NV_texture_env_combine4
) {
236 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
241 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
248 * Error-check param (the source term)
253 case GL_PRIMARY_COLOR
:
265 legal
= (ctx
->Extensions
.ARB_texture_env_crossbar
&&
266 param
- GL_TEXTURE0
< ctx
->Const
.MaxTextureUnits
);
269 legal
= (ctx
->Extensions
.ATI_texture_env_combine3
||
270 ctx
->Extensions
.NV_texture_env_combine4
);
273 legal
= ctx
->Extensions
.ATI_texture_env_combine3
;
280 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", param
);
284 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
287 texUnit
->Combine
.SourceA
[src
] = param
;
289 texUnit
->Combine
.SourceRGB
[src
] = param
;
293 /** Set an RGB or A combiner operand term */
295 set_combiner_operand(GLcontext
*ctx
,
296 struct gl_texture_unit
*texUnit
,
297 GLenum pname
, GLenum param
)
300 GLboolean alpha
, legal
;
302 if (!ctx
->Extensions
.EXT_texture_env_combine
&&
303 !ctx
->Extensions
.ARB_texture_env_combine
) {
304 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)");
309 case GL_OPERAND0_RGB
:
313 case GL_OPERAND1_RGB
:
317 case GL_OPERAND2_RGB
:
318 if (ctx
->Extensions
.ARB_texture_env_combine
) {
323 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
327 case GL_OPERAND3_RGB_NV
:
328 if (ctx
->Extensions
.NV_texture_env_combine4
) {
333 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
337 case GL_OPERAND0_ALPHA
:
341 case GL_OPERAND1_ALPHA
:
345 case GL_OPERAND2_ALPHA
:
346 if (ctx
->Extensions
.ARB_texture_env_combine
) {
351 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
355 case GL_OPERAND3_ALPHA_NV
:
356 if (ctx
->Extensions
.NV_texture_env_combine4
) {
361 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
366 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
373 * Error-check param (the source operand)
377 case GL_ONE_MINUS_SRC_COLOR
:
381 case GL_ONE_MINUS_SRC_ALPHA
:
389 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", param
);
393 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
396 texUnit
->Combine
.OperandA
[op
] = param
;
398 texUnit
->Combine
.OperandRGB
[op
] = param
;
403 set_combiner_scale(GLcontext
*ctx
,
404 struct gl_texture_unit
*texUnit
,
405 GLenum pname
, GLfloat scale
)
409 if (!ctx
->Extensions
.EXT_texture_env_combine
&&
410 !ctx
->Extensions
.ARB_texture_env_combine
) {
411 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)");
418 else if (scale
== 2.0F
) {
421 else if (scale
== 4.0F
) {
425 _mesa_error( ctx
, GL_INVALID_VALUE
,
426 "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
432 if (texUnit
->Combine
.ScaleShiftRGB
== shift
)
434 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
435 texUnit
->Combine
.ScaleShiftRGB
= shift
;
438 if (texUnit
->Combine
.ScaleShiftA
== shift
)
440 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
441 texUnit
->Combine
.ScaleShiftA
= shift
;
444 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
451 _mesa_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*param
)
454 GET_CURRENT_CONTEXT(ctx
);
455 struct gl_texture_unit
*texUnit
;
456 ASSERT_OUTSIDE_BEGIN_END(ctx
);
458 maxUnit
= (target
== GL_POINT_SPRITE_NV
&& pname
== GL_COORD_REPLACE_NV
)
459 ? ctx
->Const
.MaxTextureCoordUnits
: ctx
->Const
.MaxTextureImageUnits
;
460 if (ctx
->Texture
.CurrentUnit
>= maxUnit
) {
461 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glTexEnvfv(current unit)");
465 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
467 if (target
== GL_TEXTURE_ENV
) {
469 case GL_TEXTURE_ENV_MODE
:
470 set_env_mode(ctx
, texUnit
, (GLenum
) (GLint
) param
[0]);
472 case GL_TEXTURE_ENV_COLOR
:
473 set_env_color(ctx
, texUnit
, param
);
476 case GL_COMBINE_ALPHA
:
477 set_combiner_mode(ctx
, texUnit
, pname
, (GLenum
) (GLint
) param
[0]);
482 case GL_SOURCE3_RGB_NV
:
483 case GL_SOURCE0_ALPHA
:
484 case GL_SOURCE1_ALPHA
:
485 case GL_SOURCE2_ALPHA
:
486 case GL_SOURCE3_ALPHA_NV
:
487 set_combiner_source(ctx
, texUnit
, pname
, (GLenum
) (GLint
) param
[0]);
489 case GL_OPERAND0_RGB
:
490 case GL_OPERAND1_RGB
:
491 case GL_OPERAND2_RGB
:
492 case GL_OPERAND3_RGB_NV
:
493 case GL_OPERAND0_ALPHA
:
494 case GL_OPERAND1_ALPHA
:
495 case GL_OPERAND2_ALPHA
:
496 case GL_OPERAND3_ALPHA_NV
:
497 set_combiner_operand(ctx
, texUnit
, pname
, (GLenum
) (GLint
) param
[0]);
501 set_combiner_scale(ctx
, texUnit
, pname
, param
[0]);
504 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)" );
508 else if (target
== GL_TEXTURE_FILTER_CONTROL_EXT
) {
509 /* GL_EXT_texture_lod_bias */
510 if (!ctx
->Extensions
.EXT_texture_lod_bias
) {
511 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(target=0x%x)", target
);
514 if (pname
== GL_TEXTURE_LOD_BIAS_EXT
) {
515 if (texUnit
->LodBias
== param
[0])
517 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
518 texUnit
->LodBias
= param
[0];
521 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
525 else if (target
== GL_POINT_SPRITE_NV
) {
526 /* GL_ARB_point_sprite / GL_NV_point_sprite */
527 if (!ctx
->Extensions
.NV_point_sprite
528 && !ctx
->Extensions
.ARB_point_sprite
) {
529 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(target=0x%x)", target
);
532 if (pname
== GL_COORD_REPLACE_NV
) {
533 const GLenum value
= (GLenum
) param
[0];
534 if (value
== GL_TRUE
|| value
== GL_FALSE
) {
535 /* It's kind of weird to set point state via glTexEnv,
536 * but that's what the spec calls for.
538 const GLboolean state
= (GLboolean
) value
;
539 if (ctx
->Point
.CoordReplace
[ctx
->Texture
.CurrentUnit
] == state
)
541 FLUSH_VERTICES(ctx
, _NEW_POINT
);
542 ctx
->Point
.CoordReplace
[ctx
->Texture
.CurrentUnit
] = state
;
545 _mesa_error( ctx
, GL_INVALID_VALUE
, "glTexEnv(param=0x%x)", value
);
550 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(pname=0x%x)", pname
);
555 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(target=0x%x)",target
);
559 if (MESA_VERBOSE
&(VERBOSE_API
|VERBOSE_TEXTURE
))
560 _mesa_debug(ctx
, "glTexEnv %s %s %.1f(%s) ...\n",
561 _mesa_lookup_enum_by_nr(target
),
562 _mesa_lookup_enum_by_nr(pname
),
564 _mesa_lookup_enum_by_nr((GLenum
) (GLint
) *param
));
566 /* Tell device driver about the new texture environment */
567 if (ctx
->Driver
.TexEnv
) {
568 (*ctx
->Driver
.TexEnv
)( ctx
, target
, pname
, param
);
574 _mesa_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
576 _mesa_TexEnvfv( target
, pname
, ¶m
);
582 _mesa_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
585 p
[0] = (GLfloat
) param
;
586 p
[1] = p
[2] = p
[3] = 0.0;
587 _mesa_TexEnvfv( target
, pname
, p
);
592 _mesa_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
595 if (pname
== GL_TEXTURE_ENV_COLOR
) {
596 p
[0] = INT_TO_FLOAT( param
[0] );
597 p
[1] = INT_TO_FLOAT( param
[1] );
598 p
[2] = INT_TO_FLOAT( param
[2] );
599 p
[3] = INT_TO_FLOAT( param
[3] );
602 p
[0] = (GLfloat
) param
[0];
603 p
[1] = p
[2] = p
[3] = 0; /* init to zero, just to be safe */
605 _mesa_TexEnvfv( target
, pname
, p
);
611 * Helper for glGetTexEnvi/f()
612 * \return value of queried pname or -1 if error.
615 get_texenvi(GLcontext
*ctx
, const struct gl_texture_unit
*texUnit
,
619 case GL_TEXTURE_ENV_MODE
:
620 return texUnit
->EnvMode
;
623 if (ctx
->Extensions
.EXT_texture_env_combine
||
624 ctx
->Extensions
.ARB_texture_env_combine
) {
625 return texUnit
->Combine
.ModeRGB
;
628 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
631 case GL_COMBINE_ALPHA
:
632 if (ctx
->Extensions
.EXT_texture_env_combine
||
633 ctx
->Extensions
.ARB_texture_env_combine
) {
634 return texUnit
->Combine
.ModeA
;
637 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
643 if (ctx
->Extensions
.EXT_texture_env_combine
||
644 ctx
->Extensions
.ARB_texture_env_combine
) {
645 const unsigned rgb_idx
= pname
- GL_SOURCE0_RGB
;
646 return texUnit
->Combine
.SourceRGB
[rgb_idx
];
649 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
652 case GL_SOURCE3_RGB_NV
:
653 if (ctx
->Extensions
.NV_texture_env_combine4
) {
654 return texUnit
->Combine
.SourceRGB
[3];
657 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
660 case GL_SOURCE0_ALPHA
:
661 case GL_SOURCE1_ALPHA
:
662 case GL_SOURCE2_ALPHA
:
663 if (ctx
->Extensions
.EXT_texture_env_combine
||
664 ctx
->Extensions
.ARB_texture_env_combine
) {
665 const unsigned alpha_idx
= pname
- GL_SOURCE0_ALPHA
;
666 return texUnit
->Combine
.SourceA
[alpha_idx
];
669 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
672 case GL_SOURCE3_ALPHA_NV
:
673 if (ctx
->Extensions
.NV_texture_env_combine4
) {
674 return texUnit
->Combine
.SourceA
[3];
677 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
680 case GL_OPERAND0_RGB
:
681 case GL_OPERAND1_RGB
:
682 case GL_OPERAND2_RGB
:
683 if (ctx
->Extensions
.EXT_texture_env_combine
||
684 ctx
->Extensions
.ARB_texture_env_combine
) {
685 const unsigned op_rgb
= pname
- GL_OPERAND0_RGB
;
686 return texUnit
->Combine
.OperandRGB
[op_rgb
];
689 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
692 case GL_OPERAND3_RGB_NV
:
693 if (ctx
->Extensions
.NV_texture_env_combine4
) {
694 return texUnit
->Combine
.OperandRGB
[3];
697 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
700 case GL_OPERAND0_ALPHA
:
701 case GL_OPERAND1_ALPHA
:
702 case GL_OPERAND2_ALPHA
:
703 if (ctx
->Extensions
.EXT_texture_env_combine
||
704 ctx
->Extensions
.ARB_texture_env_combine
) {
705 const unsigned op_alpha
= pname
- GL_OPERAND0_ALPHA
;
706 return texUnit
->Combine
.OperandA
[op_alpha
];
709 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
712 case GL_OPERAND3_ALPHA_NV
:
713 if (ctx
->Extensions
.NV_texture_env_combine4
) {
714 return texUnit
->Combine
.OperandA
[3];
717 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
721 if (ctx
->Extensions
.EXT_texture_env_combine
||
722 ctx
->Extensions
.ARB_texture_env_combine
) {
723 return 1 << texUnit
->Combine
.ScaleShiftRGB
;
726 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
730 if (ctx
->Extensions
.EXT_texture_env_combine
||
731 ctx
->Extensions
.ARB_texture_env_combine
) {
732 return 1 << texUnit
->Combine
.ScaleShiftA
;
735 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
742 return -1; /* error */
748 _mesa_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
751 const struct gl_texture_unit
*texUnit
;
752 GET_CURRENT_CONTEXT(ctx
);
753 ASSERT_OUTSIDE_BEGIN_END(ctx
);
755 maxUnit
= (target
== GL_POINT_SPRITE_NV
&& pname
== GL_COORD_REPLACE_NV
)
756 ? ctx
->Const
.MaxTextureCoordUnits
: ctx
->Const
.MaxTextureImageUnits
;
757 if (ctx
->Texture
.CurrentUnit
>= maxUnit
) {
758 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetTexEnvfv(current unit)");
762 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
764 if (target
== GL_TEXTURE_ENV
) {
765 if (pname
== GL_TEXTURE_ENV_COLOR
) {
766 COPY_4FV( params
, texUnit
->EnvColor
);
769 GLint val
= get_texenvi(ctx
, texUnit
, pname
);
771 *params
= (GLfloat
) val
;
775 else if (target
== GL_TEXTURE_FILTER_CONTROL_EXT
) {
776 /* GL_EXT_texture_lod_bias */
777 if (!ctx
->Extensions
.EXT_texture_lod_bias
) {
778 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(target)" );
781 if (pname
== GL_TEXTURE_LOD_BIAS_EXT
) {
782 *params
= texUnit
->LodBias
;
785 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)" );
789 else if (target
== GL_POINT_SPRITE_NV
) {
790 /* GL_ARB_point_sprite / GL_NV_point_sprite */
791 if (!ctx
->Extensions
.NV_point_sprite
792 && !ctx
->Extensions
.ARB_point_sprite
) {
793 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(target)" );
796 if (pname
== GL_COORD_REPLACE_NV
) {
797 *params
= (GLfloat
) ctx
->Point
.CoordReplace
[ctx
->Texture
.CurrentUnit
];
800 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)" );
805 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(target)" );
812 _mesa_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
815 const struct gl_texture_unit
*texUnit
;
816 GET_CURRENT_CONTEXT(ctx
);
817 ASSERT_OUTSIDE_BEGIN_END(ctx
);
819 maxUnit
= (target
== GL_POINT_SPRITE_NV
&& pname
== GL_COORD_REPLACE_NV
)
820 ? ctx
->Const
.MaxTextureCoordUnits
: ctx
->Const
.MaxTextureImageUnits
;
821 if (ctx
->Texture
.CurrentUnit
>= maxUnit
) {
822 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetTexEnviv(current unit)");
826 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
828 if (target
== GL_TEXTURE_ENV
) {
829 if (pname
== GL_TEXTURE_ENV_COLOR
) {
830 params
[0] = FLOAT_TO_INT( texUnit
->EnvColor
[0] );
831 params
[1] = FLOAT_TO_INT( texUnit
->EnvColor
[1] );
832 params
[2] = FLOAT_TO_INT( texUnit
->EnvColor
[2] );
833 params
[3] = FLOAT_TO_INT( texUnit
->EnvColor
[3] );
836 GLint val
= get_texenvi(ctx
, texUnit
, pname
);
842 else if (target
== GL_TEXTURE_FILTER_CONTROL_EXT
) {
843 /* GL_EXT_texture_lod_bias */
844 if (!ctx
->Extensions
.EXT_texture_lod_bias
) {
845 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(target)" );
848 if (pname
== GL_TEXTURE_LOD_BIAS_EXT
) {
849 *params
= (GLint
) texUnit
->LodBias
;
852 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(pname)" );
856 else if (target
== GL_POINT_SPRITE_NV
) {
857 /* GL_ARB_point_sprite / GL_NV_point_sprite */
858 if (!ctx
->Extensions
.NV_point_sprite
859 && !ctx
->Extensions
.ARB_point_sprite
) {
860 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(target)" );
863 if (pname
== GL_COORD_REPLACE_NV
) {
864 *params
= (GLint
) ctx
->Point
.CoordReplace
[ctx
->Texture
.CurrentUnit
];
867 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(pname)" );
872 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(target)" );