aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2000-03-17 15:32:04 +0000
committerBrian Paul <[email protected]>2000-03-17 15:32:04 +0000
commit39c897780276f80c2df82ada6c711b8d4d744391 (patch)
tree53c435d2594492faf2a0835429a35f6b4e9d465b /src/mesa
parent650cb74bcb913d2589355d56a14da1ab0307d1fc (diff)
added missing error checks
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/hint.c153
1 files changed, 82 insertions, 71 deletions
diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c
index eeed3f8afa0..3ea2a86181f 100644
--- a/src/mesa/main/hint.c
+++ b/src/mesa/main/hint.c
@@ -1,4 +1,4 @@
-/* $Id: hint.c,v 1.1 2000/02/02 19:14:56 brianp Exp $ */
+/* $Id: hint.c,v 1.2 2000/03/17 15:32:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -53,78 +53,84 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glHint %s %d\n", gl_lookup_enum_by_nr(target), mode);
- switch (target) {
- case GL_FOG_HINT:
- ctx->Hint.Fog = mode;
- break;
- case GL_LINE_SMOOTH_HINT:
- ctx->Hint.LineSmooth = mode;
- break;
- case GL_PERSPECTIVE_CORRECTION_HINT:
- ctx->Hint.PerspectiveCorrection = mode;
- break;
- case GL_POINT_SMOOTH_HINT:
- ctx->Hint.PointSmooth = mode;
- break;
- case GL_POLYGON_SMOOTH_HINT:
- ctx->Hint.PolygonSmooth = mode;
- break;
- case GL_PREFER_DOUBLEBUFFER_HINT_PGI:
- case GL_STRICT_DEPTHFUNC_HINT_PGI:
- break;
- case GL_STRICT_LIGHTING_HINT_PGI:
- ctx->Hint.StrictLighting = mode;
- break;
- case GL_STRICT_SCISSOR_HINT_PGI:
- case GL_FULL_STIPPLE_HINT_PGI:
- case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI:
- case GL_NATIVE_GRAPHICS_END_HINT_PGI:
- case GL_CONSERVE_MEMORY_HINT_PGI:
- case GL_RECLAIM_MEMORY_HINT_PGI:
- break;
- case GL_ALWAYS_FAST_HINT_PGI:
- if (mode) {
- ctx->Hint.AllowDrawWin = GL_TRUE;
- ctx->Hint.AllowDrawSpn = GL_FALSE;
- ctx->Hint.AllowDrawMem = GL_FALSE;
- } else {
- ctx->Hint.AllowDrawWin = GL_TRUE;
- ctx->Hint.AllowDrawSpn = GL_TRUE;
- ctx->Hint.AllowDrawMem = GL_TRUE;
- }
- break;
- case GL_ALWAYS_SOFT_HINT_PGI:
- ctx->Hint.AllowDrawWin = GL_TRUE;
- ctx->Hint.AllowDrawSpn = GL_TRUE;
- ctx->Hint.AllowDrawMem = GL_TRUE;
- break;
- case GL_ALLOW_DRAW_OBJ_HINT_PGI:
- break;
- case GL_ALLOW_DRAW_WIN_HINT_PGI:
- ctx->Hint.AllowDrawWin = mode;
- break;
- case GL_ALLOW_DRAW_SPN_HINT_PGI:
- ctx->Hint.AllowDrawSpn = mode;
- break;
- case GL_ALLOW_DRAW_MEM_HINT_PGI:
- ctx->Hint.AllowDrawMem = mode;
- break;
- case GL_CLIP_NEAR_HINT_PGI:
- case GL_CLIP_FAR_HINT_PGI:
- case GL_WIDE_LINE_HINT_PGI:
- case GL_BACK_NORMALS_HINT_PGI:
- case GL_NATIVE_GRAPHICS_HANDLE_PGI:
- break;
-
- /* GL_EXT_clip_volume_hint */
- case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
- ctx->Hint.ClipVolumeClipping = mode;
- break;
-
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glHint(target)" );
+ if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) {
+ gl_error(ctx, GL_INVALID_ENUM, "glHint(mode)");
return GL_FALSE;
}
+
+ switch (target) {
+ case GL_FOG_HINT:
+ ctx->Hint.Fog = mode;
+ break;
+ case GL_LINE_SMOOTH_HINT:
+ ctx->Hint.LineSmooth = mode;
+ break;
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ ctx->Hint.PerspectiveCorrection = mode;
+ break;
+ case GL_POINT_SMOOTH_HINT:
+ ctx->Hint.PointSmooth = mode;
+ break;
+ case GL_POLYGON_SMOOTH_HINT:
+ ctx->Hint.PolygonSmooth = mode;
+ break;
+ case GL_PREFER_DOUBLEBUFFER_HINT_PGI:
+ case GL_STRICT_DEPTHFUNC_HINT_PGI:
+ break;
+ case GL_STRICT_LIGHTING_HINT_PGI:
+ ctx->Hint.StrictLighting = mode;
+ break;
+ case GL_STRICT_SCISSOR_HINT_PGI:
+ case GL_FULL_STIPPLE_HINT_PGI:
+ case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI:
+ case GL_NATIVE_GRAPHICS_END_HINT_PGI:
+ case GL_CONSERVE_MEMORY_HINT_PGI:
+ case GL_RECLAIM_MEMORY_HINT_PGI:
+ break;
+ case GL_ALWAYS_FAST_HINT_PGI:
+ if (mode) {
+ ctx->Hint.AllowDrawWin = GL_TRUE;
+ ctx->Hint.AllowDrawSpn = GL_FALSE;
+ ctx->Hint.AllowDrawMem = GL_FALSE;
+ } else {
+ ctx->Hint.AllowDrawWin = GL_TRUE;
+ ctx->Hint.AllowDrawSpn = GL_TRUE;
+ ctx->Hint.AllowDrawMem = GL_TRUE;
+ }
+ break;
+ case GL_ALWAYS_SOFT_HINT_PGI:
+ ctx->Hint.AllowDrawWin = GL_TRUE;
+ ctx->Hint.AllowDrawSpn = GL_TRUE;
+ ctx->Hint.AllowDrawMem = GL_TRUE;
+ break;
+ case GL_ALLOW_DRAW_OBJ_HINT_PGI:
+ break;
+ case GL_ALLOW_DRAW_WIN_HINT_PGI:
+ ctx->Hint.AllowDrawWin = mode;
+ break;
+ case GL_ALLOW_DRAW_SPN_HINT_PGI:
+ ctx->Hint.AllowDrawSpn = mode;
+ break;
+ case GL_ALLOW_DRAW_MEM_HINT_PGI:
+ ctx->Hint.AllowDrawMem = mode;
+ break;
+ case GL_CLIP_NEAR_HINT_PGI:
+ case GL_CLIP_FAR_HINT_PGI:
+ case GL_WIDE_LINE_HINT_PGI:
+ case GL_BACK_NORMALS_HINT_PGI:
+ case GL_NATIVE_GRAPHICS_HANDLE_PGI:
+ break;
+
+ /* GL_EXT_clip_volume_hint */
+ case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
+ ctx->Hint.ClipVolumeClipping = mode;
+ break;
+
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glHint(target)" );
+ return GL_FALSE;
+ }
+
ctx->NewState |= NEW_ALL; /* just to be safe */
if (ctx->Driver.Hint) {
@@ -144,6 +150,11 @@ _mesa_HintPGI( GLenum target, GLint mode )
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target), mode);
+ if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) {
+ gl_error(ctx, GL_INVALID_ENUM, "glHintPGI(mode)");
+ return;
+ }
+
switch (target) {
case GL_PREFER_DOUBLEBUFFER_HINT_PGI:
case GL_STRICT_DEPTHFUNC_HINT_PGI: