3 * Mesa 3-D graphics library
6 * Copyright (C) 1999-2002 Brian Paul 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.
37 _mesa_Hint( GLenum target, GLenum mode )
39 GET_CURRENT_CONTEXT(ctx);
41 if (MESA_VERBOSE & VERBOSE_API)
42 _mesa_debug(ctx, "glHint %s %s\n",
43 _mesa_lookup_enum_by_nr(target),
44 _mesa_lookup_enum_by_nr(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->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
55 if (ctx->Hint.Fog == mode)
57 FLUSH_VERTICES(ctx, _NEW_HINT);
60 case GL_LINE_SMOOTH_HINT:
61 if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
63 if (ctx->Hint.LineSmooth == mode)
65 FLUSH_VERTICES(ctx, _NEW_HINT);
66 ctx->Hint.LineSmooth = mode;
68 case GL_PERSPECTIVE_CORRECTION_HINT:
69 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
71 if (ctx->Hint.PerspectiveCorrection == mode)
73 FLUSH_VERTICES(ctx, _NEW_HINT);
74 ctx->Hint.PerspectiveCorrection = mode;
76 case GL_POINT_SMOOTH_HINT:
77 if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
79 if (ctx->Hint.PointSmooth == mode)
81 FLUSH_VERTICES(ctx, _NEW_HINT);
82 ctx->Hint.PointSmooth = mode;
84 case GL_POLYGON_SMOOTH_HINT:
85 if (!_mesa_is_desktop_gl(ctx))
87 if (ctx->Hint.PolygonSmooth == mode)
89 FLUSH_VERTICES(ctx, _NEW_HINT);
90 ctx->Hint.PolygonSmooth = mode;
93 /* GL_EXT_clip_volume_hint */
94 case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
95 if (ctx->API != API_OPENGL_COMPAT)
97 if (ctx->Hint.ClipVolumeClipping == mode)
99 FLUSH_VERTICES(ctx, _NEW_HINT);
100 ctx->Hint.ClipVolumeClipping = mode;
103 /* GL_ARB_texture_compression */
104 case GL_TEXTURE_COMPRESSION_HINT_ARB:
105 if (!_mesa_is_desktop_gl(ctx))
107 if (ctx->Hint.TextureCompression == mode)
109 FLUSH_VERTICES(ctx, _NEW_HINT);
110 ctx->Hint.TextureCompression = mode;
113 /* GL_SGIS_generate_mipmap */
114 case GL_GENERATE_MIPMAP_HINT_SGIS:
115 if (ctx->API == API_OPENGL_CORE)
117 if (ctx->Hint.GenerateMipmap == mode)
119 FLUSH_VERTICES(ctx, _NEW_HINT);
120 ctx->Hint.GenerateMipmap = mode;
123 /* GL_ARB_fragment_shader */
124 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
125 if (ctx->API == API_OPENGLES || !ctx->Extensions.ARB_fragment_shader)
127 if (ctx->Hint.FragmentShaderDerivative == mode)
129 FLUSH_VERTICES(ctx, _NEW_HINT);
130 ctx->Hint.FragmentShaderDerivative = mode;
137 if (ctx->Driver.Hint) {
138 (*ctx->Driver.Hint)( ctx, target, mode );
144 _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
149 /**********************************************************************/
150 /***** Initialization *****/
151 /**********************************************************************/
153 void _mesa_init_hint( struct gl_context * ctx )
156 ctx->Hint.PerspectiveCorrection = GL_DONT_CARE;
157 ctx->Hint.PointSmooth = GL_DONT_CARE;
158 ctx->Hint.LineSmooth = GL_DONT_CARE;
159 ctx->Hint.PolygonSmooth = GL_DONT_CARE;
160 ctx->Hint.Fog = GL_DONT_CARE;
161 ctx->Hint.ClipVolumeClipping = GL_DONT_CARE;
162 ctx->Hint.TextureCompression = GL_DONT_CARE;
163 ctx->Hint.GenerateMipmap = GL_DONT_CARE;
164 ctx->Hint.FragmentShaderDerivative = GL_DONT_CARE;