mesa/main: make the PRIMITIVE_RESTART_NV checks consistent
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 25 Feb 2019 11:06:23 +0000 (12:06 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 29 May 2019 08:54:09 +0000 (10:54 +0200)
{En,Dis}ableClientState(PRIMITIVE_RESTART_NV) should only work on
compatibility contextxs. While we're at it, modernize the code a bit,
by using the extension helpers instead of open-coding.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/enable.c

index dc9c77cfb8623ee63243489dde1811e7a9332ab5..ce64e037906fc35e4d6f0e95698e9325561d0cdf 100644 (file)
@@ -107,7 +107,7 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
 
       /* GL_NV_primitive_restart */
       case GL_PRIMITIVE_RESTART_NV:
-         if (!ctx->Extensions.NV_primitive_restart)
+         if (!_mesa_has_NV_primitive_restart(ctx))
             goto invalid_enum_error;
          if (ctx->Array.PrimitiveRestart == state)
             return;
@@ -1721,9 +1721,8 @@ _mesa_IsEnabled( GLenum cap )
 
       /* GL_NV_primitive_restart */
       case GL_PRIMITIVE_RESTART_NV:
-         if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.NV_primitive_restart) {
+         if (!_mesa_has_NV_primitive_restart(ctx))
             goto invalid_enum_error;
-         }
          return ctx->Array.PrimitiveRestart;
 
       /* GL 3.1 primitive restart */