1 /* $Id: hint.c,v 1.14 2002/10/24 23:57:21 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 _mesa_Hint( GLenum target
, GLenum mode
)
39 GET_CURRENT_CONTEXT(ctx
);
40 ASSERT_OUTSIDE_BEGIN_END(ctx
);
42 if (MESA_VERBOSE
& VERBOSE_API
)
43 _mesa_debug(ctx
, "glHint %s %d\n",
44 _mesa_lookup_enum_by_nr(target
), mode
);
46 if (mode
!= GL_NICEST
&& mode
!= GL_FASTEST
&& mode
!= GL_DONT_CARE
) {
47 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(mode)");
53 if (ctx
->Hint
.Fog
== mode
)
55 FLUSH_VERTICES(ctx
, _NEW_HINT
);
58 case GL_LINE_SMOOTH_HINT
:
59 if (ctx
->Hint
.LineSmooth
== mode
)
61 FLUSH_VERTICES(ctx
, _NEW_HINT
);
62 ctx
->Hint
.LineSmooth
= mode
;
64 case GL_PERSPECTIVE_CORRECTION_HINT
:
65 if (ctx
->Hint
.PerspectiveCorrection
== mode
)
67 FLUSH_VERTICES(ctx
, _NEW_HINT
);
68 ctx
->Hint
.PerspectiveCorrection
= mode
;
70 case GL_POINT_SMOOTH_HINT
:
71 if (ctx
->Hint
.PointSmooth
== mode
)
73 FLUSH_VERTICES(ctx
, _NEW_HINT
);
74 ctx
->Hint
.PointSmooth
= mode
;
76 case GL_POLYGON_SMOOTH_HINT
:
77 if (ctx
->Hint
.PolygonSmooth
== mode
)
79 FLUSH_VERTICES(ctx
, _NEW_HINT
);
80 ctx
->Hint
.PolygonSmooth
= mode
;
83 /* GL_EXT_clip_volume_hint */
84 case GL_CLIP_VOLUME_CLIPPING_HINT_EXT
:
85 if (ctx
->Hint
.ClipVolumeClipping
== mode
)
87 FLUSH_VERTICES(ctx
, _NEW_HINT
);
88 ctx
->Hint
.ClipVolumeClipping
= mode
;
91 /* GL_ARB_texture_compression */
92 case GL_TEXTURE_COMPRESSION_HINT_ARB
:
93 if (!ctx
->Extensions
.ARB_texture_compression
) {
94 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
97 if (ctx
->Hint
.TextureCompression
== mode
)
99 FLUSH_VERTICES(ctx
, _NEW_HINT
);
100 ctx
->Hint
.TextureCompression
= mode
;
103 /* GL_SGIS_generate_mipmap */
104 case GL_GENERATE_MIPMAP_HINT_SGIS
:
105 if (!ctx
->Extensions
.SGIS_generate_mipmap
) {
106 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
109 if (ctx
->Hint
.GenerateMipmap
== mode
)
111 FLUSH_VERTICES(ctx
, _NEW_HINT
);
112 ctx
->Hint
.GenerateMipmap
= mode
;
116 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
120 if (ctx
->Driver
.Hint
) {
121 (*ctx
->Driver
.Hint
)( ctx
, target
, mode
);