2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * glTexEnv-related functions
33 #include "main/glheader.h"
34 #include "main/context.h"
35 #include "main/blend.h"
36 #include "main/enums.h"
37 #include "main/macros.h"
38 #include "main/mtypes.h"
39 #include "main/state.h"
40 #include "main/texenv.h"
41 #include "main/texstate.h"
44 #define TE_ERROR(errCode, msg, value) \
45 _mesa_error(ctx, errCode, msg, _mesa_enum_to_string(value));
48 /** Set texture env mode */
50 set_env_mode(struct gl_context
*ctx
,
51 struct gl_fixedfunc_texture_unit
*texUnit
,
56 if (texUnit
->EnvMode
== mode
)
69 mode
= GL_REPLACE
; /* GL_REPLACE_EXT != GL_REPLACE */
73 legal
= ctx
->Extensions
.NV_texture_env_combine4
;
80 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
81 texUnit
->EnvMode
= mode
;
84 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", mode
);
90 set_env_color(struct gl_context
*ctx
,
91 struct gl_fixedfunc_texture_unit
*texUnit
,
94 if (TEST_EQ_4V(color
, texUnit
->EnvColorUnclamped
))
96 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
97 COPY_4FV(texUnit
->EnvColorUnclamped
, color
);
98 texUnit
->EnvColor
[0] = CLAMP(color
[0], 0.0F
, 1.0F
);
99 texUnit
->EnvColor
[1] = CLAMP(color
[1], 0.0F
, 1.0F
);
100 texUnit
->EnvColor
[2] = CLAMP(color
[2], 0.0F
, 1.0F
);
101 texUnit
->EnvColor
[3] = CLAMP(color
[3], 0.0F
, 1.0F
);
105 /** Set an RGB or A combiner mode/function */
107 set_combiner_mode(struct gl_context
*ctx
,
108 struct gl_fixedfunc_texture_unit
*texUnit
,
109 GLenum pname
, GLenum mode
)
122 legal
= ctx
->Extensions
.ARB_texture_env_combine
;
124 case GL_DOT3_RGB_EXT
:
125 case GL_DOT3_RGBA_EXT
:
126 legal
= (ctx
->API
== API_OPENGL_COMPAT
&&
127 ctx
->Extensions
.EXT_texture_env_dot3
&&
128 pname
== GL_COMBINE_RGB
);
132 legal
= (ctx
->Extensions
.ARB_texture_env_dot3
&&
133 pname
== GL_COMBINE_RGB
);
135 case GL_MODULATE_ADD_ATI
:
136 case GL_MODULATE_SIGNED_ADD_ATI
:
137 case GL_MODULATE_SUBTRACT_ATI
:
138 legal
= (ctx
->API
== API_OPENGL_COMPAT
&&
139 ctx
->Extensions
.ATI_texture_env_combine3
);
146 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", mode
);
152 if (texUnit
->Combine
.ModeRGB
== mode
)
154 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
155 texUnit
->Combine
.ModeRGB
= mode
;
158 case GL_COMBINE_ALPHA
:
159 if (texUnit
->Combine
.ModeA
== mode
)
161 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
162 texUnit
->Combine
.ModeA
= mode
;
165 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
174 /** Set an RGB or A combiner source term */
176 set_combiner_source(struct gl_context
*ctx
,
177 struct gl_fixedfunc_texture_unit
*texUnit
,
178 GLenum pname
, GLenum param
)
181 GLboolean alpha
, legal
;
184 * Translate pname to (term, alpha).
186 * The enums were given sequential values for a reason.
192 case GL_SOURCE3_RGB_NV
:
193 term
= pname
- GL_SOURCE0_RGB
;
196 case GL_SOURCE0_ALPHA
:
197 case GL_SOURCE1_ALPHA
:
198 case GL_SOURCE2_ALPHA
:
199 case GL_SOURCE3_ALPHA_NV
:
200 term
= pname
- GL_SOURCE0_ALPHA
;
204 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
208 if ((term
== 3) && (ctx
->API
!= API_OPENGL_COMPAT
209 || !ctx
->Extensions
.NV_texture_env_combine4
)) {
210 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
214 assert(term
< MAX_COMBINER_TERMS
);
217 * Error-check param (the source term)
222 case GL_PRIMARY_COLOR
:
234 legal
= (ctx
->Extensions
.ARB_texture_env_crossbar
&&
235 param
- GL_TEXTURE0
< ctx
->Const
.MaxTextureUnits
);
238 legal
= (ctx
->API
== API_OPENGL_COMPAT
&&
239 (ctx
->Extensions
.ATI_texture_env_combine3
||
240 ctx
->Extensions
.NV_texture_env_combine4
));
243 legal
= (ctx
->API
== API_OPENGL_COMPAT
&&
244 ctx
->Extensions
.ATI_texture_env_combine3
);
251 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", param
);
255 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
258 texUnit
->Combine
.SourceA
[term
] = param
;
260 texUnit
->Combine
.SourceRGB
[term
] = param
;
266 /** Set an RGB or A combiner operand term */
268 set_combiner_operand(struct gl_context
*ctx
,
269 struct gl_fixedfunc_texture_unit
*texUnit
,
270 GLenum pname
, GLenum param
)
273 GLboolean alpha
, legal
;
275 /* The enums were given sequential values for a reason.
278 case GL_OPERAND0_RGB
:
279 case GL_OPERAND1_RGB
:
280 case GL_OPERAND2_RGB
:
281 case GL_OPERAND3_RGB_NV
:
282 term
= pname
- GL_OPERAND0_RGB
;
285 case GL_OPERAND0_ALPHA
:
286 case GL_OPERAND1_ALPHA
:
287 case GL_OPERAND2_ALPHA
:
288 case GL_OPERAND3_ALPHA_NV
:
289 term
= pname
- GL_OPERAND0_ALPHA
;
293 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
297 if ((term
== 3) && (ctx
->API
!= API_OPENGL_COMPAT
298 || !ctx
->Extensions
.NV_texture_env_combine4
)) {
299 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
303 assert(term
< MAX_COMBINER_TERMS
);
306 * Error-check param (the source operand)
310 case GL_ONE_MINUS_SRC_COLOR
:
311 /* The color input can only be used with GL_OPERAND[01]_RGB in the EXT
312 * version. In the ARB and NV versions and OpenGL ES 1.x they can be
313 * used for any RGB operand.
316 && ((term
< 2) || ctx
->Extensions
.ARB_texture_env_combine
317 || ctx
->Extensions
.NV_texture_env_combine4
);
319 case GL_ONE_MINUS_SRC_ALPHA
:
320 /* GL_ONE_MINUS_SRC_ALPHA can only be used with
321 * GL_OPERAND[01]_(RGB|ALPHA) in the EXT version. In the ARB and NV
322 * versions and OpenGL ES 1.x it can be used for any operand.
324 legal
= (term
< 2) || ctx
->Extensions
.ARB_texture_env_combine
325 || ctx
->Extensions
.NV_texture_env_combine4
;
335 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(param=%s)", param
);
339 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
342 texUnit
->Combine
.OperandA
[term
] = param
;
344 texUnit
->Combine
.OperandRGB
[term
] = param
;
351 set_combiner_scale(struct gl_context
*ctx
,
352 struct gl_fixedfunc_texture_unit
*texUnit
,
353 GLenum pname
, GLfloat scale
)
360 else if (scale
== 2.0F
) {
363 else if (scale
== 4.0F
) {
367 _mesa_error( ctx
, GL_INVALID_VALUE
,
368 "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
374 if (texUnit
->Combine
.ScaleShiftRGB
== shift
)
376 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
377 texUnit
->Combine
.ScaleShiftRGB
= shift
;
380 if (texUnit
->Combine
.ScaleShiftA
== shift
)
382 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_STATE
);
383 texUnit
->Combine
.ScaleShiftA
= shift
;
386 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
396 _mesa_TexEnvfv( GLenum target
, GLenum pname
, const GLfloat
*param
)
398 const GLint iparam0
= (GLint
) param
[0];
400 GET_CURRENT_CONTEXT(ctx
);
402 maxUnit
= (target
== GL_POINT_SPRITE_NV
&& pname
== GL_COORD_REPLACE_NV
)
403 ? ctx
->Const
.MaxTextureCoordUnits
: ctx
->Const
.MaxCombinedTextureImageUnits
;
404 if (ctx
->Texture
.CurrentUnit
>= maxUnit
) {
405 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glTexEnvfv(current unit)");
409 if (target
== GL_TEXTURE_ENV
) {
410 struct gl_fixedfunc_texture_unit
*texUnit
=
411 _mesa_get_current_fixedfunc_tex_unit(ctx
);
413 /* The GL spec says that we should report an error if the unit is greater
414 * than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only
415 * fixed-function units are usable. This is probably a spec bug.
416 * Ignore glTexEnv(GL_TEXTURE_ENV) calls for non-fixed-func units,
417 * because we don't want to process calls that have no effect.
423 case GL_TEXTURE_ENV_MODE
:
424 set_env_mode(ctx
, texUnit
, (GLenum
) iparam0
);
426 case GL_TEXTURE_ENV_COLOR
:
427 set_env_color(ctx
, texUnit
, param
);
430 case GL_COMBINE_ALPHA
:
431 if (!set_combiner_mode(ctx
, texUnit
, pname
, (GLenum
) iparam0
))
437 case GL_SOURCE3_RGB_NV
:
438 case GL_SOURCE0_ALPHA
:
439 case GL_SOURCE1_ALPHA
:
440 case GL_SOURCE2_ALPHA
:
441 case GL_SOURCE3_ALPHA_NV
:
442 if (!set_combiner_source(ctx
, texUnit
, pname
, (GLenum
) iparam0
))
445 case GL_OPERAND0_RGB
:
446 case GL_OPERAND1_RGB
:
447 case GL_OPERAND2_RGB
:
448 case GL_OPERAND3_RGB_NV
:
449 case GL_OPERAND0_ALPHA
:
450 case GL_OPERAND1_ALPHA
:
451 case GL_OPERAND2_ALPHA
:
452 case GL_OPERAND3_ALPHA_NV
:
453 if (!set_combiner_operand(ctx
, texUnit
, pname
, (GLenum
) iparam0
))
458 if (!set_combiner_scale(ctx
, texUnit
, pname
, param
[0]))
462 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(pname)" );
466 else if (target
== GL_TEXTURE_FILTER_CONTROL_EXT
) {
467 struct gl_texture_unit
*texUnit
=
468 _mesa_get_current_tex_unit(ctx
);
470 if (pname
== GL_TEXTURE_LOD_BIAS_EXT
) {
471 if (texUnit
->LodBias
== param
[0])
473 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
474 texUnit
->LodBias
= param
[0];
477 TE_ERROR(GL_INVALID_ENUM
, "glTexEnv(pname=%s)", pname
);
481 else if (target
== GL_POINT_SPRITE_NV
) {
482 /* GL_ARB_point_sprite / GL_NV_point_sprite */
483 if (!ctx
->Extensions
.NV_point_sprite
484 && !ctx
->Extensions
.ARB_point_sprite
) {
485 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(target=0x%x)", target
);
488 if (pname
== GL_COORD_REPLACE_NV
) {
489 /* It's kind of weird to set point state via glTexEnv,
490 * but that's what the spec calls for.
492 if (iparam0
== GL_TRUE
) {
493 if (ctx
->Point
.CoordReplace
& (1u << ctx
->Texture
.CurrentUnit
))
495 ctx
->Point
.CoordReplace
|= (1u << ctx
->Texture
.CurrentUnit
);
496 } else if (iparam0
== GL_FALSE
) {
497 if (~(ctx
->Point
.CoordReplace
) & (1u << ctx
->Texture
.CurrentUnit
))
499 ctx
->Point
.CoordReplace
&= ~(1u << ctx
->Texture
.CurrentUnit
);
501 _mesa_error( ctx
, GL_INVALID_VALUE
, "glTexEnv(param=0x%x)", iparam0
);
504 FLUSH_VERTICES(ctx
, _NEW_POINT
);
507 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexEnv(pname=0x%x)", pname
);
512 _mesa_error(ctx
, GL_INVALID_ENUM
, "glTexEnv(target=%s)",
513 _mesa_enum_to_string(target
));
517 if (MESA_VERBOSE
&(VERBOSE_API
|VERBOSE_TEXTURE
))
518 _mesa_debug(ctx
, "glTexEnv %s %s %.1f(%s) ...\n",
519 _mesa_enum_to_string(target
),
520 _mesa_enum_to_string(pname
),
522 _mesa_enum_to_string((GLenum
) iparam0
));
524 /* Tell device driver about the new texture environment */
525 if (ctx
->Driver
.TexEnv
) {
526 ctx
->Driver
.TexEnv(ctx
, target
, pname
, param
);
532 _mesa_TexEnvf( GLenum target
, GLenum pname
, GLfloat param
)
536 p
[1] = p
[2] = p
[3] = 0.0;
537 _mesa_TexEnvfv( target
, pname
, p
);
543 _mesa_TexEnvi( GLenum target
, GLenum pname
, GLint param
)
546 p
[0] = (GLfloat
) param
;
547 p
[1] = p
[2] = p
[3] = 0.0;
548 _mesa_TexEnvfv( target
, pname
, p
);
553 _mesa_TexEnviv( GLenum target
, GLenum pname
, const GLint
*param
)
556 if (pname
== GL_TEXTURE_ENV_COLOR
) {
557 p
[0] = INT_TO_FLOAT( param
[0] );
558 p
[1] = INT_TO_FLOAT( param
[1] );
559 p
[2] = INT_TO_FLOAT( param
[2] );
560 p
[3] = INT_TO_FLOAT( param
[3] );
563 p
[0] = (GLfloat
) param
[0];
564 p
[1] = p
[2] = p
[3] = 0; /* init to zero, just to be safe */
566 _mesa_TexEnvfv( target
, pname
, p
);
572 * Helper for glGetTexEnvi/f()
573 * \return value of queried pname or -1 if error.
576 get_texenvi(struct gl_context
*ctx
,
577 const struct gl_fixedfunc_texture_unit
*texUnit
,
581 case GL_TEXTURE_ENV_MODE
:
582 return texUnit
->EnvMode
;
585 return texUnit
->Combine
.ModeRGB
;
586 case GL_COMBINE_ALPHA
:
587 return texUnit
->Combine
.ModeA
;
590 case GL_SOURCE2_RGB
: {
591 const unsigned rgb_idx
= pname
- GL_SOURCE0_RGB
;
592 return texUnit
->Combine
.SourceRGB
[rgb_idx
];
594 case GL_SOURCE3_RGB_NV
:
595 if (ctx
->API
== API_OPENGL_COMPAT
&& ctx
->Extensions
.NV_texture_env_combine4
) {
596 return texUnit
->Combine
.SourceRGB
[3];
599 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
602 case GL_SOURCE0_ALPHA
:
603 case GL_SOURCE1_ALPHA
:
604 case GL_SOURCE2_ALPHA
: {
605 const unsigned alpha_idx
= pname
- GL_SOURCE0_ALPHA
;
606 return texUnit
->Combine
.SourceA
[alpha_idx
];
608 case GL_SOURCE3_ALPHA_NV
:
609 if (ctx
->API
== API_OPENGL_COMPAT
&& ctx
->Extensions
.NV_texture_env_combine4
) {
610 return texUnit
->Combine
.SourceA
[3];
613 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
616 case GL_OPERAND0_RGB
:
617 case GL_OPERAND1_RGB
:
618 case GL_OPERAND2_RGB
: {
619 const unsigned op_rgb
= pname
- GL_OPERAND0_RGB
;
620 return texUnit
->Combine
.OperandRGB
[op_rgb
];
622 case GL_OPERAND3_RGB_NV
:
623 if (ctx
->API
== API_OPENGL_COMPAT
&& ctx
->Extensions
.NV_texture_env_combine4
) {
624 return texUnit
->Combine
.OperandRGB
[3];
627 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
630 case GL_OPERAND0_ALPHA
:
631 case GL_OPERAND1_ALPHA
:
632 case GL_OPERAND2_ALPHA
: {
633 const unsigned op_alpha
= pname
- GL_OPERAND0_ALPHA
;
634 return texUnit
->Combine
.OperandA
[op_alpha
];
636 case GL_OPERAND3_ALPHA_NV
:
637 if (ctx
->API
== API_OPENGL_COMPAT
&& ctx
->Extensions
.NV_texture_env_combine4
) {
638 return texUnit
->Combine
.OperandA
[3];
641 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
645 return 1 << texUnit
->Combine
.ScaleShiftRGB
;
647 return 1 << texUnit
->Combine
.ScaleShiftA
;
649 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)");
653 return -1; /* error */
659 _mesa_GetTexEnvfv( GLenum target
, GLenum pname
, GLfloat
*params
)
662 GET_CURRENT_CONTEXT(ctx
);
664 maxUnit
= (target
== GL_POINT_SPRITE_NV
&& pname
== GL_COORD_REPLACE_NV
)
665 ? ctx
->Const
.MaxTextureCoordUnits
: ctx
->Const
.MaxCombinedTextureImageUnits
;
666 if (ctx
->Texture
.CurrentUnit
>= maxUnit
) {
667 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetTexEnvfv(current unit)");
671 if (target
== GL_TEXTURE_ENV
) {
672 struct gl_fixedfunc_texture_unit
*texUnit
=
673 _mesa_get_current_fixedfunc_tex_unit(ctx
);
675 /* The GL spec says that we should report an error if the unit is greater
676 * than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only
677 * fixed-function units are usable. This is probably a spec bug.
678 * Ignore calls for non-fixed-func units, because we don't process
679 * glTexEnv for them either.
684 if (pname
== GL_TEXTURE_ENV_COLOR
) {
685 if(ctx
->NewState
& (_NEW_BUFFERS
| _NEW_FRAG_CLAMP
))
686 _mesa_update_state(ctx
);
687 if (_mesa_get_clamp_fragment_color(ctx
, ctx
->DrawBuffer
))
688 COPY_4FV( params
, texUnit
->EnvColor
);
690 COPY_4FV( params
, texUnit
->EnvColorUnclamped
);
693 GLint val
= get_texenvi(ctx
, texUnit
, pname
);
695 *params
= (GLfloat
) val
;
699 else if (target
== GL_TEXTURE_FILTER_CONTROL_EXT
) {
700 const struct gl_texture_unit
*texUnit
= _mesa_get_current_tex_unit(ctx
);
702 if (pname
== GL_TEXTURE_LOD_BIAS_EXT
) {
703 *params
= texUnit
->LodBias
;
706 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)" );
710 else if (target
== GL_POINT_SPRITE_NV
) {
711 /* GL_ARB_point_sprite / GL_NV_point_sprite */
712 if (!ctx
->Extensions
.NV_point_sprite
713 && !ctx
->Extensions
.ARB_point_sprite
) {
714 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(target)" );
717 if (pname
== GL_COORD_REPLACE_NV
) {
718 if (ctx
->Point
.CoordReplace
& (1u << ctx
->Texture
.CurrentUnit
))
724 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(pname)" );
729 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnvfv(target)" );
736 _mesa_GetTexEnviv( GLenum target
, GLenum pname
, GLint
*params
)
739 GET_CURRENT_CONTEXT(ctx
);
741 maxUnit
= (target
== GL_POINT_SPRITE_NV
&& pname
== GL_COORD_REPLACE_NV
)
742 ? ctx
->Const
.MaxTextureCoordUnits
: ctx
->Const
.MaxCombinedTextureImageUnits
;
743 if (ctx
->Texture
.CurrentUnit
>= maxUnit
) {
744 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glGetTexEnviv(current unit)");
748 if (target
== GL_TEXTURE_ENV
) {
749 struct gl_fixedfunc_texture_unit
*texUnit
=
750 _mesa_get_current_fixedfunc_tex_unit(ctx
);
752 /* The GL spec says that we should report an error if the unit is greater
753 * than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only
754 * fixed-function units are usable. This is probably a spec bug.
755 * Ignore calls for non-fixed-func units, because we don't process
756 * glTexEnv for them either.
761 if (pname
== GL_TEXTURE_ENV_COLOR
) {
762 params
[0] = FLOAT_TO_INT( texUnit
->EnvColor
[0] );
763 params
[1] = FLOAT_TO_INT( texUnit
->EnvColor
[1] );
764 params
[2] = FLOAT_TO_INT( texUnit
->EnvColor
[2] );
765 params
[3] = FLOAT_TO_INT( texUnit
->EnvColor
[3] );
768 GLint val
= get_texenvi(ctx
, texUnit
, pname
);
774 else if (target
== GL_TEXTURE_FILTER_CONTROL_EXT
) {
775 const struct gl_texture_unit
*texUnit
= _mesa_get_current_tex_unit(ctx
);
777 if (pname
== GL_TEXTURE_LOD_BIAS_EXT
) {
778 *params
= (GLint
) texUnit
->LodBias
;
781 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(pname)" );
785 else if (target
== GL_POINT_SPRITE_NV
) {
786 /* GL_ARB_point_sprite / GL_NV_point_sprite */
787 if (!ctx
->Extensions
.NV_point_sprite
788 && !ctx
->Extensions
.ARB_point_sprite
) {
789 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(target)" );
792 if (pname
== GL_COORD_REPLACE_NV
) {
793 if (ctx
->Point
.CoordReplace
& (1u << ctx
->Texture
.CurrentUnit
))
799 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(pname)" );
804 _mesa_error( ctx
, GL_INVALID_ENUM
, "glGetTexEnviv(target)" );