summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/attrib.c7
-rw-r--r--src/mesa/main/enable.c20
-rw-r--r--src/mesa/main/extensions.c2
-rw-r--r--src/mesa/main/get_gen.py4
-rw-r--r--src/mesa/main/mtypes.h2
5 files changed, 35 insertions, 0 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index ab99ca1c64..0fb8fa3bba 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -74,6 +74,7 @@ struct gl_enable_attrib
GLboolean Convolution2D;
GLboolean Separable2D;
GLboolean CullFace;
+ GLboolean DepthClamp;
GLboolean DepthTest;
GLboolean Dither;
GLboolean Fog;
@@ -265,6 +266,7 @@ _mesa_PushAttrib(GLbitfield mask)
attr->Convolution2D = ctx->Pixel.Convolution2DEnabled;
attr->Separable2D = ctx->Pixel.Separable2DEnabled;
attr->CullFace = ctx->Polygon.CullFlag;
+ attr->DepthClamp = ctx->Transform.DepthClamp;
attr->DepthTest = ctx->Depth.Test;
attr->Dither = ctx->Color.DitherFlag;
attr->Fog = ctx->Fog.Enabled;
@@ -514,6 +516,8 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
enable->ColorTable[COLORTABLE_POSTCOLORMATRIX],
GL_POST_COLOR_MATRIX_COLOR_TABLE);
TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
+ TEST_AND_UPDATE(ctx->Transform.DepthClamp, enable->DepthClamp,
+ GL_DEPTH_CLAMP);
TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D,
@@ -1221,6 +1225,9 @@ _mesa_PopAttrib(void)
if (xform->RescaleNormals != ctx->Transform.RescaleNormals)
_mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT,
ctx->Transform.RescaleNormals);
+ if (xform->DepthClamp != ctx->Transform.DepthClamp)
+ _mesa_set_enable(ctx, GL_DEPTH_CLAMP,
+ ctx->Transform.DepthClamp);
}
break;
case GL_TEXTURE_BIT:
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 4bc54771e9..d066153fc2 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -37,6 +37,7 @@
#include "mtypes.h"
#include "enums.h"
#include "math/m_matrix.h"
+#include "math/m_xform.h"
#include "api_arrayelt.h"
@@ -947,6 +948,20 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
ctx->Depth.BoundsTest = state;
break;
+ case GL_DEPTH_CLAMP:
+ if (ctx->Transform.DepthClamp == state)
+ return;
+ /* Neither the x86 nor sparc asm cliptest functions have been updated
+ * for ARB_depth_clamp, so force the C paths.
+ */
+ if (state)
+ init_c_cliptest();
+
+ CHECK_EXTENSION(ARB_depth_clamp, cap);
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ ctx->Transform.DepthClamp = state;
+ break;
+
#if FEATURE_ATI_fragment_shader
case GL_FRAGMENT_SHADER_ATI:
CHECK_EXTENSION(ATI_fragment_shader, cap);
@@ -1395,6 +1410,11 @@ _mesa_IsEnabled( GLenum cap )
CHECK_EXTENSION(EXT_depth_bounds_test);
return ctx->Depth.BoundsTest;
+ /* GL_ARB_depth_clamp */
+ case GL_DEPTH_CLAMP:
+ CHECK_EXTENSION(ARB_depth_clamp);
+ return ctx->Transform.DepthClamp;
+
#if FEATURE_ATI_fragment_shader
case GL_FRAGMENT_SHADER_ATI:
CHECK_EXTENSION(ATI_fragment_shader);
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index e3070b1547..ea67f820af 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -47,6 +47,7 @@ static const struct {
} default_extensions[] = {
{ OFF, "GL_ARB_copy_buffer", F(ARB_copy_buffer) },
{ OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) },
+ { OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) },
{ ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) },
{ OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) },
{ OFF, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow) },
@@ -192,6 +193,7 @@ void
_mesa_enable_sw_extensions(GLcontext *ctx)
{
ctx->Extensions.ARB_copy_buffer = GL_TRUE;
+ ctx->Extensions.ARB_depth_clamp = GL_TRUE;
ctx->Extensions.ARB_depth_texture = GL_TRUE;
/*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
#if FEATURE_ARB_fragment_program
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 2878c1b552..364d8c55c4 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -905,6 +905,10 @@ StateVars = [
["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"],
"", ["EXT_depth_bounds_test"] ),
+ # GL_ARB_depth_clamp
+ ( "GL_DEPTH_CLAMP", GLboolean, ["ctx->Transform.DepthClamp"], "",
+ ["ARB_depth_clamp"] ),
+
# GL_ARB_draw_buffers
( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
["ctx->Const.MaxDrawBuffers"], "", None ),
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 6b64bf8139..20cd3aa5c0 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1482,6 +1482,7 @@ struct gl_transform_attrib
GLboolean Normalize; /**< Normalize all normals? */
GLboolean RescaleNormals; /**< GL_EXT_rescale_normal */
GLboolean RasterPositionUnclipped; /**< GL_IBM_rasterpos_clip */
+ GLboolean DepthClamp; /**< GL_ARB_depth_clamp */
GLboolean CullVertexFlag; /**< True if GL_CULL_VERTEX_EXT is enabled */
GLfloat CullEyePos[4];
@@ -2475,6 +2476,7 @@ struct gl_extensions
GLboolean dummy; /* don't remove this! */
GLboolean ARB_copy_buffer;
GLboolean ARB_depth_texture;
+ GLboolean ARB_depth_clamp;
GLboolean ARB_draw_buffers;
GLboolean ARB_fragment_program;
GLboolean ARB_fragment_program_shadow;