summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/mesa/main/enable.c25
-rw-r--r--src/mesa/main/extensions.c6
-rw-r--r--src/mesa/main/get.c82
-rw-r--r--src/mesa/main/state.c14
5 files changed, 120 insertions, 11 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b1d922f651..64d236ee51 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.45 2000/03/06 17:03:03 brianp Exp $ */
+/* $Id: context.c,v 1.46 2000/03/11 23:23:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -864,6 +864,7 @@ static void init_attrib_groups( GLcontext *ctx )
ctx->Depth.Clear = 1.0;
ctx->Depth.Func = GL_LESS;
ctx->Depth.Mask = GL_TRUE;
+ ctx->Depth.OcclusionTest = GL_FALSE;
/* Evaluators group */
ctx->Eval.Map1Color4 = GL_FALSE;
@@ -1227,6 +1228,7 @@ static void init_attrib_groups( GLcontext *ctx )
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
ctx->CatchSignals = GL_TRUE;
+ ctx->OcclusionResult = GL_FALSE;
/* For debug/development only */
ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE;
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 94defaad74..0e1a5781bd 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.11 2000/03/07 18:24:49 brianp Exp $ */
+/* $Id: enable.c,v 1.12 2000/03/11 23:23:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -451,6 +451,18 @@ void _mesa_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" );
@@ -644,6 +656,17 @@ _mesa_IsEnabled( 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;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index b6ff6d1293..f60ae01de9 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.19 2000/03/07 17:54:58 brianp Exp $ */
+/* $Id: extensions.c,v 1.20 2000/03/11 23:23:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -77,7 +77,8 @@ static struct { int enabled; const char *name; } default_extensions[] = {
{ ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" },
{ DEFAULT_OFF, "GL_EXT_vertex_array_set" },
{ DEFAULT_OFF, "GL_EXT_texture_env" },
- { DEFAULT_ON, "GL_EXT_texture_lod_bias" }
+ { DEFAULT_ON, "GL_EXT_texture_lod_bias" },
+ { DEFAULT_OFF, "GL_HP_occlusion_test" }
};
@@ -90,6 +91,7 @@ update_extension_flags( GLcontext *ctx )
/* Update flags */
ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add");
ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias");
+ ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test");
}
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 8a352aa799..4fd83dbd38 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.14 2000/02/24 22:04:03 brianp Exp $ */
+/* $Id: get.c,v 1.15 2000/03/11 23:23:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1012,8 +1012,26 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
}
break;
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ *params = ctx->Depth.OcclusionTest;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
+ }
+ return;
+ case GL_OCCLUSION_TEST_RESULT_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ *params = ctx->OcclusionResult;
+ ctx->OcclusionResult = GL_FALSE; /* reset now */
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
+ }
+ return;
+
default:
- printf("invalid enum: %x\n", pname);
gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
}
}
@@ -1975,8 +1993,26 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
}
break;
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ *params = (GLdouble) ctx->Depth.OcclusionTest;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
+ }
+ return;
+ case GL_OCCLUSION_TEST_RESULT_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ *params = (GLdouble) ctx->OcclusionResult;
+ ctx->OcclusionResult = GL_FALSE; /* reset now */
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
+ }
+ return;
+
default:
- printf("invalid enum: %x\n", pname);
gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
}
}
@@ -2915,8 +2951,26 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
gl_matrix_transposef(params, ctx->TextureMatrix[texTransformUnit].m);
break;
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ *params = (GLfloat) ctx->Depth.OcclusionTest;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
+ }
+ return;
+ case GL_OCCLUSION_TEST_RESULT_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ *params = (GLfloat) ctx->OcclusionResult;
+ ctx->OcclusionResult = GL_FALSE; /* reset now */
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
+ }
+ return;
+
default:
- printf("invalid enum: %x\n", pname);
gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
}
}
@@ -3878,8 +3932,26 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
}
break;
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ *params = (GLint) ctx->Depth.OcclusionTest;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
+ return;
+ case GL_OCCLUSION_TEST_RESULT_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ *params = (GLint) ctx->OcclusionResult;
+ ctx->OcclusionResult = GL_FALSE; /* reset now */
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
+ }
+ return;
+
default:
- printf("invalid enum: %x\n", pname);
gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
}
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 667953a65c..d82ffa5744 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.4 2000/02/24 22:04:03 brianp Exp $ */
+/* $Id: state.c,v 1.5 2000/03/11 23:23:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -791,11 +791,21 @@ static void update_rasterflags( GLcontext *ctx )
ctx->RasterMask |= WINCLIP_BIT;
}
+ if (ctx->Depth.OcclusionTest) {
+ if (ctx->Color.ColorMask[0] == 0 &&
+ ctx->Color.ColorMask[1] == 0 &&
+ ctx->Color.ColorMask[2] == 0 &&
+ ctx->Color.ColorMask[3] == 0 &&
+ ctx->Depth.Mask == GL_FALSE &&
+ !ctx->Stencil.Enabled) {
+ ctx->RasterMask |= OCCLUSION_BIT;
+ }
+ }
+
/* If we're not drawing to exactly one color buffer set the
* MULTI_DRAW_BIT flag. Also set it if we're drawing to no
* buffers or the RGBA or CI mask disables all writes.
*/
-
ctx->TriangleCaps &= ~DD_MULTIDRAW;
if (ctx->Color.MultiDrawBuffer) {