Undo some of yesterday's ATI_separate_stencil changes. The ATI extension

doesn't exactly match OpenGL 2.0.
This commit is contained in:
Brian Paul
2006-11-02 22:39:29 +00:00
parent d78f65cd6c
commit e812081253
3 changed files with 52 additions and 52 deletions

View File

@@ -135,7 +135,6 @@ static const struct {
{ OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)}, { 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_texture_mirror_once", F(ATI_texture_mirror_once)},
{ OFF, "GL_ATI_fragment_shader", F(ATI_fragment_shader)}, { 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) }, { OFF, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) },
{ ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) }, { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
{ OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
@@ -223,7 +222,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
#endif #endif
ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE; ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
ctx->Extensions.ATI_texture_mirror_once = 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_color = GL_TRUE;
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
ctx->Extensions.EXT_blend_func_separate = GL_TRUE; ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
@@ -390,7 +388,6 @@ _mesa_enable_2_0_extensions(GLcontext *ctx)
#if FEATURE_ARB_shading_language_100 #if FEATURE_ARB_shading_language_100
ctx->Extensions.ARB_shading_language_100 = GL_TRUE; ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
#endif #endif
ctx->Extensions.ATI_separate_stencil = GL_TRUE;
ctx->Extensions.EXT_stencil_two_side = GL_FALSE; /* obsolete */ ctx->Extensions.EXT_stencil_two_side = GL_FALSE; /* obsolete */
#if FEATURE_ARB_vertex_shader #if FEATURE_ARB_vertex_shader
ctx->Extensions.ARB_vertex_shader = GL_TRUE; ctx->Extensions.ARB_vertex_shader = GL_TRUE;

View File

@@ -2477,7 +2477,6 @@ struct gl_extensions
GLboolean ATI_texture_mirror_once; GLboolean ATI_texture_mirror_once;
GLboolean ATI_texture_env_combine3; GLboolean ATI_texture_env_combine3;
GLboolean ATI_fragment_shader; GLboolean ATI_fragment_shader;
GLboolean ATI_separate_stencil;
GLboolean IBM_rasterpos_clip; GLboolean IBM_rasterpos_clip;
GLboolean IBM_multimode_draw_arrays; GLboolean IBM_multimode_draw_arrays;
GLboolean MESA_pack_invert; GLboolean MESA_pack_invert;

View File

@@ -1,8 +1,8 @@
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.5 * Version: 6.5.2
* *
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -38,6 +38,10 @@
* *
* So either we advertise the GL_EXT_stencil_two_side extension, or OpenGL * So either we advertise the GL_EXT_stencil_two_side extension, or OpenGL
* 2.0, but not both. * 2.0, but not both.
*
* Also, note that GL_ATI_separate_stencil is different as well:
* glStencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, ...) vs.
* glStencilFuncSeparate(GLenum face, GLenum func, ...).
*/ */
@@ -115,7 +119,23 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
ref = CLAMP( ref, 0, stencilMax ); ref = CLAMP( ref, 0, stencilMax );
if (ctx->Extensions.ATI_separate_stencil) { 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 {
/* set both front and back state */ /* set both front and back state */
if (ctx->Stencil.Function[0] == func && if (ctx->Stencil.Function[0] == func &&
ctx->Stencil.Function[1] == func && ctx->Stencil.Function[1] == func &&
@@ -133,22 +153,6 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
func, ref, 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,18 +173,7 @@ _mesa_StencilMask( GLuint mask )
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx);
if (ctx->Extensions.ATI_separate_stencil) { if (ctx->Extensions.EXT_stencil_two_side) {
/* 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[0] = ctx->Stencil.WriteMask[1] = mask;
if (ctx->Driver.StencilMaskSeparate) {
ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask);
}
}
else {
/* only set active face state */ /* only set active face state */
const GLint face = ctx->Stencil.ActiveFace; const GLint face = ctx->Stencil.ActiveFace;
if (ctx->Stencil.WriteMask[face] == mask) if (ctx->Stencil.WriteMask[face] == mask)
@@ -191,6 +184,17 @@ _mesa_StencilMask( GLuint mask )
ctx->Driver.StencilMaskSeparate(ctx, face ? GL_BACK : GL_FRONT, mask); ctx->Driver.StencilMaskSeparate(ctx, face ? GL_BACK : GL_FRONT, mask);
} }
} }
else {
/* 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[0] = ctx->Stencil.WriteMask[1] = mask;
if (ctx->Driver.StencilMaskSeparate) {
ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask);
}
}
} }
@@ -269,7 +273,23 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
return; return;
} }
if (ctx->Extensions.ATI_separate_stencil) { 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 {
/* set both front and back state */ /* set both front and back state */
if (ctx->Stencil.ZFailFunc[0] == zfail && if (ctx->Stencil.ZFailFunc[0] == zfail &&
ctx->Stencil.ZFailFunc[1] == zfail && ctx->Stencil.ZFailFunc[1] == zfail &&
@@ -287,22 +307,6 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
fail, zfail, 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);
}
}
} }