From efe6c50089e945902917c8091c92ce3a6155caac Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 18 Jun 2007 17:53:09 -0600 Subject: [PATCH] Define just one set of PIPE_FUNC_LESS, GREATER, EQUAL, etc tokens. Used for depth test, alpha test, stencil test, shadow test, etc. --- src/mesa/pipe/p_defines.h | 30 ++++++++++-------------- src/mesa/state_tracker/st_atom_depth.c | 16 ++++++------- src/mesa/state_tracker/st_atom_stencil.c | 16 ++++++------- 3 files changed, 28 insertions(+), 34 deletions(-) diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h index 1ca717e7ec4..11b70175b0d 100644 --- a/src/mesa/pipe/p_defines.h +++ b/src/mesa/pipe/p_defines.h @@ -71,14 +71,18 @@ #define PIPE_LOGICOP_OR 14 #define PIPE_LOGICOP_SET 15 -#define PIPE_STENCIL_FUNC_NEVER 0 -#define PIPE_STENCIL_FUNC_LESS 1 -#define PIPE_STENCIL_FUNC_EQUAL 2 -#define PIPE_STENCIL_FUNC_LEQUAL 3 -#define PIPE_STENCIL_FUNC_GREATER 4 -#define PIPE_STENCIL_FUNC_NOTEQUAL 5 -#define PIPE_STENCIL_FUNC_GEQUAL 6 -#define PIPE_STENCIL_FUNC_ALWAYS 7 +/** + * Inequality functions. Used for depth test, stencil compare, alpha + * test, shadow compare, etc. + */ +#define PIPE_FUNC_NEVER 0 +#define PIPE_FUNC_LESS 1 +#define PIPE_FUNC_EQUAL 2 +#define PIPE_FUNC_LEQUAL 3 +#define PIPE_FUNC_GREATER 4 +#define PIPE_FUNC_NOTEQUAL 5 +#define PIPE_FUNC_GEQUAL 6 +#define PIPE_FUNC_ALWAYS 7 #define PIPE_STENCIL_OP_KEEP 0 #define PIPE_STENCIL_OP_ZERO 1 @@ -89,16 +93,6 @@ #define PIPE_STENCIL_OP_DECR_WRAP 6 #define PIPE_STENCIL_OP_INVERT 7 -/* Note: same as stencil funcs. Also used for shadow/depth compare */ -#define PIPE_DEPTH_FUNC_NEVER 0 -#define PIPE_DEPTH_FUNC_LESS 1 -#define PIPE_DEPTH_FUNC_EQUAL 2 -#define PIPE_DEPTH_FUNC_LEQUAL 3 -#define PIPE_DEPTH_FUNC_GREATER 4 -#define PIPE_DEPTH_FUNC_NOTEQUAL 5 -#define PIPE_DEPTH_FUNC_GEQUAL 6 -#define PIPE_DEPTH_FUNC_ALWAYS 7 - #define PIPE_TEX_WRAP_REPEAT 0 #define PIPE_TEX_WRAP_CLAMP 1 #define PIPE_TEX_WRAP_CLAMP_TO_EDGE 2 diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index 4c891e6e542..a1523e06c21 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -45,14 +45,14 @@ static GLuint gl_depth_func_to_sp(GLenum func) { /* Same values, just biased */ - assert(PIPE_DEPTH_FUNC_NEVER == GL_NEVER - GL_NEVER); - assert(PIPE_DEPTH_FUNC_LESS == GL_LESS - GL_NEVER); - assert(PIPE_DEPTH_FUNC_EQUAL == GL_EQUAL - GL_NEVER); - assert(PIPE_DEPTH_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER); - assert(PIPE_DEPTH_FUNC_GREATER == GL_GREATER - GL_NEVER); - assert(PIPE_DEPTH_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER); - assert(PIPE_DEPTH_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER); - assert(PIPE_DEPTH_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER); + assert(PIPE_FUNC_NEVER == GL_NEVER - GL_NEVER); + assert(PIPE_FUNC_LESS == GL_LESS - GL_NEVER); + assert(PIPE_FUNC_EQUAL == GL_EQUAL - GL_NEVER); + assert(PIPE_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER); + assert(PIPE_FUNC_GREATER == GL_GREATER - GL_NEVER); + assert(PIPE_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER); + assert(PIPE_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER); + assert(PIPE_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER); assert(func >= GL_NEVER); assert(func <= GL_ALWAYS); return func - GL_NEVER; diff --git a/src/mesa/state_tracker/st_atom_stencil.c b/src/mesa/state_tracker/st_atom_stencil.c index b9f24f49e66..d037335e9e2 100644 --- a/src/mesa/state_tracker/st_atom_stencil.c +++ b/src/mesa/state_tracker/st_atom_stencil.c @@ -45,14 +45,14 @@ static GLuint gl_stencil_func_to_sp(GLenum func) { /* Same values, just biased */ - assert(PIPE_STENCIL_FUNC_NEVER == GL_NEVER - GL_NEVER); - assert(PIPE_STENCIL_FUNC_LESS == GL_LESS - GL_NEVER); - assert(PIPE_STENCIL_FUNC_EQUAL == GL_EQUAL - GL_NEVER); - assert(PIPE_STENCIL_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER); - assert(PIPE_STENCIL_FUNC_GREATER == GL_GREATER - GL_NEVER); - assert(PIPE_STENCIL_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER); - assert(PIPE_STENCIL_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER); - assert(PIPE_STENCIL_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER); + assert(PIPE_FUNC_NEVER == GL_NEVER - GL_NEVER); + assert(PIPE_FUNC_LESS == GL_LESS - GL_NEVER); + assert(PIPE_FUNC_EQUAL == GL_EQUAL - GL_NEVER); + assert(PIPE_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER); + assert(PIPE_FUNC_GREATER == GL_GREATER - GL_NEVER); + assert(PIPE_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER); + assert(PIPE_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER); + assert(PIPE_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER); assert(func >= GL_NEVER); assert(func <= GL_ALWAYS); return func - GL_NEVER; -- 2.30.2