mesa: Add custom get function for SCISSOR_TEST to _mesa_IsEnabledi
authorCourtney Goeltzenleuchter <courtney@LunarG.com>
Wed, 13 Nov 2013 20:22:39 +0000 (13:22 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 20 Jan 2014 19:32:00 +0000 (11:32 -0800)
Now that the scissor enable state is a bitfield need a custom function
to extract the correct value from gl_context.  Modeled
Scissor.EnableFlags after Color.BlendEnabled.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/enable.c

index a6246905e517b3cce5b59aaa5c04d1fe3e4fb18e..640db84906eceb72c3f3662241f61230ea0ed9cf 100644 (file)
@@ -1136,6 +1136,13 @@ _mesa_IsEnabledi( GLenum cap, GLuint index )
          return GL_FALSE;
       }
       return (ctx->Color.BlendEnabled >> index) & 1;
+   case GL_SCISSOR_TEST:
+      if (index >= ctx->Const.MaxViewports) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glIsEnabledIndexed(index=%u)",
+                     index);
+         return GL_FALSE;
+      }
+      return (ctx->Scissor.EnableFlags >> index) & 1;
    default:
       _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabledIndexed(cap=%s)",
                   _mesa_lookup_enum_by_nr(cap));