summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/depth.c32
-rw-r--r--src/mesa/main/depth.h8
-rw-r--r--src/mesa/main/dlist.c32
-rw-r--r--src/mesa/main/enable.c19
-rw-r--r--src/mesa/main/extensions.c8
-rw-r--r--src/mesa/main/get.c44
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/state.c4
8 files changed, 138 insertions, 12 deletions
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
index 8383bcc608..9d95500fca 100644
--- a/src/mesa/main/depth.c
+++ b/src/mesa/main/depth.c
@@ -1,10 +1,8 @@
-/* $Id: depth.c,v 1.31 2002/10/24 23:57:20 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -116,3 +114,29 @@ _mesa_DepthMask( GLboolean flag )
if (ctx->Driver.DepthMask)
ctx->Driver.DepthMask( ctx, flag );
}
+
+
+
+/* GL_EXT_depth_bounds_test */
+void
+_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (zmin > zmax) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDepthBoundsEXT(zmin > zmax)");
+ return;
+ }
+
+ zmin = CLAMP(zmin, 0.0, 1.0);
+ zmax = CLAMP(zmax, 0.0, 1.0);
+
+ if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.BoundsMin = zmin;
+ ctx->Depth.BoundsMax = zmax;
+}
+
diff --git a/src/mesa/main/depth.h b/src/mesa/main/depth.h
index e9c2885b7f..b90d723b38 100644
--- a/src/mesa/main/depth.h
+++ b/src/mesa/main/depth.h
@@ -1,10 +1,8 @@
-/* $Id: depth.h,v 1.11 2001/03/12 00:48:37 gareth Exp $ */
-
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -48,6 +46,8 @@ extern void
_mesa_DepthMask( GLboolean flag );
+extern void
+_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax );
#endif
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index d47437face..4399385cc1 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -255,6 +255,8 @@ typedef enum {
OPCODE_PROGRAM_NAMED_PARAMETER_NV,
/* GL_EXT_stencil_two_side */
OPCODE_ACTIVE_STENCIL_FACE_EXT,
+ /* GL_EXT_depth_bounds_test */
+ OPCODE_DEPTH_BOUNDS_EXT,
/* The following three are meta instructions */
OPCODE_ERROR, /* raise compiled-in error */
OPCODE_CONTINUE,
@@ -671,6 +673,8 @@ void _mesa_init_lists( void )
InstSize[OPCODE_PROGRAM_NAMED_PARAMETER_NV] = 8;
/* GL_EXT_stencil_two_side */
InstSize[OPCODE_ACTIVE_STENCIL_FACE_EXT] = 2;
+ /* GL_EXT_depth_bounds_test */
+ InstSize[OPCODE_DEPTH_BOUNDS_EXT] = 3;
}
init_flag = 1;
}
@@ -4366,6 +4370,24 @@ static void save_ActiveStencilFaceEXT( GLenum face )
}
+/* GL_EXT_depth_bounds_test */
+static void save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 2 );
+ if (n) {
+ n[1].f = zmin;
+ n[2].f = zmax;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->DepthBoundsEXT)( zmin, zmax );
+ }
+}
+
+
+
/* KW: Compile commands
*
@@ -5107,6 +5129,13 @@ execute_list( GLcontext *ctx, GLuint list )
break;
#endif
+ case OPCODE_ACTIVE_STENCIL_FACE_EXT:
+ (*ctx->Exec->ActiveStencilFaceEXT)(n[1].e);
+ break;
+ case OPCODE_DEPTH_BOUNDS_EXT:
+ (*ctx->Exec->DepthBoundsEXT)(n[1].f, n[2].f);
+ break;
+
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
break;
@@ -6493,6 +6522,9 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
/* 268. GL_EXT_stencil_two_side */
table->ActiveStencilFaceEXT = save_ActiveStencilFaceEXT;
+ /* ???. GL_EXT_depth_bounds_test */
+ table->DepthBoundsEXT = save_DepthBoundsEXT;
+
/* ARB 1. GL_ARB_multitexture */
table->ActiveTextureARB = save_ActiveTextureARB;
table->ClientActiveTextureARB = exec_ClientActiveTextureARB;
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 5fe6549312..747c3f63c1 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -923,6 +923,20 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
break;
#endif /* FEATURE_ARB_fragment_program */
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION(EXT_depth_bounds_test, cap);
+ if (state && ctx->Visual.depthBits==0) {
+ _mesa_warning(ctx,
+ "glEnable(GL_DEPTH_BOUNDS_TEST_EXT) but no depth buffer");
+ return;
+ }
+ if (ctx->Depth.BoundsTest == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ ctx->Depth.BoundsTest = state;
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM,
"%s(0x%x)", state ? "glEnable" : "glDisable", cap);
@@ -1319,6 +1333,11 @@ _mesa_IsEnabled( GLenum cap )
return ctx->FragmentProgram.Enabled;
#endif /* FEATURE_ARB_fragment_program */
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION(EXT_depth_bounds_test);
+ return ctx->Depth.BoundsTest;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap);
return GL_FALSE;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 59ec4c22e4..2f5bc7588f 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -81,6 +81,7 @@ static struct {
{ ON, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) },
{ OFF, "GL_EXT_convolution", F(EXT_convolution) },
{ ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) },
+ { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) },
{ OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) },
{ OFF, "GL_EXT_histogram", F(EXT_histogram) },
{ OFF, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) },
@@ -148,6 +149,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
{
const char *extensions[] = {
"GL_ARB_depth_texture",
+#if FEATURE_ARB_fragment_program
+ "GL_ARB_fragment_program",
+#endif
"GL_ARB_imaging",
"GL_ARB_multitexture",
"GL_ARB_point_parameters",
@@ -160,6 +164,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
"GL_ARB_texture_env_crossbar",
"GL_ARB_texture_env_dot3",
"GL_ARB_texture_mirrored_repeat",
+#if FEATURE_ARB_vertex_program
+ "GL_ARB_vertex_program",
+#endif
"GL_ATI_texture_env_combine3",
"GL_ATI_texture_mirror_once",
"GL_EXT_blend_color",
@@ -168,6 +175,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
"GL_EXT_blend_minmax",
"GL_EXT_blend_subtract",
"GL_EXT_convolution",
+ "GL_EXT_depth_bounds_test",
"GL_EXT_fog_coord",
"GL_EXT_histogram",
"GL_EXT_paletted_texture",
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 65c41065cf..dd1c0016a9 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1593,6 +1593,17 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*/
#endif
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);
+ params[0] = FLOAT_TO_BOOL(ctx->Depth.BoundsMin);
+ params[1] = FLOAT_TO_BOOL(ctx->Depth.BoundsMax);
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
}
@@ -3079,6 +3090,17 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*/
#endif
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_D(EXT_depth_bounds_test, pname);
+ params[0] = (GLdouble) ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_D(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsMin;
+ params[1] = ctx->Depth.BoundsMax;
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev(pname=0x%x)", pname);
}
@@ -4541,6 +4563,17 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*/
#endif
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);
+ params[0] = (GLfloat) ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsMin;
+ params[1] = ctx->Depth.BoundsMax;
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(0x%x)", pname);
}
@@ -6041,6 +6074,17 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*/
#endif
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);
+ params[0] = (GLint) ctx->Depth.BoundsMin;
+ params[1] = (GLint) ctx->Depth.BoundsMax;
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index edea218095..b906ef4269 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -397,6 +397,8 @@ struct gl_depthbuffer_attrib {
GLboolean Test; /* Depth buffering enabled flag */
GLboolean Mask; /* Depth buffer writable? */
GLboolean OcclusionTest; /* GL_HP_occlusion_test */
+ GLboolean BoundsTest; /* GL_EXT_depth_bounds_test */
+ GLfloat BoundsMin, BoundsMax;/* GL_EXT_depth_bounds_test */
};
@@ -1466,6 +1468,7 @@ struct gl_extensions {
GLboolean EXT_clip_volume_hint;
GLboolean EXT_convolution;
GLboolean EXT_compiled_vertex_array;
+ GLboolean EXT_depth_bounds_test;
GLboolean EXT_fog_coord;
GLboolean EXT_histogram;
GLboolean EXT_multi_draw_arrays;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 96086624c9..f14c3f9d53 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,5 +1,3 @@
-/* $Id: state.c,v 1.105 2003/04/21 14:55:17 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -536,10 +534,8 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
/* 268. GL_EXT_stencil_two_side */
exec->ActiveStencilFaceEXT = _mesa_ActiveStencilFaceEXT;
-#if 0
/* ???. GL_EXT_depth_bounds_test */
exec->DepthBoundsEXT = _mesa_DepthBoundsEXT;
-#endif
/* ARB 1. GL_ARB_multitexture */
exec->ActiveTextureARB = _mesa_ActiveTextureARB;