1 /* $Id: hint.c,v 1.6 2000/12/26 05:09:28 keithw Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 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.
41 _mesa_Hint( GLenum target
, GLenum mode
)
43 GET_CURRENT_CONTEXT(ctx
);
44 ASSERT_OUTSIDE_BEGIN_END(ctx
);
45 (void) _mesa_try_Hint( ctx
, target
, mode
);
50 _mesa_try_Hint( GLcontext
*ctx
, GLenum target
, GLenum mode
)
52 if (MESA_VERBOSE
& VERBOSE_API
)
53 fprintf(stderr
, "glHint %s %d\n", gl_lookup_enum_by_nr(target
), mode
);
55 if (mode
!= GL_NICEST
&& mode
!= GL_FASTEST
&& mode
!= GL_DONT_CARE
) {
56 gl_error(ctx
, GL_INVALID_ENUM
, "glHint(mode)");
62 if (ctx
->Hint
.Fog
== mode
)
64 FLUSH_VERTICES(ctx
, _NEW_HINT
);
67 case GL_LINE_SMOOTH_HINT
:
68 if (ctx
->Hint
.LineSmooth
== mode
)
70 FLUSH_VERTICES(ctx
, _NEW_HINT
);
71 ctx
->Hint
.LineSmooth
= mode
;
73 case GL_PERSPECTIVE_CORRECTION_HINT
:
74 if (ctx
->Hint
.PerspectiveCorrection
== mode
)
76 FLUSH_VERTICES(ctx
, _NEW_HINT
);
77 ctx
->Hint
.PerspectiveCorrection
= mode
;
79 case GL_POINT_SMOOTH_HINT
:
80 if (ctx
->Hint
.PointSmooth
== mode
)
82 FLUSH_VERTICES(ctx
, _NEW_HINT
);
83 ctx
->Hint
.PointSmooth
= mode
;
85 case GL_POLYGON_SMOOTH_HINT
:
86 if (ctx
->Hint
.PolygonSmooth
== mode
)
88 FLUSH_VERTICES(ctx
, _NEW_HINT
);
89 ctx
->Hint
.PolygonSmooth
= mode
;
91 case GL_PREFER_DOUBLEBUFFER_HINT_PGI
:
92 case GL_STRICT_DEPTHFUNC_HINT_PGI
:
94 case GL_STRICT_LIGHTING_HINT_PGI
:
95 if (ctx
->Hint
.StrictLighting
== mode
)
97 FLUSH_VERTICES(ctx
, _NEW_HINT
);
98 ctx
->Hint
.StrictLighting
= mode
;
100 case GL_STRICT_SCISSOR_HINT_PGI
:
101 case GL_FULL_STIPPLE_HINT_PGI
:
102 case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI
:
103 case GL_NATIVE_GRAPHICS_END_HINT_PGI
:
104 case GL_CONSERVE_MEMORY_HINT_PGI
:
105 case GL_RECLAIM_MEMORY_HINT_PGI
:
107 case GL_ALWAYS_FAST_HINT_PGI
:
108 FLUSH_VERTICES(ctx
, _NEW_HINT
);
110 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
111 ctx
->Hint
.AllowDrawFrg
= GL_FALSE
;
112 ctx
->Hint
.AllowDrawMem
= GL_FALSE
;
114 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
115 ctx
->Hint
.AllowDrawFrg
= GL_TRUE
;
116 ctx
->Hint
.AllowDrawMem
= GL_TRUE
;
119 case GL_ALWAYS_SOFT_HINT_PGI
:
120 FLUSH_VERTICES(ctx
, _NEW_HINT
);
121 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
122 ctx
->Hint
.AllowDrawFrg
= GL_TRUE
;
123 ctx
->Hint
.AllowDrawMem
= GL_TRUE
;
125 case GL_ALLOW_DRAW_OBJ_HINT_PGI
:
127 case GL_ALLOW_DRAW_WIN_HINT_PGI
:
128 if (ctx
->Hint
.AllowDrawWin
== mode
)
130 FLUSH_VERTICES(ctx
, _NEW_HINT
);
131 ctx
->Hint
.AllowDrawWin
= mode
;
133 case GL_ALLOW_DRAW_FRG_HINT_PGI
:
134 if (ctx
->Hint
.AllowDrawFrg
== mode
)
136 FLUSH_VERTICES(ctx
, _NEW_HINT
);
137 ctx
->Hint
.AllowDrawFrg
= mode
;
139 case GL_ALLOW_DRAW_MEM_HINT_PGI
:
140 if (ctx
->Hint
.AllowDrawMem
== mode
)
142 FLUSH_VERTICES(ctx
, _NEW_HINT
);
143 ctx
->Hint
.AllowDrawMem
= mode
;
145 case GL_CLIP_NEAR_HINT_PGI
:
146 case GL_CLIP_FAR_HINT_PGI
:
147 case GL_WIDE_LINE_HINT_PGI
:
148 case GL_BACK_NORMALS_HINT_PGI
:
149 case GL_NATIVE_GRAPHICS_HANDLE_PGI
:
152 /* GL_EXT_clip_volume_hint */
153 case GL_CLIP_VOLUME_CLIPPING_HINT_EXT
:
154 if (ctx
->Hint
.ClipVolumeClipping
== mode
)
156 FLUSH_VERTICES(ctx
, _NEW_HINT
);
157 ctx
->Hint
.ClipVolumeClipping
= mode
;
160 /* GL_ARB_texture_compression */
161 case GL_TEXTURE_COMPRESSION_HINT_ARB
:
162 if (ctx
->Extensions
.ARB_texture_compression
) {
163 gl_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
166 if (ctx
->Hint
.TextureCompression
== mode
)
168 FLUSH_VERTICES(ctx
, _NEW_HINT
);
169 ctx
->Hint
.TextureCompression
= mode
;
173 gl_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
177 if (ctx
->Driver
.Hint
) {
178 (*ctx
->Driver
.Hint
)( ctx
, target
, mode
);
186 _mesa_HintPGI( GLenum target
, GLint mode
)
188 GET_CURRENT_CONTEXT(ctx
);
189 ASSERT_OUTSIDE_BEGIN_END(ctx
);
191 if (MESA_VERBOSE
& VERBOSE_API
)
192 fprintf(stderr
, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target
), mode
);
194 if (mode
!= GL_NICEST
&& mode
!= GL_FASTEST
&& mode
!= GL_DONT_CARE
) {
195 gl_error(ctx
, GL_INVALID_ENUM
, "glHintPGI(mode)");
200 case GL_PREFER_DOUBLEBUFFER_HINT_PGI
:
201 case GL_STRICT_DEPTHFUNC_HINT_PGI
:
202 case GL_STRICT_LIGHTING_HINT_PGI
:
203 case GL_STRICT_SCISSOR_HINT_PGI
:
204 case GL_FULL_STIPPLE_HINT_PGI
:
205 case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI
:
206 case GL_NATIVE_GRAPHICS_END_HINT_PGI
:
207 case GL_CONSERVE_MEMORY_HINT_PGI
:
208 case GL_RECLAIM_MEMORY_HINT_PGI
:
209 case GL_ALWAYS_FAST_HINT_PGI
:
210 case GL_ALWAYS_SOFT_HINT_PGI
:
211 case GL_ALLOW_DRAW_OBJ_HINT_PGI
:
212 case GL_ALLOW_DRAW_WIN_HINT_PGI
:
213 case GL_ALLOW_DRAW_FRG_HINT_PGI
:
214 case GL_ALLOW_DRAW_MEM_HINT_PGI
:
215 case GL_CLIP_NEAR_HINT_PGI
:
216 case GL_CLIP_FAR_HINT_PGI
:
217 case GL_WIDE_LINE_HINT_PGI
:
218 case GL_BACK_NORMALS_HINT_PGI
:
219 case GL_NATIVE_GRAPHICS_HANDLE_PGI
:
220 (void) _mesa_try_Hint(ctx
, target
, (GLenum
) mode
);
223 gl_error( ctx
, GL_INVALID_ENUM
, "glHintPGI(target)" );