summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_noop.c2
-rw-r--r--src/mesa/main/arrayobj.c9
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/mesa/main/enable.c2
-rw-r--r--src/mesa/main/extensions.c7
-rw-r--r--src/mesa/main/get.c6
-rw-r--r--src/mesa/main/get_gen.py2
-rw-r--r--src/mesa/main/getstring.c4
-rw-r--r--src/mesa/main/mtypes.h21
-rw-r--r--src/mesa/main/state.c4
-rw-r--r--src/mesa/main/stencil.c101
-rw-r--r--src/mesa/main/texcompress_s3tc.c2
12 files changed, 76 insertions, 88 deletions
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index 33d44e4329..0c1a35361f 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -45,7 +45,7 @@
static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
{
GET_CURRENT_CONTEXT(ctx);
- ctx->Current.EdgeFlag = b;
+ ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] = (GLfloat)b;
}
static void GLAPIENTRY _mesa_noop_Indexf( GLfloat f )
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 852b9aaee9..d601ee461e 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -114,40 +114,34 @@ _mesa_initialize_array_object( GLcontext *ctx,
obj->Vertex.StrideB = 0;
obj->Vertex.Ptr = NULL;
obj->Vertex.Enabled = GL_FALSE;
- obj->Vertex.Flags = CA_CLIENT_DATA;
obj->Normal.Type = GL_FLOAT;
obj->Normal.Stride = 0;
obj->Normal.StrideB = 0;
obj->Normal.Ptr = NULL;
obj->Normal.Enabled = GL_FALSE;
- obj->Normal.Flags = CA_CLIENT_DATA;
obj->Color.Size = 4;
obj->Color.Type = GL_FLOAT;
obj->Color.Stride = 0;
obj->Color.StrideB = 0;
obj->Color.Ptr = NULL;
obj->Color.Enabled = GL_FALSE;
- obj->Color.Flags = CA_CLIENT_DATA;
obj->SecondaryColor.Size = 4;
obj->SecondaryColor.Type = GL_FLOAT;
obj->SecondaryColor.Stride = 0;
obj->SecondaryColor.StrideB = 0;
obj->SecondaryColor.Ptr = NULL;
obj->SecondaryColor.Enabled = GL_FALSE;
- obj->SecondaryColor.Flags = CA_CLIENT_DATA;
obj->FogCoord.Size = 1;
obj->FogCoord.Type = GL_FLOAT;
obj->FogCoord.Stride = 0;
obj->FogCoord.StrideB = 0;
obj->FogCoord.Ptr = NULL;
obj->FogCoord.Enabled = GL_FALSE;
- obj->FogCoord.Flags = CA_CLIENT_DATA;
obj->Index.Type = GL_FLOAT;
obj->Index.Stride = 0;
obj->Index.StrideB = 0;
obj->Index.Ptr = NULL;
obj->Index.Enabled = GL_FALSE;
- obj->Index.Flags = CA_CLIENT_DATA;
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
obj->TexCoord[i].Size = 4;
obj->TexCoord[i].Type = GL_FLOAT;
@@ -155,13 +149,11 @@ _mesa_initialize_array_object( GLcontext *ctx,
obj->TexCoord[i].StrideB = 0;
obj->TexCoord[i].Ptr = NULL;
obj->TexCoord[i].Enabled = GL_FALSE;
- obj->TexCoord[i].Flags = CA_CLIENT_DATA;
}
obj->EdgeFlag.Stride = 0;
obj->EdgeFlag.StrideB = 0;
obj->EdgeFlag.Ptr = NULL;
obj->EdgeFlag.Enabled = GL_FALSE;
- obj->EdgeFlag.Flags = CA_CLIENT_DATA;
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
obj->VertexAttrib[i].Size = 4;
obj->VertexAttrib[i].Type = GL_FLOAT;
@@ -170,7 +162,6 @@ _mesa_initialize_array_object( GLcontext *ctx,
obj->VertexAttrib[i].Ptr = NULL;
obj->VertexAttrib[i].Enabled = GL_FALSE;
obj->VertexAttrib[i].Normalized = GL_FALSE;
- obj->VertexAttrib[i].Flags = CA_CLIENT_DATA;
}
#if FEATURE_ARB_vertex_buffer_object
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index c8acc6b55c..91f3af3c91 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -971,8 +971,8 @@ _mesa_init_current( GLcontext *ctx )
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 );
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = 1.0;
- ctx->Current.EdgeFlag = GL_TRUE;
+ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX], 1.0, 0.0, 0.0, 1.0 );
+ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG], 1.0, 0.0, 0.0, 1.0 );
}
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 91268b596d..bf86e6db7d 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -53,7 +53,7 @@ static void
client_state( GLcontext *ctx, GLenum cap, GLboolean state )
{
GLuint flag;
- GLuint *var;
+ GLboolean *var;
switch (cap) {
case GL_VERTEX_ARRAY:
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 5edf9a7dd6..39f8e26f57 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -135,6 +135,7 @@ static const struct {
{ OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)},
{ OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)},
{ OFF, "GL_ATI_fragment_shader", F(ATI_fragment_shader)},
+ { OFF, "GL_ATI_separate_stencil", F(ATI_separate_stencil)},
{ OFF, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) },
{ ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
{ OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
@@ -222,6 +223,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
#endif
ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
ctx->Extensions.ATI_texture_mirror_once = GL_TRUE;
+ ctx->Extensions.ATI_separate_stencil = GL_TRUE;
ctx->Extensions.EXT_blend_color = GL_TRUE;
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
@@ -249,7 +251,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
ctx->Extensions.EXT_secondary_color = GL_TRUE;
ctx->Extensions.EXT_shared_texture_palette = GL_TRUE;
ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
- ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
+ ctx->Extensions.EXT_stencil_two_side = GL_FALSE; /* obsolete */
ctx->Extensions.EXT_texture_env_add = GL_TRUE;
ctx->Extensions.EXT_texture_env_combine = GL_TRUE;
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
@@ -388,7 +390,8 @@ _mesa_enable_2_0_extensions(GLcontext *ctx)
#if FEATURE_ARB_shading_language_100
ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
#endif
- ctx->Extensions.EXT_stencil_two_side = GL_FALSE; /* yes, turn it off */
+ ctx->Extensions.ATI_separate_stencil = GL_TRUE;
+ ctx->Extensions.EXT_stencil_two_side = GL_FALSE; /* obsolete */
#if FEATURE_ARB_vertex_shader
ctx->Extensions.ARB_vertex_shader = GL_TRUE;
#endif
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 9185a03943..9f3a8d12cf 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -323,7 +323,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_EDGE_FLAG:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = ctx->Current.EdgeFlag;
+ params[0] = (ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0);
}
break;
case GL_FEEDBACK_BUFFER_SIZE:
@@ -2147,7 +2147,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_EDGE_FLAG:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = BOOLEAN_TO_FLOAT(ctx->Current.EdgeFlag);
+ params[0] = BOOLEAN_TO_FLOAT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
}
break;
case GL_FEEDBACK_BUFFER_SIZE:
@@ -3971,7 +3971,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_EDGE_FLAG:
{
FLUSH_CURRENT(ctx, 0);
- params[0] = BOOLEAN_TO_INT(ctx->Current.EdgeFlag);
+ params[0] = BOOLEAN_TO_INT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
}
break;
case GL_FEEDBACK_BUFFER_SIZE:
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 4555bbb5f9..50ff13d2f9 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -190,7 +190,7 @@ StateVars = [
( "GL_DOUBLEBUFFER", GLboolean,
["ctx->DrawBuffer->Visual.doubleBufferMode"], "", None ),
( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
- ( "GL_EDGE_FLAG", GLboolean, ["ctx->Current.EdgeFlag"],
+ ( "GL_EDGE_FLAG", GLboolean, ["(ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)"],
"FLUSH_CURRENT(ctx, 0);", None ),
( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", None ),
( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", None ),
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index a68bf9ff74..f2989aaefa 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -54,7 +54,7 @@ _mesa_GetString( GLenum name )
static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING;
static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING;
static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING;
- static const char *version_2_0 = "1.5 Mesa " MESA_VERSION_STRING;/*XXX FIX*/
+ static const char *version_2_0 = "1.5 Mesa " MESA_VERSION_STRING;
#if FEATURE_ARB_shading_language_100
static const char *sl_version_110 = "1.10 Mesa " MESA_VERSION_STRING;
@@ -111,7 +111,7 @@ _mesa_GetString( GLenum name )
if (ctx->Extensions.ARB_draw_buffers &&
ctx->Extensions.ARB_point_sprite &&
ctx->Extensions.ARB_texture_non_power_of_two &&
- ctx->Extensions.EXT_stencil_two_side) {
+ ctx->Extensions.ATI_separate_stencil) {
return (const GLubyte *) version_2_0;
}
else {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 1399dddf50..1d5eb61e06 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -143,7 +143,7 @@ enum
VERT_ATTRIB_COLOR1 = 4,
VERT_ATTRIB_FOG = 5,
VERT_ATTRIB_COLOR_INDEX = 6,
- VERT_ATTRIB_SEVEN = 7,
+ VERT_ATTRIB_EDGEFLAG = 7,
VERT_ATTRIB_TEX0 = 8,
VERT_ATTRIB_TEX1 = 9,
VERT_ATTRIB_TEX2 = 10,
@@ -183,7 +183,7 @@ enum
#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
#define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX)
-#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN)
+#define VERT_BIT_EDGEFLAG (1 << VERT_ATTRIB_EDGEFLAG)
#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
@@ -616,11 +616,11 @@ struct gl_current_attrib
/**
* \name Current vertex attributes.
* \note Values are valid only after FLUSH_VERTICES has been called.
+ * \note Index and Edgeflag current values are stored as floats in the
+ * SIX and SEVEN attribute slots.
*/
/*@{*/
GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Position, color, texcoords, etc */
- GLfloat Index; /**< Current color index */
- GLboolean EdgeFlag; /**< Current edge flag */
/*@}*/
/**
@@ -1640,8 +1640,6 @@ struct gl_pixelstore_attrib
};
-#define CA_CLIENT_DATA 0x1 /**< Data not allocated by mesa */
-
/**
* Client vertex array attributes
@@ -1653,14 +1651,12 @@ struct gl_client_array
GLsizei Stride; /**< user-specified stride */
GLsizei StrideB; /**< actual stride in bytes */
const GLubyte *Ptr; /**< Points to array data */
- GLbitfield Enabled; /**< one of the _NEW_ARRAY_ bits */
+ GLboolean Enabled; /**< Enabled flag is a boolean */
GLboolean Normalized; /**< GL_ARB_vertex_program */
/**< GL_ARB_vertex_buffer_object */
struct gl_buffer_object *BufferObj;
GLuint _MaxElement;
-
- GLbitfield Flags;
};
@@ -1681,8 +1677,8 @@ struct gl_array_object
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
- struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array EdgeFlag;
+ struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
/*@}*/
/** Generic arrays for vertex programs/shaders */
@@ -2477,6 +2473,7 @@ struct gl_extensions
GLboolean ATI_texture_mirror_once;
GLboolean ATI_texture_env_combine3;
GLboolean ATI_fragment_shader;
+ GLboolean ATI_separate_stencil;
GLboolean IBM_rasterpos_clip;
GLboolean IBM_multimode_draw_arrays;
GLboolean MESA_pack_invert;
@@ -2610,7 +2607,7 @@ struct matrix_stack
#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1
#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG
#define _NEW_ARRAY_INDEX VERT_BIT_COLOR_INDEX
-#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN
+#define _NEW_ARRAY_EDGEFLAG VERT_BIT_EDGEFLAG
#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0
#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1
#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2
@@ -2619,7 +2616,7 @@ struct matrix_stack
#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
-#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */
+#define _NEW_ARRAY_ATTRIB_0 VERT_BIT_GENERIC0 /* start at bit 16 */
#define _NEW_ARRAY_ALL 0xffffffff
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 8bc4036c98..06cf5f8698 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -887,8 +887,8 @@ update_arrays( GLcontext *ctx )
/* 7 */
if (ctx->VertexProgram._Enabled
- && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_SEVEN].Enabled) {
- min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_SEVEN]._MaxElement);
+ && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
+ min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]._MaxElement);
}
/* 8..15 */
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index 9992ec9b6e..d6be410e76 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -115,23 +115,7 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
ref = CLAMP( ref, 0, stencilMax );
- if (ctx->Extensions.EXT_stencil_two_side) {
- /* only set active face state */
- const GLint face = ctx->Stencil.ActiveFace;
- if (ctx->Stencil.Function[face] == func &&
- ctx->Stencil.ValueMask[face] == mask &&
- ctx->Stencil.Ref[face] == ref)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.Function[face] = func;
- ctx->Stencil.Ref[face] = ref;
- ctx->Stencil.ValueMask[face] = mask;
- if (ctx->Driver.StencilFuncSeparate) {
- ctx->Driver.StencilFuncSeparate(ctx, face ? GL_BACK : GL_FRONT,
- func, ref, mask);
- }
- }
- else {
+ if (ctx->Extensions.ATI_separate_stencil) {
/* set both front and back state */
if (ctx->Stencil.Function[0] == func &&
ctx->Stencil.Function[1] == func &&
@@ -149,6 +133,22 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
func, ref, mask);
}
}
+ else {
+ /* only set active face state */
+ const GLint face = ctx->Stencil.ActiveFace;
+ if (ctx->Stencil.Function[face] == func &&
+ ctx->Stencil.ValueMask[face] == mask &&
+ ctx->Stencil.Ref[face] == ref)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.Function[face] = func;
+ ctx->Stencil.Ref[face] = ref;
+ ctx->Stencil.ValueMask[face] = mask;
+ if (ctx->Driver.StencilFuncSeparate) {
+ ctx->Driver.StencilFuncSeparate(ctx, face ? GL_BACK : GL_FRONT,
+ func, ref, mask);
+ }
+ }
}
@@ -169,26 +169,26 @@ _mesa_StencilMask( GLuint mask )
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (ctx->Extensions.EXT_stencil_two_side) {
- /* only set active face state */
- const GLint face = ctx->Stencil.ActiveFace;
- if (ctx->Stencil.WriteMask[face] == mask)
+ if (ctx->Extensions.ATI_separate_stencil) {
+ /* set both front and back state */
+ if (ctx->Stencil.WriteMask[0] == mask &&
+ ctx->Stencil.WriteMask[1] == mask)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.WriteMask[face] = mask;
+ ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask;
if (ctx->Driver.StencilMaskSeparate) {
- ctx->Driver.StencilMaskSeparate(ctx, face ? GL_BACK : GL_FRONT, mask);
+ ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask);
}
}
else {
- /* set both front and back state */
- if (ctx->Stencil.WriteMask[0] == mask &&
- ctx->Stencil.WriteMask[1] == mask)
+ /* only set active face state */
+ const GLint face = ctx->Stencil.ActiveFace;
+ if (ctx->Stencil.WriteMask[face] == mask)
return;
FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask;
+ ctx->Stencil.WriteMask[face] = mask;
if (ctx->Driver.StencilMaskSeparate) {
- ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask);
+ ctx->Driver.StencilMaskSeparate(ctx, face ? GL_BACK : GL_FRONT, mask);
}
}
}
@@ -269,23 +269,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
return;
}
- if (ctx->Extensions.EXT_stencil_two_side) {
- /* only set active face state */
- const GLint face = ctx->Stencil.ActiveFace;
- if (ctx->Stencil.ZFailFunc[face] == zfail &&
- ctx->Stencil.ZPassFunc[face] == zpass &&
- ctx->Stencil.FailFunc[face] == fail)
- return;
- FLUSH_VERTICES(ctx, _NEW_STENCIL);
- ctx->Stencil.ZFailFunc[face] = zfail;
- ctx->Stencil.ZPassFunc[face] = zpass;
- ctx->Stencil.FailFunc[face] = fail;
- if (ctx->Driver.StencilOpSeparate) {
- ctx->Driver.StencilOpSeparate(ctx, face ? GL_BACK : GL_FRONT,
- fail, zfail, zpass);
- }
- }
- else {
+ if (ctx->Extensions.ATI_separate_stencil) {
/* set both front and back state */
if (ctx->Stencil.ZFailFunc[0] == zfail &&
ctx->Stencil.ZFailFunc[1] == zfail &&
@@ -303,6 +287,22 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
fail, zfail, zpass);
}
}
+ else {
+ /* only set active face state */
+ const GLint face = ctx->Stencil.ActiveFace;
+ if (ctx->Stencil.ZFailFunc[face] == zfail &&
+ ctx->Stencil.ZPassFunc[face] == zpass &&
+ ctx->Stencil.FailFunc[face] == fail)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_STENCIL);
+ ctx->Stencil.ZFailFunc[face] = zfail;
+ ctx->Stencil.ZPassFunc[face] = zpass;
+ ctx->Stencil.FailFunc[face] = fail;
+ if (ctx->Driver.StencilOpSeparate) {
+ ctx->Driver.StencilOpSeparate(ctx, face ? GL_BACK : GL_FRONT,
+ fail, zfail, zpass);
+ }
+ }
}
@@ -406,17 +406,16 @@ _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
FLUSH_VERTICES(ctx, _NEW_STENCIL);
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK) {
+ if (face != GL_BACK) {
ctx->Stencil.FailFunc[0] = fail;
ctx->Stencil.ZFailFunc[0] = zfail;
ctx->Stencil.ZPassFunc[0] = zpass;
}
- if (face == GL_BACK || face == GL_FRONT_AND_BACK) {
+ if (face != GL_FRONT) {
ctx->Stencil.FailFunc[1] = fail;
ctx->Stencil.ZFailFunc[1] = zfail;
ctx->Stencil.ZPassFunc[1] = zpass;
}
-
if (ctx->Driver.StencilOpSeparate) {
ctx->Driver.StencilOpSeparate(ctx, face, fail, zfail, zpass);
}
@@ -465,7 +464,6 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
ctx->Stencil.Ref[1] = ref;
ctx->Stencil.ValueMask[1] = mask;
}
-
if (ctx->Driver.StencilFuncSeparate) {
ctx->Driver.StencilFuncSeparate(ctx, face, func, ref, mask);
}
@@ -486,13 +484,12 @@ _mesa_StencilMaskSeparate(GLenum face, GLuint mask)
FLUSH_VERTICES(ctx, _NEW_STENCIL);
- if (face == GL_FRONT || face == GL_FRONT_AND_BACK) {
+ if (face != GL_BACK) {
ctx->Stencil.WriteMask[0] = mask;
}
- if (face == GL_BACK || face == GL_FRONT_AND_BACK) {
+ if (face != GL_FRONT) {
ctx->Stencil.WriteMask[1] = mask;
}
-
if (ctx->Driver.StencilMaskSeparate) {
ctx->Driver.StencilMaskSeparate(ctx, face, mask);
}
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 99b703de4a..c71501c5e6 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -91,7 +91,7 @@ _mesa_dlopen(const char *libname, int flags)
return dlopen(libname, flags);
#endif
#else
- return (GenericFunc) NULL;
+ return (void *) NULL;
#endif /* USE_EXTERNAL_DXTN_LIB */
}