aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/enable.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-28 15:25:22 +0200
committermarha <marha@users.sourceforge.net>2011-09-28 15:25:22 +0200
commitc958cf29a8265091c4f68bb842a1d07c47e181fa (patch)
tree9cdba0da6a601cd16a9c34c544c51be1aa7075fc /mesalib/src/mesa/main/enable.c
parent756ccf7af09d35176962e44587244580c2cd0f22 (diff)
parent18a8f9f6839dfd899814a76a971e720c1e622236 (diff)
downloadvcxsrv-c958cf29a8265091c4f68bb842a1d07c47e181fa.tar.gz
vcxsrv-c958cf29a8265091c4f68bb842a1d07c47e181fa.tar.bz2
vcxsrv-c958cf29a8265091c4f68bb842a1d07c47e181fa.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main/enable.c')
-rw-r--r--mesalib/src/mesa/main/enable.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index 23b6a9480..689dc8a99 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -304,7 +304,10 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_CLIP_DISTANCE6:
case GL_CLIP_DISTANCE7:
{
- const GLuint p = cap - GL_CLIP_PLANE0;
+ const GLuint p = cap - GL_CLIP_DISTANCE0;
+
+ if (p >= ctx->Const.MaxClipPlanes)
+ goto invalid_enum_error;
if ((ctx->Transform.ClipPlanesEnabled & (1 << p))
== ((GLuint) state << p))
@@ -1084,13 +1087,21 @@ _mesa_IsEnabled( GLenum cap )
return ctx->Eval.AutoNormal;
case GL_BLEND:
return ctx->Color.BlendEnabled & 1; /* return state for buffer[0] */
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1;
+ case GL_CLIP_DISTANCE0:
+ case GL_CLIP_DISTANCE1:
+ case GL_CLIP_DISTANCE2:
+ case GL_CLIP_DISTANCE3:
+ case GL_CLIP_DISTANCE4:
+ case GL_CLIP_DISTANCE5:
+ case GL_CLIP_DISTANCE6:
+ case GL_CLIP_DISTANCE7: {
+ const GLuint p = cap - GL_CLIP_DISTANCE0;
+
+ if (p >= ctx->Const.MaxClipPlanes)
+ goto invalid_enum_error;
+
+ return (ctx->Transform.ClipPlanesEnabled >> p) & 1;
+ }
case GL_COLOR_MATERIAL:
return ctx->Light.ColorMaterialEnabled;
case GL_CULL_FACE: