mesa/main: make the FRAGMENT_PROGRAM 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>
Thu, 23 May 2019 09:35:55 +0000 (11:35 +0200)
IsEnabled(FRAGMENT_PROGRAM) isn't supposed to be allowed, but our
check allowed this anyway. Let's make these checks consistent, and
while we're at it, modernize them a bit.

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 09f33af..f92498b 100644 (file)
@@ -974,9 +974,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
          break;
 
       case GL_FRAGMENT_PROGRAM_ARB:
-         if (ctx->API != API_OPENGL_COMPAT)
+         if (!_mesa_has_ARB_fragment_program(ctx))
             goto invalid_enum_error;
-         CHECK_EXTENSION(ARB_fragment_program);
          if (ctx->FragmentProgram.Enabled == state)
             return;
          FLUSH_VERTICES(ctx, _NEW_PROGRAM);
@@ -1671,7 +1670,7 @@ _mesa_IsEnabled( GLenum cap )
          return ctx->Stencil.TestTwoSide;
 
       case GL_FRAGMENT_PROGRAM_ARB:
-         if (ctx->API != API_OPENGL_COMPAT)
+         if (!_mesa_has_ARB_fragment_program(ctx))
             goto invalid_enum_error;
          return ctx->FragmentProgram.Enabled;