use BCOPY macro on FreeBSD
[mesa.git] / src / mesa / main / enable.c
index aa6629007772ce5febda9714ee43b4063c0f498f..0e1a5781bddfed3a8e3a8ac71455a89769d5f62a 100644 (file)
@@ -1,8 +1,8 @@
-/* $Id: enable.c,v 1.8 1999/11/08 07:36:44 brianp Exp $ */
+/* $Id: enable.c,v 1.12 2000/03/11 23:23:26 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.1
+ * Version:  3.3
  * 
  * Copyright (C) 1999  Brian Paul   All Rights Reserved.
  * 
  */
 
 
-/* $XFree86: xc/lib/GL/mesa/src/enable.c,v 1.3 1999/04/04 00:20:23 dawes Exp $ */
-
 #ifdef PC_HEADER
 #include "all.h"
 #else
-#ifndef XFree86Server
-#include <stdio.h>
-#include <string.h>
-#else
-#include "GL/xf86glx.h"
-#endif
+#include "glheader.h"
 #include "context.h"
 #include "enable.h"
 #include "light.h"
@@ -54,7 +47,7 @@
 /*
  * Perform glEnable and glDisable calls.
  */
-void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
+void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
 {
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" );
 
@@ -123,6 +116,8 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
          if (ctx->Light.ColorMaterialEnabled!=state) {
             ctx->Light.ColorMaterialEnabled = state;
            ctx->NewState |= NEW_LIGHTING;
+            if (state)
+               gl_update_color_material( ctx, ctx->Current.ByteColor );
          }
         break;
       case GL_CULL_FACE:
@@ -333,8 +328,6 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
         break;
       case GL_SHARED_TEXTURE_PALETTE_EXT:
          ctx->Texture.SharedPalette = state;
-         if (ctx->Driver.UseGlobalTexturePalette)
-            (*ctx->Driver.UseGlobalTexturePalette)( ctx, state );
          break;
       case GL_STENCIL_TEST:
         if (state && ctx->Visual->StencilBits==0) {
@@ -458,6 +451,18 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
          ctx->Array.EdgeFlag.Enabled = state;
          break;
 
+      /* GL_HP_occlusion_test */
+      case GL_OCCLUSION_TEST_HP:
+         if (ctx->Extensions.HaveHpOcclusionTest) {
+            ctx->Depth.OcclusionTest = state;
+            ctx->NewState |= NEW_RASTER_OPS;
+         }
+         else {
+            gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+            return;
+         }
+         break;
+
       default:
         if (state) {
            gl_error( ctx, GL_INVALID_ENUM, "glEnable" );
@@ -476,22 +481,28 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
 
 
 
-void gl_Enable( GLcontext* ctx, GLenum cap )
+void
+_mesa_Enable( GLenum cap )
 {
-   gl_set_enable( ctx, cap, GL_TRUE );
+   GET_CURRENT_CONTEXT(ctx);
+   _mesa_set_enable( ctx, cap, GL_TRUE );
 }
 
 
 
-void gl_Disable( GLcontext* ctx, GLenum cap )
+void
+_mesa_Disable( GLenum cap )
 {
-   gl_set_enable( ctx, cap, GL_FALSE );
+   GET_CURRENT_CONTEXT(ctx);
+   _mesa_set_enable( ctx, cap, GL_FALSE );
 }
 
 
 
-GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap )
+GLboolean
+_mesa_IsEnabled( GLenum cap )
 {
+   GET_CURRENT_CONTEXT(ctx);
    switch (cap) {
       case GL_ALPHA_TEST:
          return ctx->Color.AlphaEnabled;
@@ -645,6 +656,17 @@ GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap )
          return ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
       case GL_EDGE_FLAG_ARRAY:
          return ctx->Array.EdgeFlag.Enabled;
+
+      /* GL_HP_occlusion_test */
+      case GL_OCCLUSION_TEST_HP:
+         if (ctx->Extensions.HaveHpOcclusionTest) {
+            return ctx->Depth.OcclusionTest;
+         }
+         else {
+            gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
+            return GL_FALSE;
+         }
+
       default:
         gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
         return GL_FALSE;
@@ -654,7 +676,8 @@ GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap )
 
 
 
-static void gl_client_state( GLcontext *ctx, GLenum cap, GLboolean state )
+static void
+client_state( GLcontext *ctx, GLenum cap, GLboolean state )
 {
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, 
                                       (state 
@@ -689,15 +712,19 @@ static void gl_client_state( GLcontext *ctx, GLenum cap, GLboolean state )
 
 
 
-void gl_EnableClientState( GLcontext *ctx, GLenum cap )
+void
+_mesa_EnableClientState( GLenum cap )
 {
-   gl_client_state( ctx, cap, GL_TRUE );
+   GET_CURRENT_CONTEXT(ctx);
+   client_state( ctx, cap, GL_TRUE );
 }
 
 
 
-void gl_DisableClientState( GLcontext *ctx, GLenum cap )
+void
+_mesa_DisableClientState( GLenum cap )
 {
-   gl_client_state( ctx, cap, GL_FALSE );
+   GET_CURRENT_CONTEXT(ctx);
+   client_state( ctx, cap, GL_FALSE );
 }