1 /* $Id: hint.c,v 1.5 2000/10/30 13:32:00 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 (void) _mesa_try_Hint( ctx
, target
, mode
);
49 _mesa_try_Hint( GLcontext
*ctx
, GLenum target
, GLenum mode
)
51 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glHint", GL_FALSE
);
53 if (MESA_VERBOSE
& VERBOSE_API
)
54 fprintf(stderr
, "glHint %s %d\n", gl_lookup_enum_by_nr(target
), mode
);
56 if (mode
!= GL_NICEST
&& mode
!= GL_FASTEST
&& mode
!= GL_DONT_CARE
) {
57 gl_error(ctx
, GL_INVALID_ENUM
, "glHint(mode)");
65 case GL_LINE_SMOOTH_HINT
:
66 ctx
->Hint
.LineSmooth
= mode
;
68 case GL_PERSPECTIVE_CORRECTION_HINT
:
69 ctx
->Hint
.PerspectiveCorrection
= mode
;
71 case GL_POINT_SMOOTH_HINT
:
72 ctx
->Hint
.PointSmooth
= mode
;
74 case GL_POLYGON_SMOOTH_HINT
:
75 ctx
->Hint
.PolygonSmooth
= mode
;
77 case GL_PREFER_DOUBLEBUFFER_HINT_PGI
:
78 case GL_STRICT_DEPTHFUNC_HINT_PGI
:
80 case GL_STRICT_LIGHTING_HINT_PGI
:
81 ctx
->Hint
.StrictLighting
= mode
;
83 case GL_STRICT_SCISSOR_HINT_PGI
:
84 case GL_FULL_STIPPLE_HINT_PGI
:
85 case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI
:
86 case GL_NATIVE_GRAPHICS_END_HINT_PGI
:
87 case GL_CONSERVE_MEMORY_HINT_PGI
:
88 case GL_RECLAIM_MEMORY_HINT_PGI
:
90 case GL_ALWAYS_FAST_HINT_PGI
:
92 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
93 ctx
->Hint
.AllowDrawFrg
= GL_FALSE
;
94 ctx
->Hint
.AllowDrawMem
= GL_FALSE
;
96 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
97 ctx
->Hint
.AllowDrawFrg
= GL_TRUE
;
98 ctx
->Hint
.AllowDrawMem
= GL_TRUE
;
101 case GL_ALWAYS_SOFT_HINT_PGI
:
102 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
103 ctx
->Hint
.AllowDrawFrg
= GL_TRUE
;
104 ctx
->Hint
.AllowDrawMem
= GL_TRUE
;
106 case GL_ALLOW_DRAW_OBJ_HINT_PGI
:
108 case GL_ALLOW_DRAW_WIN_HINT_PGI
:
109 ctx
->Hint
.AllowDrawWin
= mode
;
111 case GL_ALLOW_DRAW_FRG_HINT_PGI
:
112 ctx
->Hint
.AllowDrawFrg
= mode
;
114 case GL_ALLOW_DRAW_MEM_HINT_PGI
:
115 ctx
->Hint
.AllowDrawMem
= mode
;
117 case GL_CLIP_NEAR_HINT_PGI
:
118 case GL_CLIP_FAR_HINT_PGI
:
119 case GL_WIDE_LINE_HINT_PGI
:
120 case GL_BACK_NORMALS_HINT_PGI
:
121 case GL_NATIVE_GRAPHICS_HANDLE_PGI
:
124 /* GL_EXT_clip_volume_hint */
125 case GL_CLIP_VOLUME_CLIPPING_HINT_EXT
:
126 ctx
->Hint
.ClipVolumeClipping
= mode
;
129 /* GL_ARB_texture_compression */
130 case GL_TEXTURE_COMPRESSION_HINT_ARB
:
131 if (ctx
->Extensions
.ARB_texture_compression
) {
132 ctx
->Hint
.TextureCompression
= mode
;
135 gl_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
140 gl_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
144 ctx
->NewState
|= _NEW_HINT
;
146 if (ctx
->Driver
.Hint
) {
147 (*ctx
->Driver
.Hint
)( ctx
, target
, mode
);
155 _mesa_HintPGI( GLenum target
, GLint mode
)
157 GET_CURRENT_CONTEXT(ctx
);
158 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glHintPGI");
160 if (MESA_VERBOSE
& VERBOSE_API
)
161 fprintf(stderr
, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target
), mode
);
163 if (mode
!= GL_NICEST
&& mode
!= GL_FASTEST
&& mode
!= GL_DONT_CARE
) {
164 gl_error(ctx
, GL_INVALID_ENUM
, "glHintPGI(mode)");
169 case GL_PREFER_DOUBLEBUFFER_HINT_PGI
:
170 case GL_STRICT_DEPTHFUNC_HINT_PGI
:
171 case GL_STRICT_LIGHTING_HINT_PGI
:
172 case GL_STRICT_SCISSOR_HINT_PGI
:
173 case GL_FULL_STIPPLE_HINT_PGI
:
174 case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI
:
175 case GL_NATIVE_GRAPHICS_END_HINT_PGI
:
176 case GL_CONSERVE_MEMORY_HINT_PGI
:
177 case GL_RECLAIM_MEMORY_HINT_PGI
:
178 case GL_ALWAYS_FAST_HINT_PGI
:
179 case GL_ALWAYS_SOFT_HINT_PGI
:
180 case GL_ALLOW_DRAW_OBJ_HINT_PGI
:
181 case GL_ALLOW_DRAW_WIN_HINT_PGI
:
182 case GL_ALLOW_DRAW_FRG_HINT_PGI
:
183 case GL_ALLOW_DRAW_MEM_HINT_PGI
:
184 case GL_CLIP_NEAR_HINT_PGI
:
185 case GL_CLIP_FAR_HINT_PGI
:
186 case GL_WIDE_LINE_HINT_PGI
:
187 case GL_BACK_NORMALS_HINT_PGI
:
188 case GL_NATIVE_GRAPHICS_HANDLE_PGI
:
189 (void) _mesa_try_Hint(ctx
, target
, (GLenum
) mode
);
192 gl_error( ctx
, GL_INVALID_ENUM
, "glHintPGI(target)" );