From 8f2888758129b0a40d71fa4ce10d606b4bcf7631 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 30 May 2007 16:07:39 -0600 Subject: [PATCH] added depth(Z) state support --- src/mesa/softpipe/sp_context.h | 3 +++ src/mesa/softpipe/sp_defines.h | 10 ++++++++++ src/mesa/softpipe/sp_state.h | 9 +++++++++ src/mesa/softpipe/state_tracker/st_atom.h | 1 + src/mesa/softpipe/state_tracker/st_context.h | 1 + 5 files changed, 24 insertions(+) diff --git a/src/mesa/softpipe/sp_context.h b/src/mesa/softpipe/sp_context.h index e047a9330bd..e2b678f80f7 100644 --- a/src/mesa/softpipe/sp_context.h +++ b/src/mesa/softpipe/sp_context.h @@ -43,6 +43,9 @@ struct softpipe_context { void (*set_clip_state)( struct softpipe_context *, const struct softpipe_clip_state * ); + void (*set_depth_state)( struct softpipe_context *, + const struct softpipe_depth_state * ); + void (*set_viewport)( struct softpipe_context *, const struct softpipe_viewport * ); diff --git a/src/mesa/softpipe/sp_defines.h b/src/mesa/softpipe/sp_defines.h index bc88e3d71e2..e1c773a4077 100644 --- a/src/mesa/softpipe/sp_defines.h +++ b/src/mesa/softpipe/sp_defines.h @@ -89,4 +89,14 @@ #define SP_STENCIL_OP_DECR_WRAP 6 #define SP_STENCIL_OP_INVERT 7 +#define SP_DEPTH_FUNC_NEVER 0 +#define SP_DEPTH_FUNC_LESS 1 +#define SP_DEPTH_FUNC_EQUAL 2 +#define SP_DEPTH_FUNC_LEQUAL 3 +#define SP_DEPTH_FUNC_GREATER 4 +#define SP_DEPTH_FUNC_NOTEQUAL 5 +#define SP_DEPTH_FUNC_GEQUAL 6 +#define SP_DEPTH_FUNC_ALWAYS 7 + + #endif diff --git a/src/mesa/softpipe/sp_state.h b/src/mesa/softpipe/sp_state.h index f7d904bffec..634b9e98681 100644 --- a/src/mesa/softpipe/sp_state.h +++ b/src/mesa/softpipe/sp_state.h @@ -100,6 +100,15 @@ struct softpipe_constant_buffer { }; +struct softpipe_depth_state +{ + GLuint enabled:1; /**< depth test enabled? */ + GLuint writemask:1; /**< allow depth buffer writes? */ + GLuint func:3; /**< depth test func */ + GLfloat clear; /**< Clear value in [0,1] (XXX correct place?) */ +}; + + struct softpipe_blend_state { GLuint blend_enable:1; diff --git a/src/mesa/softpipe/state_tracker/st_atom.h b/src/mesa/softpipe/state_tracker/st_atom.h index 8dc7460d116..1d8da463368 100644 --- a/src/mesa/softpipe/state_tracker/st_atom.h +++ b/src/mesa/softpipe/state_tracker/st_atom.h @@ -46,6 +46,7 @@ void st_validate_state( struct st_context *st ); const struct st_tracked_state st_update_cbuf; const struct st_tracked_state st_update_clip; +const struct st_tracked_state st_update_depth; const struct st_tracked_state st_update_fs; const struct st_tracked_state st_update_setup; const struct st_tracked_state st_update_viewport; diff --git a/src/mesa/softpipe/state_tracker/st_context.h b/src/mesa/softpipe/state_tracker/st_context.h index 5ff10c1b1fe..317d3773718 100644 --- a/src/mesa/softpipe/state_tracker/st_context.h +++ b/src/mesa/softpipe/state_tracker/st_context.h @@ -71,6 +71,7 @@ struct st_context struct softpipe_blend_state blend; struct softpipe_surface cbuf; struct softpipe_clip_state clip; + struct softpipe_depth_state depth; struct softpipe_scissor_rect scissor; struct softpipe_poly_stipple poly_stipple; struct softpipe_stencil_state stencil; -- 2.30.2