aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/enable.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/enable.c')
-rw-r--r--mesalib/src/mesa/main/enable.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index 4a00440ab..12ce14c5d 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -36,8 +36,8 @@
#include "simple_list.h"
#include "mtypes.h"
#include "enums.h"
-#include "math/m_matrix.h"
#include "api_arrayelt.h"
+#include "texstate.h"
@@ -55,46 +55,47 @@
static void
client_state(GLcontext *ctx, GLenum cap, GLboolean state)
{
+ struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
GLuint flag;
GLboolean *var;
switch (cap) {
case GL_VERTEX_ARRAY:
- var = &ctx->Array.ArrayObj->Vertex.Enabled;
+ var = &arrayObj->Vertex.Enabled;
flag = _NEW_ARRAY_VERTEX;
break;
case GL_NORMAL_ARRAY:
- var = &ctx->Array.ArrayObj->Normal.Enabled;
+ var = &arrayObj->Normal.Enabled;
flag = _NEW_ARRAY_NORMAL;
break;
case GL_COLOR_ARRAY:
- var = &ctx->Array.ArrayObj->Color.Enabled;
+ var = &arrayObj->Color.Enabled;
flag = _NEW_ARRAY_COLOR0;
break;
case GL_INDEX_ARRAY:
- var = &ctx->Array.ArrayObj->Index.Enabled;
+ var = &arrayObj->Index.Enabled;
flag = _NEW_ARRAY_INDEX;
break;
case GL_TEXTURE_COORD_ARRAY:
- var = &ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled;
+ var = &arrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled;
flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture);
break;
case GL_EDGE_FLAG_ARRAY:
- var = &ctx->Array.ArrayObj->EdgeFlag.Enabled;
+ var = &arrayObj->EdgeFlag.Enabled;
flag = _NEW_ARRAY_EDGEFLAG;
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
- var = &ctx->Array.ArrayObj->FogCoord.Enabled;
+ var = &arrayObj->FogCoord.Enabled;
flag = _NEW_ARRAY_FOGCOORD;
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
- var = &ctx->Array.ArrayObj->SecondaryColor.Enabled;
+ var = &arrayObj->SecondaryColor.Enabled;
flag = _NEW_ARRAY_COLOR1;
break;
#if FEATURE_point_size_array
case GL_POINT_SIZE_ARRAY_OES:
- var = &ctx->Array.ArrayObj->PointSize.Enabled;
+ var = &arrayObj->PointSize.Enabled;
flag = _NEW_ARRAY_POINT_SIZE;
break;
#endif
@@ -120,7 +121,7 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state)
{
GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib));
- var = &ctx->Array.ArrayObj->VertexAttrib[n].Enabled;
+ var = &arrayObj->VertexAttrib[n].Enabled;
flag = _NEW_ARRAY_ATTRIB(n);
}
break;
@@ -229,8 +230,7 @@ get_texcoord_unit(GLcontext *ctx)
static GLboolean
enable_texture(GLcontext *ctx, GLboolean state, GLbitfield texBit)
{
- const GLuint curr = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
const GLbitfield newenabled = state
? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit);
@@ -942,6 +942,14 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
ctx->Depth.BoundsTest = state;
break;
+ case GL_DEPTH_CLAMP:
+ if (ctx->Transform.DepthClamp == state)
+ return;
+ 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);
@@ -1390,6 +1398,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);