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"
38 #include "math/m_xform.h"
41 #define TE_ERROR(errCode, msg, value) \
42 _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value));
45 /** Set texture env mode */
47 set_env_mode(GLcontext
*ctx
,
48 struct gl_texture_unit
*texUnit
,
53 if (texUnit
->EnvMode
== mode
)
64 mode
= GL_REPLACE
; /* GL_REPLACE_EXT != GL_REPLACE */
68 legal
= ctx
->Extensions
.EXT_texture_env_add
;
71 legal
= (ctx
->Extensions
.EXT_texture_env_combine
||
72 ctx
->Extensions
.ARB_texture_env_combine
);
75 legal
= ctx
->Extensions
.NV_texture_env_combine4
;
82 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
83 texUnit
->EnvMode
= mode
;
86 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", mode
);
92 set_env_color(GLcontext
*ctx
,
93 struct gl_texture_unit
*texUnit
,
97 tmp
[0] = CLAMP(color
[0], 0.0F
, 1.0F
);
98 tmp
[1] = CLAMP(color
[1], 0.0F
, 1.0F
);
99 tmp
[2] = CLAMP(color
[2], 0.0F
, 1.0F
);
100 tmp
[3] = CLAMP(color
[3], 0.0F
, 1.0F
);
101 if (TEST_EQ_4V(tmp
, texUnit
->EnvColor
))
103 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
104 COPY_4FV(texUnit
->EnvColor
, tmp
);
108 /** Set an RGB or A combiner mode/function */
110 set_combiner_mode(GLcontext
*ctx
,
111 struct gl_texture_unit
*texUnit
,
112 GLenum pname
, GLenum mode
)
116 if (!ctx
->Extensions
.EXT_texture_env_combine
&&
117 !ctx
->Extensions
.ARB_texture_env_combine
) {
118 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)");
131 legal
= ctx
->Extensions
.ARB_texture_env_combine
;
133 case GL_DOT3_RGB_EXT
:
134 case GL_DOT3_RGBA_EXT
:
135 legal
= (ctx
->Extensions
.EXT_texture_env_dot3
&&
136 pname
== GL_COMBINE_RGB
);
140 legal
= (ctx
->Extensions
.ARB_texture_env_dot3
&&
141 pname
== GL_COMBINE_RGB
);
143 case GL_MODULATE_ADD_ATI
:
144 case GL_MODULATE_SIGNED_ADD_ATI
:
145 case GL_MODULATE_SUBTRACT_ATI
:
146 legal
=ctx
->Extensions
.ATI_texture_env_combine3
;
153 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", mode
);
159 if (texUnit
->Combine
.ModeRGB
== mode
)
161 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
162 texUnit
->Combine
.ModeRGB
= mode
;
165 case GL_COMBINE_ALPHA
:
166 if (texUnit
->Combine
.ModeA
== mode
)
168 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
169 texUnit
->Combine
.ModeA
= mode
;
172 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
178 /** Set an RGB or A combiner source term */
180 set_combiner_source(GLcontext
*ctx
,
181 struct gl_texture_unit
*texUnit
,
182 GLenum pname
, GLenum param
)
185 GLboolean alpha
, legal
;
187 if (!ctx
->Extensions
.EXT_texture_env_combine
&&
188 !ctx
->Extensions
.ARB_texture_env_combine
) {
189 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)");
194 * Translate pname to (src, alpha).
209 case GL_SOURCE3_RGB_NV
:
210 if (ctx
->Extensions
.NV_texture_env_combine4
) {
215 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
219 case GL_SOURCE0_ALPHA
:
223 case GL_SOURCE1_ALPHA
:
227 case GL_SOURCE2_ALPHA
:
231 case GL_SOURCE3_ALPHA_NV
:
232 if (ctx
->Extensions
.NV_texture_env_combine4
) {
237 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
242 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
249 * Error-check param (the source term)
254 case GL_PRIMARY_COLOR
:
266 legal
= (ctx
->Extensions
.ARB_texture_env_crossbar
&&
267 param
- GL_TEXTURE0
< ctx
->Const
.MaxTextureUnits
);
270 legal
= (ctx
->Extensions
.ATI_texture_env_combine3
||
271 ctx
->Extensions
.NV_texture_env_combine4
);
274 legal
= ctx
->Extensions
.ATI_texture_env_combine3
;
281 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", param
);
285 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
288 texUnit
->Combine
.SourceA
[src
] = param
;
290 texUnit
->Combine
.SourceRGB
[src
] = param
;
294 /** Set an RGB or A combiner operand term */
296 set_combiner_operand(GLcontext
*ctx
,
297 struct gl_texture_unit
*texUnit
,
298 GLenum pname
, GLenum param
)
301 GLboolean alpha
, legal
;
303 if (!ctx
->Extensions
.EXT_texture_env_combine
&&
304 !ctx
->Extensions
.ARB_texture_env_combine
) {
305 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)");
310 case GL_OPERAND0_RGB
:
314 case GL_OPERAND1_RGB
:
318 case GL_OPERAND2_RGB
:
319 if (ctx
->Extensions
.ARB_texture_env_combine
) {
324 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
328 case GL_OPERAND3_RGB_NV
:
329 if (ctx
->Extensions
.NV_texture_env_combine4
) {
334 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
338 case GL_OPERAND0_ALPHA
:
342 case GL_OPERAND1_ALPHA
:
346 case GL_OPERAND2_ALPHA
:
347 if (ctx
->Extensions
.ARB_texture_env_combine
) {
352 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
356 case GL_OPERAND3_ALPHA_NV
:
357 if (ctx
->Extensions
.NV_texture_env_combine4
) {
362 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
367 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
374 * Error-check param (the source operand)
378 case GL_ONE_MINUS_SRC_COLOR
:
382 case GL_ONE_MINUS_SRC_ALPHA
:
390 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", param
);
394 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
397 texUnit
->Combine
.OperandA
[op
] = param
;
399 texUnit
->Combine
.OperandRGB
[op
] = param
;
404 set_combiner_scale(GLcontext
*ctx
,
405 struct gl_texture_unit
*texUnit
,
406 GLenum pname
, GLfloat scale
)
410 if (!ctx
->Extensions
.EXT_texture_env_combine
&&
411 !ctx
->Extensions
.ARB_texture_env_combine
) {
412 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)");
419 else if (scale
== 2.0F
) {
422 else if (scale
== 4.0F
) {
426 _mesa_error( ctx
, GL_INVALID_VALUE
,
427 "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
433 if (texUnit
->Combine
.ScaleShiftRGB
== shift
)
435 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
436 texUnit
->Combine
.ScaleShiftRGB
= shift
;
439 if (texUnit
->Combine
.ScaleShiftA
== shift
)
441 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
442 texUnit
->Combine
.ScaleShiftA
= shift
;
445 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
452 _mesa_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*param
)
455 GET_CURRENT_CONTEXT(ctx
);
456 struct gl_texture_unit
*texUnit
;
457 ASSERT_OUTSIDE_BEGIN_END(ctx
);
459 maxUnit
= (target
== GL_POINT_SPRITE_NV
&& pname
== GL_COORD_REPLACE_NV
)
460 ? ctx
->Const
.MaxTextureCoordUnits
: ctx
->Const
.MaxTextureImageUnits
;
461 if (ctx
->Texture
.CurrentUnit
>= maxUnit
) {
462 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glTexEnvfv(current unit)");
466 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
468 if (target
== GL_TEXTURE_ENV
) {
470 case GL_TEXTURE_ENV_MODE
:
471 set_env_mode(ctx
, texUnit
, (GLenum
) (GLint
) param
[0]);
473 case GL_TEXTURE_ENV_COLOR
:
474 set_env_color(ctx
, texUnit
, param
);
477 case GL_COMBINE_ALPHA
:
478 set_combiner_mode(ctx
, texUnit
, pname
, (GLenum
) (GLint
) param
[0]);
483 case GL_SOURCE3_RGB_NV
:
484 case GL_SOURCE0_ALPHA
:
485 case GL_SOURCE1_ALPHA
:
486 case GL_SOURCE2_ALPHA
:
487 case GL_SOURCE3_ALPHA_NV
:
488 set_combiner_source(ctx
, texUnit
, pname
, (GLenum
) (GLint
) param
[0]);
490 case GL_OPERAND0_RGB
:
491 case GL_OPERAND1_RGB
:
492 case GL_OPERAND2_RGB
:
493 case GL_OPERAND3_RGB_NV
:
494 case GL_OPERAND0_ALPHA
:
495 case GL_OPERAND1_ALPHA
:
496 case GL_OPERAND2_ALPHA
:
497 case GL_OPERAND3_ALPHA_NV
:
498 set_combiner_operand(ctx
, texUnit
, pname
, (GLenum
) (GLint
) param
[0]);
502 set_combiner_scale(ctx
, texUnit
, pname
, param
[0]);
505 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)" );
509 else if (target
== GL_TEXTURE_FILTER_CONTROL_EXT
) {
510 /* GL_EXT_texture_lod_bias */
511 if (!ctx
->Extensions
.EXT_texture_lod_bias
) {
512 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(target=0x%x)", target
);
515 if (pname
== GL_TEXTURE_LOD_BIAS_EXT
) {
516 if (texUnit
->LodBias
== param
[0])
518 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
519 texUnit
->LodBias
= param
[0];
522 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
526 else if (target
== GL_POINT_SPRITE_NV
) {
527 /* GL_ARB_point_sprite / GL_NV_point_sprite */
528 if (!ctx
->Extensions
.NV_point_sprite
529 && !ctx
->Extensions
.ARB_point_sprite
) {
530 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(target=0x%x)", target
);
533 if (pname
== GL_COORD_REPLACE_NV
) {
534 const GLenum value
= (GLenum
) param
[0];
535 if (value
== GL_TRUE
|| value
== GL_FALSE
) {
536 /* It's kind of weird to set point state via glTexEnv,
537 * but that's what the spec calls for.
539 const GLboolean state
= (GLboolean
) value
;
540 if (ctx
->Point
.CoordReplace
[ctx
->Texture
.CurrentUnit
] == state
)
542 FLUSH_VERTICES(ctx
, _NEW_POINT
);
543 ctx
->Point
.CoordReplace
[ctx
->Texture
.CurrentUnit
] = state
;
546 _mesa_error( ctx
, GL_INVALID_VALUE
, "glTexEnv(param=0x%x)", value
);
551 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(pname=0x%x)", pname
);
556 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(target=0x%x)",target
);
560 if (MESA_VERBOSE
&(VERBOSE_API
|VERBOSE_TEXTURE
))
561 _mesa_debug(ctx
, "glTexEnv %s %s %.1f(%s) ...\n",
562 _mesa_lookup_enum_by_nr(target
),
563 _mesa_lookup_enum_by_nr(pname
),
565 _mesa_lookup_enum_by_nr((GLenum
) (GLint
) *param
));
567 /* Tell device driver about the new texture environment */
568 if (ctx
->Driver
.TexEnv
) {
569 (*ctx
->Driver
.TexEnv
)( ctx
, target
, pname
, param
);
575 _mesa_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
577 _mesa_TexEnvfv( target
, pname
, ¶m
);
583 _mesa_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
586 p
[0] = (GLfloat
) param
;
587 p
[1] = p
[2] = p
[3] = 0.0;
588 _mesa_TexEnvfv( target
, pname
, p
);
593 _mesa_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
596 if (pname
== GL_TEXTURE_ENV_COLOR
) {
597 p
[0] = INT_TO_FLOAT( param
[0] );
598 p
[1] = INT_TO_FLOAT( param
[1] );
599 p
[2] = INT_TO_FLOAT( param
[2] );
600 p
[3] = INT_TO_FLOAT( param
[3] );
603 p
[0] = (GLfloat
) param
[0];
604 p
[1] = p
[2] = p
[3] = 0; /* init to zero, just to be safe */
606 _mesa_TexEnvfv( target
, pname
, p
);
612 * Helper for glGetTexEnvi/f()
613 * \return value of queried pname or -1 if error.
616 get_texenvi(GLcontext
*ctx
, const struct gl_texture_unit
*texUnit
,
620 case GL_TEXTURE_ENV_MODE
:
621 return texUnit
->EnvMode
;
624 if (ctx
->Extensions
.EXT_texture_env_combine
||
625 ctx
->Extensions
.ARB_texture_env_combine
) {
626 return texUnit
->Combine
.ModeRGB
;
629 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
632 case GL_COMBINE_ALPHA
:
633 if (ctx
->Extensions
.EXT_texture_env_combine
||
634 ctx
->Extensions
.ARB_texture_env_combine
) {
635 return texUnit
->Combine
.ModeA
;
638 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
644 if (ctx
->Extensions
.EXT_texture_env_combine
||
645 ctx
->Extensions
.ARB_texture_env_combine
) {
646 const unsigned rgb_idx
= pname
- GL_SOURCE0_RGB
;
647 return texUnit
->Combine
.SourceRGB
[rgb_idx
];
650 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
653 case GL_SOURCE3_RGB_NV
:
654 if (ctx
->Extensions
.NV_texture_env_combine4
) {
655 return texUnit
->Combine
.SourceRGB
[3];
658 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
661 case GL_SOURCE0_ALPHA
:
662 case GL_SOURCE1_ALPHA
:
663 case GL_SOURCE2_ALPHA
:
664 if (ctx
->Extensions
.EXT_texture_env_combine
||
665 ctx
->Extensions
.ARB_texture_env_combine
) {
666 const unsigned alpha_idx
= pname
- GL_SOURCE0_ALPHA
;
667 return texUnit
->Combine
.SourceA
[alpha_idx
];
670 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
673 case GL_SOURCE3_ALPHA_NV
:
674 if (ctx
->Extensions
.NV_texture_env_combine4
) {
675 return texUnit
->Combine
.SourceA
[3];
678 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
681 case GL_OPERAND0_RGB
:
682 case GL_OPERAND1_RGB
:
683 case GL_OPERAND2_RGB
:
684 if (ctx
->Extensions
.EXT_texture_env_combine
||
685 ctx
->Extensions
.ARB_texture_env_combine
) {
686 const unsigned op_rgb
= pname
- GL_OPERAND0_RGB
;
687 return texUnit
->Combine
.OperandRGB
[op_rgb
];
690 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
693 case GL_OPERAND3_RGB_NV
:
694 if (ctx
->Extensions
.NV_texture_env_combine4
) {
695 return texUnit
->Combine
.OperandRGB
[3];
698 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
701 case GL_OPERAND0_ALPHA
:
702 case GL_OPERAND1_ALPHA
:
703 case GL_OPERAND2_ALPHA
:
704 if (ctx
->Extensions
.EXT_texture_env_combine
||
705 ctx
->Extensions
.ARB_texture_env_combine
) {
706 const unsigned op_alpha
= pname
- GL_OPERAND0_ALPHA
;
707 return texUnit
->Combine
.OperandA
[op_alpha
];
710 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
713 case GL_OPERAND3_ALPHA_NV
:
714 if (ctx
->Extensions
.NV_texture_env_combine4
) {
715 return texUnit
->Combine
.OperandA
[3];
718 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
722 if (ctx
->Extensions
.EXT_texture_env_combine
||
723 ctx
->Extensions
.ARB_texture_env_combine
) {
724 return 1 << texUnit
->Combine
.ScaleShiftRGB
;
727 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
731 if (ctx
->Extensions
.EXT_texture_env_combine
||
732 ctx
->Extensions
.ARB_texture_env_combine
) {
733 return 1 << texUnit
->Combine
.ScaleShiftA
;
736 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
743 return -1; /* error */
749 _mesa_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
752 const struct gl_texture_unit
*texUnit
;
753 GET_CURRENT_CONTEXT(ctx
);
754 ASSERT_OUTSIDE_BEGIN_END(ctx
);
756 maxUnit
= (target
== GL_POINT_SPRITE_NV
&& pname
== GL_COORD_REPLACE_NV
)
757 ? ctx
->Const
.MaxTextureCoordUnits
: ctx
->Const
.MaxTextureImageUnits
;
758 if (ctx
->Texture
.CurrentUnit
>= maxUnit
) {
759 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetTexEnvfv(current unit)");
763 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
765 if (target
== GL_TEXTURE_ENV
) {
766 if (pname
== GL_TEXTURE_ENV_COLOR
) {
767 COPY_4FV( params
, texUnit
->EnvColor
);
770 GLint val
= get_texenvi(ctx
, texUnit
, pname
);
772 *params
= (GLfloat
) val
;
776 else if (target
== GL_TEXTURE_FILTER_CONTROL_EXT
) {
777 /* GL_EXT_texture_lod_bias */
778 if (!ctx
->Extensions
.EXT_texture_lod_bias
) {
779 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(target)" );
782 if (pname
== GL_TEXTURE_LOD_BIAS_EXT
) {
783 *params
= texUnit
->LodBias
;
786 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)" );
790 else if (target
== GL_POINT_SPRITE_NV
) {
791 /* GL_ARB_point_sprite / GL_NV_point_sprite */
792 if (!ctx
->Extensions
.NV_point_sprite
793 && !ctx
->Extensions
.ARB_point_sprite
) {
794 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(target)" );
797 if (pname
== GL_COORD_REPLACE_NV
) {
798 *params
= (GLfloat
) ctx
->Point
.CoordReplace
[ctx
->Texture
.CurrentUnit
];
801 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)" );
806 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(target)" );
813 _mesa_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
816 const struct gl_texture_unit
*texUnit
;
817 GET_CURRENT_CONTEXT(ctx
);
818 ASSERT_OUTSIDE_BEGIN_END(ctx
);
820 maxUnit
= (target
== GL_POINT_SPRITE_NV
&& pname
== GL_COORD_REPLACE_NV
)
821 ? ctx
->Const
.MaxTextureCoordUnits
: ctx
->Const
.MaxTextureImageUnits
;
822 if (ctx
->Texture
.CurrentUnit
>= maxUnit
) {
823 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetTexEnviv(current unit)");
827 texUnit
= &ctx
->Texture
.Unit
[ctx
->Texture
.CurrentUnit
];
829 if (target
== GL_TEXTURE_ENV
) {
830 if (pname
== GL_TEXTURE_ENV_COLOR
) {
831 params
[0] = FLOAT_TO_INT( texUnit
->EnvColor
[0] );
832 params
[1] = FLOAT_TO_INT( texUnit
->EnvColor
[1] );
833 params
[2] = FLOAT_TO_INT( texUnit
->EnvColor
[2] );
834 params
[3] = FLOAT_TO_INT( texUnit
->EnvColor
[3] );
837 GLint val
= get_texenvi(ctx
, texUnit
, pname
);
843 else if (target
== GL_TEXTURE_FILTER_CONTROL_EXT
) {
844 /* GL_EXT_texture_lod_bias */
845 if (!ctx
->Extensions
.EXT_texture_lod_bias
) {
846 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(target)" );
849 if (pname
== GL_TEXTURE_LOD_BIAS_EXT
) {
850 *params
= (GLint
) texUnit
->LodBias
;
853 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(pname)" );
857 else if (target
== GL_POINT_SPRITE_NV
) {
858 /* GL_ARB_point_sprite / GL_NV_point_sprite */
859 if (!ctx
->Extensions
.NV_point_sprite
860 && !ctx
->Extensions
.ARB_point_sprite
) {
861 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(target)" );
864 if (pname
== GL_COORD_REPLACE_NV
) {
865 *params
= (GLint
) ctx
->Point
.CoordReplace
[ctx
->Texture
.CurrentUnit
];
868 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(pname)" );
873 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(target)" );