gallium: incorporate alpha state into depth_stencil state object.
authorKeith Whitwell <keith@tungstengraphics.com>
Mon, 17 Dec 2007 16:14:29 +0000 (16:14 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Mon, 17 Dec 2007 16:14:29 +0000 (16:14 +0000)
37 files changed:
src/mesa/pipe/cell/ppu/cell_context.c
src/mesa/pipe/cell/ppu/cell_context.h
src/mesa/pipe/cell/ppu/cell_state.h
src/mesa/pipe/cell/ppu/cell_state_blend.c
src/mesa/pipe/cso_cache/cso_cache.c
src/mesa/pipe/cso_cache/cso_cache.h
src/mesa/pipe/failover/fo_context.h
src/mesa/pipe/failover/fo_state.c
src/mesa/pipe/failover/fo_state_emit.c
src/mesa/pipe/i915simple/i915_context.h
src/mesa/pipe/i915simple/i915_state.c
src/mesa/pipe/i915simple/i915_state_immediate.c
src/mesa/pipe/i965simple/brw_cc.c
src/mesa/pipe/i965simple/brw_context.h
src/mesa/pipe/i965simple/brw_state.c
src/mesa/pipe/i965simple/brw_wm.c
src/mesa/pipe/i965simple/brw_wm_state.c
src/mesa/pipe/p_context.h
src/mesa/pipe/p_state.h
src/mesa/pipe/softpipe/sp_context.c
src/mesa/pipe/softpipe/sp_context.h
src/mesa/pipe/softpipe/sp_quad.c
src/mesa/pipe/softpipe/sp_quad_alpha_test.c
src/mesa/pipe/softpipe/sp_quad_stencil.c
src/mesa/pipe/softpipe/sp_state.h
src/mesa/pipe/softpipe/sp_state_blend.c
src/mesa/pipe/softpipe/sp_state_derived.c
src/mesa/sources
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_atom.h
src/mesa/state_tracker/st_atom_alphatest.c [deleted file]
src/mesa/state_tracker/st_atom_depth.c
src/mesa/state_tracker/st_cache.c
src/mesa/state_tracker/st_cache.h
src/mesa/state_tracker/st_cb_clear.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_context.h

index eff33da969f64631fbe9f67959e37bbd8c1999c2..b448a8aa8cd6bbe7f4c05ab203832c6104199dcc 100644 (file)
@@ -176,10 +176,6 @@ cell_create_context(struct pipe_winsys *winsys, struct cell_winsys *cws)
 
 
    /* state setters */
-   cell->pipe.create_alpha_test_state = cell_create_alpha_test_state;
-   cell->pipe.bind_alpha_test_state   = cell_bind_alpha_test_state;
-   cell->pipe.delete_alpha_test_state = cell_delete_alpha_test_state;
-
    cell->pipe.create_blend_state = cell_create_blend_state;
    cell->pipe.bind_blend_state   = cell_bind_blend_state;
    cell->pipe.delete_blend_state = cell_delete_blend_state;
index 96f000eef4b549535e1175275f3dd3dde151c218..f8d6cc5d3233ad79130c3f4258c59fcefc0eb64a 100644 (file)
@@ -40,10 +40,9 @@ struct cell_context
 
    struct cell_winsys *winsys;
 
-   const struct pipe_alpha_test_state *alpha_test;
    const struct pipe_blend_state *blend;
    const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
-   const struct pipe_depth_stencil_state   *depth_stencil;
+   const struct pipe_depth_stencil_alpha_state   *depth_stencil;
    const struct pipe_rasterizer_state *rasterizer;
 
    struct pipe_blend_color blend_color;
index 4bad45950ba863e52c737fbb74660d2f88a6b98a..b01814202d99ce49598147538a2add909276e6fc 100644 (file)
@@ -27,13 +27,6 @@ cell_set_framebuffer_state( struct pipe_context *,
                             const struct pipe_framebuffer_state * );
 
 
-extern void *
-cell_create_alpha_test_state(struct pipe_context *,
-                             const struct pipe_alpha_test_state *);
-extern void
-cell_bind_alpha_test_state(struct pipe_context *, void *);
-extern void
-cell_delete_alpha_test_state(struct pipe_context *, void *);
 
 extern void *
 cell_create_blend_state(struct pipe_context *, const struct pipe_blend_state *);
@@ -57,7 +50,7 @@ cell_delete_sampler_state(struct pipe_context *, void *);
 
 extern void *
 cell_create_depth_stencil_state(struct pipe_context *,
-                                const struct pipe_depth_stencil_state *);
+                                const struct pipe_depth_stencil_alpha_state *);
 
 extern void
 cell_bind_depth_stencil_state(struct pipe_context *, void *);
index e807463d902a24cef1ee84f2104b754c422a6e7e..efcb9e38a4c0a90610e14246218d776ba399e789 100644 (file)
@@ -69,44 +69,14 @@ void cell_set_blend_color( struct pipe_context *pipe,
 }
 
 
-/** XXX move someday?  Or consolidate all these simple state setters
- * into one file.
- */
-
-void *
-cell_create_alpha_test_state(struct pipe_context *pipe,
-                                 const struct pipe_alpha_test_state *alpha)
-{
-   struct pipe_alpha_test_state *state = MALLOC( sizeof(struct pipe_alpha_test_state) );
-   memcpy(state, alpha, sizeof(struct pipe_alpha_test_state));
-   return state;
-}
-
-void
-cell_bind_alpha_test_state(struct pipe_context *pipe,
-                               void *alpha)
-{
-   struct cell_context *cell = cell_context(pipe);
-
-   cell->alpha_test = (const struct pipe_alpha_test_state *)alpha;
-
-   cell->dirty |= CELL_NEW_ALPHA_TEST;
-}
-
-void
-cell_delete_alpha_test_state(struct pipe_context *pipe,
-                                 void *alpha)
-{
-   FREE( alpha );
-}
 
 void *
 cell_create_depth_stencil_state(struct pipe_context *pipe,
-                              const struct pipe_depth_stencil_state *depth_stencil)
+                              const struct pipe_depth_stencil_alpha_state *depth_stencil)
 {
-   struct pipe_depth_stencil_state *state =
-      MALLOC( sizeof(struct pipe_depth_stencil_state) );
-   memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_state));
+   struct pipe_depth_stencil_alpha_state *state =
+      MALLOC( sizeof(struct pipe_depth_stencil_alpha_state) );
+   memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_alpha_state));
    return state;
 }
 
@@ -116,7 +86,7 @@ cell_bind_depth_stencil_state(struct pipe_context *pipe,
 {
    struct cell_context *cell = cell_context(pipe);
 
-   cell->depth_stencil = (const struct pipe_depth_stencil_state *)depth_stencil;
+   cell->depth_stencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil;
 
    cell->dirty |= CELL_NEW_DEPTH_STENCIL;
 }
index 0bba5914dc8ad85d1e03fecde23247db80da9d55..9e77e0774ddf0ea8e78677d3ee1813d4434b8fcf 100644 (file)
@@ -78,7 +78,7 @@ static struct cso_hash *_cso_hash_for_type(struct cso_cache *sc, enum cso_cache_
    case CSO_SAMPLER:
       hash = sc->sampler_hash;
       break;
-   case CSO_DEPTH_STENCIL:
+   case CSO_DEPTH_STENCIL_ALPHA:
       hash = sc->depth_stencil_hash;
       break;
    case CSO_RASTERIZER:
@@ -90,9 +90,6 @@ static struct cso_hash *_cso_hash_for_type(struct cso_cache *sc, enum cso_cache_
    case CSO_VERTEX_SHADER:
       hash = sc->vs_hash;
       break;
-   case CSO_ALPHA_TEST:
-      hash = sc->alpha_hash;
-      break;
    }
 
    return hash;
@@ -105,16 +102,14 @@ static int _cso_size_for_type(enum cso_cache_type type)
       return sizeof(struct pipe_blend_state);
    case CSO_SAMPLER:
       return sizeof(struct pipe_sampler_state);
-   case CSO_DEPTH_STENCIL:
-      return sizeof(struct pipe_depth_stencil_state);
+   case CSO_DEPTH_STENCIL_ALPHA:
+      return sizeof(struct pipe_depth_stencil_alpha_state);
    case CSO_RASTERIZER:
       return sizeof(struct pipe_rasterizer_state);
    case CSO_FRAGMENT_SHADER:
       return sizeof(struct pipe_shader_state);
    case CSO_VERTEX_SHADER:
       return sizeof(struct pipe_shader_state);
-   case CSO_ALPHA_TEST:
-      return sizeof(struct pipe_alpha_test_state);
    }
    return 0;
 }
@@ -169,7 +164,6 @@ struct cso_cache *cso_cache_create(void)
    sc->rasterizer_hash    = cso_hash_create();
    sc->fs_hash            = cso_hash_create();
    sc->vs_hash            = cso_hash_create();
-   sc->alpha_hash         = cso_hash_create();
 
    return sc;
 }
@@ -183,6 +177,5 @@ void cso_cache_delete(struct cso_cache *sc)
    cso_hash_delete(sc->rasterizer_hash);
    cso_hash_delete(sc->fs_hash);
    cso_hash_delete(sc->vs_hash);
-   cso_hash_delete(sc->alpha_hash);
    free(sc);
 }
index cd36dd51e985f38b6ee7959d8ca3f8915e755918..116e2eaa2c8e13a9c1576c5266049fc539368978 100644 (file)
@@ -40,7 +40,6 @@
 struct cso_hash;
 
 struct cso_cache {
-   struct cso_hash *alpha_hash;
    struct cso_hash *blend_hash;
    struct cso_hash *depth_stencil_hash;
    struct cso_hash *fs_hash;
@@ -54,8 +53,8 @@ struct cso_blend {
    void   *data;
 };
 
-struct cso_depth_stencil {
-   struct pipe_depth_stencil_state state;
+struct cso_depth_stencil_alpha {
+   struct pipe_depth_stencil_alpha_state state;
    void *data;
 };
 
@@ -79,19 +78,14 @@ struct cso_sampler {
    void *data;
 };
 
-struct cso_alpha_test {
-   struct pipe_alpha_test_state state;
-   void *data;
-};
 
 enum cso_cache_type {
    CSO_BLEND,
    CSO_SAMPLER,
-   CSO_DEPTH_STENCIL,
+   CSO_DEPTH_STENCIL_ALPHA,
    CSO_RASTERIZER,
    CSO_FRAGMENT_SHADER,
-   CSO_VERTEX_SHADER,
-   CSO_ALPHA_TEST
+   CSO_VERTEX_SHADER
 };
 
 unsigned cso_construct_key(void *item, int item_size);
index f5eaa0b5fa82ff8d9c5e0af315675cdbc5c213b9..1dc87291c9fb7123023cca251512d4e6c27ff208 100644 (file)
@@ -70,7 +70,6 @@ struct failover_context {
 
    /* The most recent drawing state as set by the driver:
     */
-   const struct fo_state     *alpha_test;
    const struct fo_state     *blend;
    const struct fo_state     *sampler[PIPE_MAX_SAMPLERS];
    const struct fo_state     *depth_stencil;
index 6b4f1517ace60090ed8044492f01b074fa577743..fa700b9674f9b93362621a4e2a612be01ea2f299 100644 (file)
  * lower overheads.
  */
 
-static void *
-failover_create_alpha_test_state(struct pipe_context *pipe,
-                                 const struct pipe_alpha_test_state *templ)
-{
-   struct fo_state *state = malloc(sizeof(struct fo_state));
-   struct failover_context *failover = failover_context(pipe);
-
-   state->sw_state = failover->sw->create_alpha_test_state(pipe, templ);
-   state->hw_state = failover->hw->create_alpha_test_state(pipe, templ);
-
-   return state;
-}
-
-static void
-failover_bind_alpha_test_state(struct pipe_context *pipe,
-                               void *alpha)
-{
-   struct failover_context *failover = failover_context(pipe);
-   struct fo_state *state = (struct fo_state *)alpha;
-
-   failover->alpha_test = state;
-   failover->dirty |= FO_NEW_ALPHA_TEST;
-   failover->hw->bind_alpha_test_state(failover->hw,
-                                       state->hw_state);
-}
-
-static void
-failover_delete_alpha_test_state(struct pipe_context *pipe,
-                                 void *alpha)
-{
-   struct fo_state *state = (struct fo_state*)alpha;
-   struct failover_context *failover = failover_context(pipe);
-
-   failover->sw->delete_alpha_test_state(pipe, state->sw_state);
-   failover->hw->delete_alpha_test_state(pipe, state->hw_state);
-   state->sw_state = 0;
-   state->hw_state = 0;
-   free(state);
-}
 
 
 static void *
@@ -149,13 +110,13 @@ failover_set_clip_state( struct pipe_context *pipe,
 
 static void *
 failover_create_depth_stencil_state(struct pipe_context *pipe,
-                              const struct pipe_depth_stencil_state *templ)
+                              const struct pipe_depth_stencil_alpha_state *templ)
 {
    struct fo_state *state = malloc(sizeof(struct fo_state));
    struct failover_context *failover = failover_context(pipe);
 
-   state->sw_state = failover->sw->create_depth_stencil_state(pipe, templ);
-   state->hw_state = failover->hw->create_depth_stencil_state(pipe, templ);
+   state->sw_state = failover->sw->create_depth_stencil_alpha_state(pipe, templ);
+   state->hw_state = failover->hw->create_depth_stencil_alpha_state(pipe, templ);
 
    return state;
 }
@@ -168,7 +129,7 @@ failover_bind_depth_stencil_state(struct pipe_context *pipe,
    struct fo_state *state = (struct fo_state *)depth_stencil;
    failover->depth_stencil = state;
    failover->dirty |= FO_NEW_DEPTH_STENCIL;
-   failover->hw->bind_depth_stencil_state(failover->hw, state->hw_state);
+   failover->hw->bind_depth_stencil_alpha_state(failover->hw, state->hw_state);
 }
 
 static void
@@ -178,8 +139,8 @@ failover_delete_depth_stencil_state(struct pipe_context *pipe,
    struct fo_state *state = (struct fo_state*)ds;
    struct failover_context *failover = failover_context(pipe);
 
-   failover->sw->delete_depth_stencil_state(pipe, state->sw_state);
-   failover->hw->delete_depth_stencil_state(pipe, state->hw_state);
+   failover->sw->delete_depth_stencil_alpha_state(pipe, state->sw_state);
+   failover->hw->delete_depth_stencil_alpha_state(pipe, state->hw_state);
    state->sw_state = 0;
    state->hw_state = 0;
    free(state);
@@ -434,18 +395,15 @@ failover_set_vertex_element(struct pipe_context *pipe,
 void
 failover_init_state_functions( struct failover_context *failover )
 {
-   failover->pipe.create_alpha_test_state = failover_create_alpha_test_state;
-   failover->pipe.bind_alpha_test_state   = failover_bind_alpha_test_state;
-   failover->pipe.delete_alpha_test_state = failover_delete_alpha_test_state;
    failover->pipe.create_blend_state = failover_create_blend_state;
    failover->pipe.bind_blend_state   = failover_bind_blend_state;
    failover->pipe.delete_blend_state = failover_delete_blend_state;
    failover->pipe.create_sampler_state = failover_create_sampler_state;
    failover->pipe.bind_sampler_state   = failover_bind_sampler_state;
    failover->pipe.delete_sampler_state = failover_delete_sampler_state;
-   failover->pipe.create_depth_stencil_state = failover_create_depth_stencil_state;
-   failover->pipe.bind_depth_stencil_state   = failover_bind_depth_stencil_state;
-   failover->pipe.delete_depth_stencil_state = failover_delete_depth_stencil_state;
+   failover->pipe.create_depth_stencil_alpha_state = failover_create_depth_stencil_state;
+   failover->pipe.bind_depth_stencil_alpha_state   = failover_bind_depth_stencil_state;
+   failover->pipe.delete_depth_stencil_alpha_state = failover_delete_depth_stencil_state;
    failover->pipe.create_rasterizer_state = failover_create_rasterizer_state;
    failover->pipe.bind_rasterizer_state = failover_bind_rasterizer_state;
    failover->pipe.delete_rasterizer_state = failover_delete_rasterizer_state;
index c99ecd4f8df8ed5d0776465a67a724cc49844e49..c663dd49476883fc6525e6f2bb77f5cc8d83e7e5 100644 (file)
@@ -55,10 +55,6 @@ failover_state_emit( struct failover_context *failover )
 {
    unsigned i;
 
-   if (failover->dirty & FO_NEW_ALPHA_TEST)
-      failover->sw->bind_alpha_test_state( failover->sw,
-                                           failover->alpha_test->sw_state );
-
    if (failover->dirty & FO_NEW_BLEND)
       failover->sw->bind_blend_state( failover->sw,
                                       failover->blend->sw_state );
@@ -70,8 +66,8 @@ failover_state_emit( struct failover_context *failover )
       failover->sw->set_clip_state( failover->sw, &failover->clip );
 
    if (failover->dirty & FO_NEW_DEPTH_STENCIL)
-      failover->sw->bind_depth_stencil_state( failover->sw,
-                                              failover->depth_stencil->sw_state );
+      failover->sw->bind_depth_stencil_alpha_state( failover->sw,
+                                                   failover->depth_stencil->sw_state );
 
    if (failover->dirty & FO_NEW_FRAMEBUFFER)
       failover->sw->set_framebuffer_state( failover->sw, &failover->framebuffer );
index 80df7f0fba16212afce03eef02d934bd15744366..2f1f0369934f9ffd70b9009e4cadb5ce65768b66 100644 (file)
@@ -146,9 +146,6 @@ struct i915_sampler_state {
    const struct pipe_sampler_state *templ;
 };
 
-struct i915_alpha_test_state {
-   unsigned LIS6;
-};
 
 struct i915_texture {
    struct pipe_texture base;
@@ -186,7 +183,6 @@ struct i915_context
 
    /* The most recent drawing state as set by the driver:
     */
-   const struct i915_alpha_test_state      *alpha_test;
    const struct i915_blend_state           *blend;
    const struct i915_sampler_state         *sampler[PIPE_MAX_SAMPLERS];
    const struct i915_depth_stencil_state   *depth_stencil;
index 2a9a587a37d7644bb547d244dd22afe9c222f7ee..f8332aab378a69796ba840e88920b70834e8f976 100644 (file)
@@ -284,13 +284,13 @@ static void i915_delete_sampler_state(struct pipe_context *pipe,
 
 static void *
 i915_create_depth_stencil_state(struct pipe_context *pipe,
-                           const struct pipe_depth_stencil_state *depth_stencil)
+                               const struct pipe_depth_stencil_alpha_state *depth_stencil)
 {
    struct i915_depth_stencil_state *cso = CALLOC_STRUCT( i915_depth_stencil_state );
 
    {
-      int testmask = depth_stencil->stencil.value_mask[0] & 0xff;
-      int writemask = depth_stencil->stencil.write_mask[0] & 0xff;
+      int testmask = depth_stencil->stencil[0].value_mask & 0xff;
+      int writemask = depth_stencil->stencil[0].write_mask & 0xff;
 
       cso->stencil_modes4 |= (_3DSTATE_MODES_4_CMD |
                               ENABLE_STENCIL_TEST_MASK |
@@ -299,12 +299,12 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
                               STENCIL_WRITE_MASK(writemask));
    }
 
-   if (depth_stencil->stencil.front_enabled) {
-      int test = i915_translate_compare_func(depth_stencil->stencil.front_func);
-      int fop  = i915_translate_stencil_op(depth_stencil->stencil.front_fail_op);
-      int dfop = i915_translate_stencil_op(depth_stencil->stencil.front_zfail_op);
-      int dpop = i915_translate_stencil_op(depth_stencil->stencil.front_zpass_op);
-      int ref  = depth_stencil->stencil.ref_value[0] & 0xff;
+   if (depth_stencil->stencil[0].enabled) {
+      int test = i915_translate_compare_func(depth_stencil->stencil[0].func);
+      int fop  = i915_translate_stencil_op(depth_stencil->stencil[0].fail_op);
+      int dfop = i915_translate_stencil_op(depth_stencil->stencil[0].zfail_op);
+      int dpop = i915_translate_stencil_op(depth_stencil->stencil[0].zpass_op);
+      int ref  = depth_stencil->stencil[0].ref_value & 0xff;
 
       cso->stencil_LIS5 |= (S5_STENCIL_TEST_ENABLE |
                             S5_STENCIL_WRITE_ENABLE |
@@ -315,14 +315,14 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
                             (dpop << S5_STENCIL_PASS_Z_PASS_SHIFT));
    }
 
-   if (depth_stencil->stencil.back_enabled) {
-      int test  = i915_translate_compare_func(depth_stencil->stencil.back_func);
-      int fop   = i915_translate_stencil_op(depth_stencil->stencil.back_fail_op);
-      int dfop  = i915_translate_stencil_op(depth_stencil->stencil.back_zfail_op);
-      int dpop  = i915_translate_stencil_op(depth_stencil->stencil.back_zpass_op);
-      int ref   = depth_stencil->stencil.ref_value[1] & 0xff;
-      int tmask = depth_stencil->stencil.value_mask[1] & 0xff;
-      int wmask = depth_stencil->stencil.write_mask[1] & 0xff;
+   if (depth_stencil->stencil[1].enabled) {
+      int test  = i915_translate_compare_func(depth_stencil->stencil[1].func);
+      int fop   = i915_translate_stencil_op(depth_stencil->stencil[1].fail_op);
+      int dfop  = i915_translate_stencil_op(depth_stencil->stencil[1].zfail_op);
+      int dpop  = i915_translate_stencil_op(depth_stencil->stencil[1].zpass_op);
+      int ref   = depth_stencil->stencil[1].ref_value & 0xff;
+      int tmask = depth_stencil->stencil[1].value_mask & 0xff;
+      int wmask = depth_stencil->stencil[1].write_mask & 0xff;
 
       cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS |
                      BFO_ENABLE_STENCIL_FUNCS |
@@ -363,6 +363,15 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
         cso->depth_LIS6 |= S6_DEPTH_WRITE_ENABLE;
    }
 
+   if (depth_stencil->alpha.enabled) {
+      int test = i915_translate_compare_func(depth_stencil->alpha.func);
+      ubyte refByte = float_to_ubyte(depth_stencil->alpha.ref);
+
+      cso->depth_LIS6 |= (S6_ALPHA_TEST_ENABLE |
+                         (test << S6_ALPHA_TEST_FUNC_SHIFT) |
+                         (((unsigned) refByte) << S6_ALPHA_REF_SHIFT));
+   }
+
    return cso;
 }
 
@@ -383,39 +392,6 @@ static void i915_delete_depth_stencil_state(struct pipe_context *pipe,
 }
 
 
-static void *
-i915_create_alpha_test_state(struct pipe_context *pipe,
-                             const struct pipe_alpha_test_state *alpha_test)
-{
-   struct i915_alpha_test_state *cso = CALLOC_STRUCT( i915_alpha_test_state );
-
-   if (alpha_test->enabled) {
-      int test = i915_translate_compare_func(alpha_test->func);
-      ubyte refByte = float_to_ubyte(alpha_test->ref);
-
-      cso->LIS6 |= (S6_ALPHA_TEST_ENABLE |
-                    (test << S6_ALPHA_TEST_FUNC_SHIFT) |
-                    (((unsigned) refByte) << S6_ALPHA_REF_SHIFT));
-   }
-   return cso;
-}
-
-static void i915_bind_alpha_test_state(struct pipe_context *pipe,
-                                       void *alpha)
-{
-   struct i915_context *i915 = i915_context(pipe);
-
-   i915->alpha_test = (const struct i915_alpha_test_state*)alpha;
-
-   i915->dirty |= I915_NEW_ALPHA_TEST;
-}
-
-static void i915_delete_alpha_test_state(struct pipe_context *pipe,
-                                         void *alpha)
-{
-   FREE(alpha);
-}
-
 static void i915_set_scissor_state( struct pipe_context *pipe,
                                  const struct pipe_scissor_state *scissor )
 {
@@ -674,10 +650,6 @@ static void i915_set_vertex_element( struct pipe_context *pipe,
 void
 i915_init_state_functions( struct i915_context *i915 )
 {
-   i915->pipe.create_alpha_test_state = i915_create_alpha_test_state;
-   i915->pipe.bind_alpha_test_state   = i915_bind_alpha_test_state;
-   i915->pipe.delete_alpha_test_state = i915_delete_alpha_test_state;
-
    i915->pipe.create_blend_state = i915_create_blend_state;
    i915->pipe.bind_blend_state = i915_bind_blend_state;
    i915->pipe.delete_blend_state = i915_delete_blend_state;
@@ -686,9 +658,9 @@ i915_init_state_functions( struct i915_context *i915 )
    i915->pipe.bind_sampler_state = i915_bind_sampler_state;
    i915->pipe.delete_sampler_state = i915_delete_sampler_state;
 
-   i915->pipe.create_depth_stencil_state = i915_create_depth_stencil_state;
-   i915->pipe.bind_depth_stencil_state = i915_bind_depth_stencil_state;
-   i915->pipe.delete_depth_stencil_state = i915_delete_depth_stencil_state;
+   i915->pipe.create_depth_stencil_alpha_state = i915_create_depth_stencil_state;
+   i915->pipe.bind_depth_stencil_alpha_state = i915_bind_depth_stencil_state;
+   i915->pipe.delete_depth_stencil_alpha_state = i915_delete_depth_stencil_state;
 
    i915->pipe.create_rasterizer_state = i915_create_rasterizer_state;
    i915->pipe.bind_rasterizer_state = i915_bind_rasterizer_state;
index da2402c0188f3407d408ddf878305dff340d802c..752d25f2331612d6f7712bef8634a2a9f9f62e39 100644 (file)
@@ -159,10 +159,6 @@ static void upload_S6( struct i915_context *i915 )
    unsigned LIS6 = (S6_COLOR_WRITE_ENABLE |
                  (2 << S6_TRISTRIP_PV_SHIFT));
 
-   /* I915_NEW_ALPHA_TEST
-    */
-   LIS6 |= i915->alpha_test->LIS6;
-
    /* I915_NEW_BLEND
     */
    LIS6 |= i915->blend->LIS6;
@@ -178,7 +174,7 @@ static void upload_S6( struct i915_context *i915 )
 }
 
 const struct i915_tracked_state i915_upload_S6 = {
-   I915_NEW_ALPHA_TEST | I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
+   I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
    upload_S6
 };
 
index 6cc1505311e5bb3559abfe85e96ba3cb35d222db..dcee7318958d5d5e557711ea58ce7a0f27b304bf 100644 (file)
@@ -156,38 +156,37 @@ static void upload_cc_unit( struct brw_context *brw )
    memset(&cc, 0, sizeof(cc));
 
    /* BRW_NEW_DEPTH_STENCIL */
-   if (brw->attribs.DepthStencil->stencil.front_enabled) {
-      cc.cc0.stencil_enable = brw->attribs.DepthStencil->stencil.front_enabled;
-      cc.cc0.stencil_func = brw_translate_compare_func(brw->attribs.DepthStencil->stencil.front_func);
-      cc.cc0.stencil_fail_op = brw_translate_stencil_op(brw->attribs.DepthStencil->stencil.front_fail_op);
+   if (brw->attribs.DepthStencil->stencil[0].enabled) {
+      cc.cc0.stencil_enable = brw->attribs.DepthStencil->stencil[0].enabled;
+      cc.cc0.stencil_func = brw_translate_compare_func(brw->attribs.DepthStencil->stencil[0].func);
+      cc.cc0.stencil_fail_op = brw_translate_stencil_op(brw->attribs.DepthStencil->stencil[0].fail_op);
       cc.cc0.stencil_pass_depth_fail_op = brw_translate_stencil_op(
-         brw->attribs.DepthStencil->stencil.front_zfail_op);
+         brw->attribs.DepthStencil->stencil[0].zfail_op);
       cc.cc0.stencil_pass_depth_pass_op = brw_translate_stencil_op(
-         brw->attribs.DepthStencil->stencil.front_zpass_op);
-      cc.cc1.stencil_ref = brw->attribs.DepthStencil->stencil.ref_value[0];
-      cc.cc1.stencil_write_mask = brw->attribs.DepthStencil->stencil.write_mask[0];
-      cc.cc1.stencil_test_mask = brw->attribs.DepthStencil->stencil.value_mask[0];
+         brw->attribs.DepthStencil->stencil[0].zpass_op);
+      cc.cc1.stencil_ref = brw->attribs.DepthStencil->stencil[0].ref_value;
+      cc.cc1.stencil_write_mask = brw->attribs.DepthStencil->stencil[0].write_mask;
+      cc.cc1.stencil_test_mask = brw->attribs.DepthStencil->stencil[0].value_mask;
 
-      if (brw->attribs.DepthStencil->stencil.back_enabled) {
-        cc.cc0.bf_stencil_enable = brw->attribs.DepthStencil->stencil.back_enabled;
+      if (brw->attribs.DepthStencil->stencil[1].enabled) {
+        cc.cc0.bf_stencil_enable = brw->attribs.DepthStencil->stencil[1].enabled;
         cc.cc0.bf_stencil_func = brw_translate_compare_func(
-            brw->attribs.DepthStencil->stencil.back_func);
+            brw->attribs.DepthStencil->stencil[1].func);
         cc.cc0.bf_stencil_fail_op = brw_translate_stencil_op(
-            brw->attribs.DepthStencil->stencil.back_fail_op);
+            brw->attribs.DepthStencil->stencil[1].fail_op);
         cc.cc0.bf_stencil_pass_depth_fail_op = brw_translate_stencil_op(
-            brw->attribs.DepthStencil->stencil.back_zfail_op);
+            brw->attribs.DepthStencil->stencil[1].zfail_op);
         cc.cc0.bf_stencil_pass_depth_pass_op = brw_translate_stencil_op(
-            brw->attribs.DepthStencil->stencil.back_zpass_op);
-        cc.cc1.bf_stencil_ref = brw->attribs.DepthStencil->stencil.ref_value[1];
-        cc.cc2.bf_stencil_write_mask = brw->attribs.DepthStencil->stencil.write_mask[1];
-        cc.cc2.bf_stencil_test_mask = brw->attribs.DepthStencil->stencil.value_mask[1];
+            brw->attribs.DepthStencil->stencil[1].zpass_op);
+        cc.cc1.bf_stencil_ref = brw->attribs.DepthStencil->stencil[1].ref_value;
+        cc.cc2.bf_stencil_write_mask = brw->attribs.DepthStencil->stencil[1].write_mask;
+        cc.cc2.bf_stencil_test_mask = brw->attribs.DepthStencil->stencil[1].value_mask;
       }
 
       /* Not really sure about this:
        */
-      if (brw->attribs.DepthStencil->stencil.write_mask[0] ||
-         (brw->attribs.DepthStencil->stencil.back_enabled &&
-           brw->attribs.DepthStencil->stencil.write_mask[1]))
+      if (brw->attribs.DepthStencil->stencil[0].write_mask ||
+         brw->attribs.DepthStencil->stencil[1].write_mask)
         cc.cc0.stencil_write_enable = 1;
    }
 
@@ -228,11 +227,13 @@ static void upload_cc_unit( struct brw_context *brw )
    
    /* BRW_NEW_ALPHATEST
     */
-   if (brw->attribs.AlphaTest->enabled) {
+   if (brw->attribs.DepthStencil->alpha.enabled) {
       cc.cc3.alpha_test = 1;
-      cc.cc3.alpha_test_func = brw_translate_compare_func(brw->attribs.AlphaTest->func);
+      cc.cc3.alpha_test_func = 
+        brw_translate_compare_func(brw->attribs.DepthStencil->alpha.func);
 
-      UNCLAMPED_FLOAT_TO_UBYTE(cc.cc7.alpha_ref.ub[0], brw->attribs.AlphaTest->ref);
+      UNCLAMPED_FLOAT_TO_UBYTE(cc.cc7.alpha_ref.ub[0], 
+                              brw->attribs.DepthStencil->alpha.ref);
 
       cc.cc3.alpha_test_format = BRW_ALPHATEST_FORMAT_UNORM8;
    }
index 318c6a7049db18b956c461bec663eb9f1ae0b9d0..11146570be736a2aa0cfcc02b2a844cd3e6619dc 100644 (file)
@@ -479,9 +479,8 @@ struct brw_context
 
 
    struct {
-      const struct pipe_alpha_test_state    *AlphaTest;
       const struct pipe_blend_state         *Blend;
-      const struct pipe_depth_stencil_state *DepthStencil;
+      const struct pipe_depth_stencil_alpha_state *DepthStencil;
       const struct pipe_poly_stipple        *PolygonStipple;
       const struct pipe_rasterizer_state    *Raster;
       const struct pipe_sampler_state       *Samplers[PIPE_MAX_SAMPLERS];
index 26450ae59719d2f87a25e9abe0aadd14c412f00f..e7f5a27a380d28f46e370346d603041a971d87b1 100644 (file)
@@ -116,9 +116,9 @@ static void brw_delete_sampler_state(struct pipe_context *pipe,
 
 static void *
 brw_create_depth_stencil_state(struct pipe_context *pipe,
-                           const struct pipe_depth_stencil_state *depth_stencil)
+                           const struct pipe_depth_stencil_alpha_state *depth_stencil)
 {
-   DUP( pipe_depth_stencil_state, depth_stencil );
+   DUP( pipe_depth_stencil_alpha_state, depth_stencil );
 }
 
 static void brw_bind_depth_stencil_state(struct pipe_context *pipe,
@@ -126,7 +126,7 @@ static void brw_bind_depth_stencil_state(struct pipe_context *pipe,
 {
    struct brw_context *brw = brw_context(pipe);
 
-   brw->attribs.DepthStencil = (const struct pipe_depth_stencil_state *)depth_stencil;
+   brw->attribs.DepthStencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil;
 
    brw->state.dirty.brw |= BRW_NEW_DEPTH_STENCIL;
 }
@@ -137,32 +137,6 @@ static void brw_delete_depth_stencil_state(struct pipe_context *pipe,
    free(depth_stencil);
 }
 
-/************************************************************************
- * Alpha test 
- */
-static void *
-brw_create_alpha_test_state(struct pipe_context *pipe,
-                             const struct pipe_alpha_test_state *alpha_test)
-{
-   DUP(pipe_alpha_test_state, alpha_test);
-}
-
-static void brw_bind_alpha_test_state(struct pipe_context *pipe,
-                                       void *alpha)
-{
-   struct brw_context *brw = brw_context(pipe);
-
-   brw->attribs.AlphaTest = (const struct pipe_alpha_test_state*)alpha;
-
-   brw->state.dirty.brw |= BRW_NEW_ALPHA_TEST;
-}
-
-static void brw_delete_alpha_test_state(struct pipe_context *pipe,
-                                         void *alpha)
-{
-   free(alpha);
-}
-
 /************************************************************************
  * Scissor
  */
@@ -415,10 +389,6 @@ static void brw_delete_rasterizer_state(struct pipe_context *pipe,
 void
 brw_init_state_functions( struct brw_context *brw )
 {
-   brw->pipe.create_alpha_test_state = brw_create_alpha_test_state;
-   brw->pipe.bind_alpha_test_state   = brw_bind_alpha_test_state;
-   brw->pipe.delete_alpha_test_state = brw_delete_alpha_test_state;
-
    brw->pipe.create_blend_state = brw_create_blend_state;
    brw->pipe.bind_blend_state = brw_bind_blend_state;
    brw->pipe.delete_blend_state = brw_delete_blend_state;
@@ -427,9 +397,9 @@ brw_init_state_functions( struct brw_context *brw )
    brw->pipe.bind_sampler_state = brw_bind_sampler_state;
    brw->pipe.delete_sampler_state = brw_delete_sampler_state;
 
-   brw->pipe.create_depth_stencil_state = brw_create_depth_stencil_state;
-   brw->pipe.bind_depth_stencil_state = brw_bind_depth_stencil_state;
-   brw->pipe.delete_depth_stencil_state = brw_delete_depth_stencil_state;
+   brw->pipe.create_depth_stencil_alpha_state = brw_create_depth_stencil_state;
+   brw->pipe.bind_depth_stencil_alpha_state = brw_bind_depth_stencil_state;
+   brw->pipe.delete_depth_stencil_alpha_state = brw_delete_depth_stencil_state;
 
    brw->pipe.create_rasterizer_state = brw_create_rasterizer_state;
    brw->pipe.bind_rasterizer_state = brw_bind_rasterizer_state;
index f0a38d384bd5b180125ac9d9672b2c81963f2d24..0ee0fbed5112985688126a1c299bd86428d536b2 100644 (file)
@@ -93,15 +93,14 @@ static void brw_wm_populate_key( struct brw_context *brw,
 
    /* Build the index for table lookup
     */
-   /* _NEW_COLOR */
+   /* BRW_NEW_DEPTH_STENCIL */
    if (fp->UsesKill ||
-       brw->attribs.AlphaTest->enabled)
+       brw->attribs.DepthStencil->alpha.enabled)
       lookup |= IZ_PS_KILL_ALPHATEST_BIT;
 
    if (fp->ComputesDepth)
       lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
 
-   /* _NEW_DEPTH */
    if (brw->attribs.DepthStencil->depth.enabled)
       lookup |= IZ_DEPTH_TEST_ENABLE_BIT;
 
@@ -109,13 +108,11 @@ static void brw_wm_populate_key( struct brw_context *brw,
        brw->attribs.DepthStencil->depth.writemask) /* ?? */
       lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
 
-   /* _NEW_STENCIL */
-   if (brw->attribs.DepthStencil->stencil.front_enabled) {
+   if (brw->attribs.DepthStencil->stencil[0].enabled) {
       lookup |= IZ_STENCIL_TEST_ENABLE_BIT;
 
-      if (brw->attribs.DepthStencil->stencil.write_mask[0] ||
-         (brw->attribs.DepthStencil->stencil.back_enabled &&
-           brw->attribs.DepthStencil->stencil.write_mask[1]))
+      if (brw->attribs.DepthStencil->stencil[0].write_mask ||
+         brw->attribs.DepthStencil->stencil[1].write_mask)
         lookup |= IZ_STENCIL_WRITE_ENABLE_BIT;
    }
 
index 52d2c854237c6557a299c70d356ec3b11c6116b8..5ccd4888423d3734f9512690cc921947dff4d716 100644 (file)
@@ -122,7 +122,7 @@ static void upload_wm_unit(struct brw_context *brw )
 
       /* BRW_NEW_ALPHA_TEST */
       if (fp->UsesKill ||
-         brw->attribs.AlphaTest->enabled)
+         brw->attribs.DepthStencil->alpha.enabled)
         wm.wm5.program_uses_killpixel = 1;
 
       wm.wm5.enable_8_pix = 1;
index 92ca7dd8e3c4c760c60812dda3a70f2f06570145..1afb38a868379598b89af0af78d72f57d76179e1 100644 (file)
@@ -102,11 +102,6 @@ struct pipe_context {
    /*
     * State functions
     */
-   void * (*create_alpha_test_state)(struct pipe_context *,
-                                     const struct pipe_alpha_test_state *);
-   void   (*bind_alpha_test_state)(struct pipe_context *, void *);
-   void   (*delete_alpha_test_state)(struct pipe_context *, void *);
-
    void * (*create_blend_state)(struct pipe_context *,
                                 const struct pipe_blend_state *);
    void   (*bind_blend_state)(struct pipe_context *, void *);
@@ -122,10 +117,10 @@ struct pipe_context {
    void   (*bind_rasterizer_state)(struct pipe_context *, void *);
    void   (*delete_rasterizer_state)(struct pipe_context *, void *);
 
-   void * (*create_depth_stencil_state)(struct pipe_context *,
-                                        const struct pipe_depth_stencil_state *);
-   void   (*bind_depth_stencil_state)(struct pipe_context *, void *);
-   void   (*delete_depth_stencil_state)(struct pipe_context *, void *);
+   void * (*create_depth_stencil_alpha_state)(struct pipe_context *,
+                                        const struct pipe_depth_stencil_alpha_state *);
+   void   (*bind_depth_stencil_alpha_state)(struct pipe_context *, void *);
+   void   (*delete_depth_stencil_alpha_state)(struct pipe_context *, void *);
 
    void * (*create_fs_state)(struct pipe_context *,
                              const struct pipe_shader_state *);
index af65d365bf0b6a79dc4fc6a324f6765aae4d12b9..b7793c6d314e511326c367896f7bf0f9ee24756d 100644 (file)
@@ -147,7 +147,7 @@ struct pipe_shader_state {
    ubyte output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
 };
 
-struct pipe_depth_stencil_state
+struct pipe_depth_stencil_alpha_state
 {
    struct {
       unsigned enabled:1;   /**< depth test enabled? */
@@ -156,28 +156,24 @@ struct pipe_depth_stencil_state
       unsigned occlusion_count:1; /**< XXX move this elsewhere? */
    } depth;
    struct {
-      unsigned front_enabled:1;
-      unsigned front_func:3;     /**< PIPE_FUNC_x */
-      unsigned front_fail_op:3;  /**< PIPE_STENCIL_OP_x */
-      unsigned front_zpass_op:3; /**< PIPE_STENCIL_OP_x */
-      unsigned front_zfail_op:3; /**< PIPE_STENCIL_OP_x */
-      unsigned back_enabled:1;
-      unsigned back_func:3;      /**< PIPE_FUNC_x */
-      unsigned back_fail_op:3;   /**< PIPE_STENCIL_OP_x */
-      unsigned back_zpass_op:3;  /**< PIPE_STENCIL_OP_x */
-      unsigned back_zfail_op:3;  /**< PIPE_STENCIL_OP_x */
-      ubyte ref_value[2];    /**< [0] = front, [1] = back */
-      ubyte value_mask[2];
-      ubyte write_mask[2];
-   } stencil;
-};
+      unsigned enabled:1;
+      unsigned func:3;     /**< PIPE_FUNC_x */
+      unsigned fail_op:3;  /**< PIPE_STENCIL_OP_x */
+      unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */
+      unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */
+      ubyte ref_value;    
+      ubyte value_mask;
+      ubyte write_mask;
+   } stencil[2];               /**< [0] = front, [1] = back */
 
-struct pipe_alpha_test_state {
-   unsigned enabled:1;
-   unsigned func:3;    /**< PIPE_FUNC_x */
-   float ref;      /**< reference value */
+   struct {
+      unsigned enabled:1;
+      unsigned func:3;    /**< PIPE_FUNC_x */
+      float ref;      /**< reference value */
+   } alpha;
 };
 
+
 struct pipe_blend_state {
    unsigned blend_enable:1;
 
index b62e691e87d856ec2c8747c3e828beabecbd413c..b6995b8a6cda55929de0c635851ba560d029c1f5 100644 (file)
@@ -240,10 +240,6 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
    softpipe->pipe.get_paramf = softpipe_get_paramf;
 
    /* state setters */
-   softpipe->pipe.create_alpha_test_state = softpipe_create_alpha_test_state;
-   softpipe->pipe.bind_alpha_test_state   = softpipe_bind_alpha_test_state;
-   softpipe->pipe.delete_alpha_test_state = softpipe_delete_alpha_test_state;
-
    softpipe->pipe.create_blend_state = softpipe_create_blend_state;
    softpipe->pipe.bind_blend_state   = softpipe_bind_blend_state;
    softpipe->pipe.delete_blend_state = softpipe_delete_blend_state;
@@ -252,9 +248,9 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
    softpipe->pipe.bind_sampler_state   = softpipe_bind_sampler_state;
    softpipe->pipe.delete_sampler_state = softpipe_delete_sampler_state;
 
-   softpipe->pipe.create_depth_stencil_state = softpipe_create_depth_stencil_state;
-   softpipe->pipe.bind_depth_stencil_state   = softpipe_bind_depth_stencil_state;
-   softpipe->pipe.delete_depth_stencil_state = softpipe_delete_depth_stencil_state;
+   softpipe->pipe.create_depth_stencil_alpha_state = softpipe_create_depth_stencil_state;
+   softpipe->pipe.bind_depth_stencil_alpha_state   = softpipe_bind_depth_stencil_state;
+   softpipe->pipe.delete_depth_stencil_alpha_state = softpipe_delete_depth_stencil_state;
 
    softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state;
    softpipe->pipe.bind_rasterizer_state   = softpipe_bind_rasterizer_state;
index 8fd44933f263964ad38b3b0411b7cce30451966c..8f14dd11d17a71433db49d73c6119f7fdcca77bc 100644 (file)
@@ -53,13 +53,13 @@ struct softpipe_tile_cache;
 #define SP_NEW_SCISSOR       0x20
 #define SP_NEW_STIPPLE       0x40
 #define SP_NEW_FRAMEBUFFER   0x80
-#define SP_NEW_ALPHA_TEST    0x100
-#define SP_NEW_DEPTH_STENCIL 0x200
+#define SP_NEW_DEPTH_STENCIL_ALPHA 0x100
+#define SP_NEW_CONSTANTS     0x200
 #define SP_NEW_SAMPLER       0x400
 #define SP_NEW_TEXTURE       0x800
 #define SP_NEW_VERTEX        0x1000
 #define SP_NEW_VS            0x2000
-#define SP_NEW_CONSTANTS     0x4000
+#define SP_NEW_QUERY         0x4000
 
 struct sp_vertex_shader_state {
    struct pipe_shader_state *state;
@@ -73,10 +73,9 @@ struct softpipe_context {
 
    /* The most recent drawing state as set by the driver:
     */
-   const struct pipe_alpha_test_state *alpha_test;
    const struct pipe_blend_state   *blend;
    const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
-   const struct pipe_depth_stencil_state   *depth_stencil;
+   const struct pipe_depth_stencil_alpha_state   *depth_stencil;
    const struct pipe_rasterizer_state *rasterizer;
    const struct sp_fragment_shader_state *fs;
    const struct sp_vertex_shader_state *vs;
index 6330465a8b960fd472c844997b1a5aef3a72dda9..a10c9c3e02415559e232c68d000059d524b70b08 100644 (file)
@@ -43,8 +43,8 @@ static void
 sp_build_depth_stencil(
    struct softpipe_context *sp )
 {
-   if (sp->depth_stencil->stencil.front_enabled ||
-       sp->depth_stencil->stencil.back_enabled) {
+   if (sp->depth_stencil->stencil[0].enabled ||
+       sp->depth_stencil->stencil[1].enabled) {
       sp_push_quad_first( sp, sp->quad.stencil_test );
    }
    else if (sp->depth_stencil->depth.enabled &&
@@ -59,7 +59,7 @@ sp_build_quad_pipeline(struct softpipe_context *sp)
    boolean  early_depth_test =
                sp->depth_stencil->depth.enabled &&
                sp->framebuffer.zbuf &&
-               !sp->alpha_test->enabled &&
+               !sp->depth_stencil->alpha.enabled &&
                sp->fs->shader.output_semantic_name[0] != TGSI_SEMANTIC_POSITION;
 
    /* build up the pipeline in reverse order... */
@@ -98,7 +98,7 @@ sp_build_quad_pipeline(struct softpipe_context *sp)
       sp_build_depth_stencil( sp );
    }
 
-   if (sp->alpha_test->enabled) {
+   if (sp->depth_stencil->alpha.enabled) {
       sp_push_quad_first( sp, sp->quad.alpha_test );
    }
 
index d056abe98d9d34ad69f63f15ca24e6d627dfd1e7..4ffeac35e167254518108d05698010f8281253ae 100644 (file)
@@ -14,11 +14,11 @@ static void
 alpha_test_quad(struct quad_stage *qs, struct quad_header *quad)
 {
    struct softpipe_context *softpipe = qs->softpipe;
-   const float ref = softpipe->alpha_test->ref;
+   const float ref = softpipe->depth_stencil->alpha.ref;
    unsigned passMask = 0x0, j;
    const float *aaaa = quad->outputs.color[3];
 
-   switch (softpipe->alpha_test->func) {
+   switch (softpipe->depth_stencil->alpha.func) {
    case PIPE_FUNC_NEVER:
       quad->mask = 0x0;
       break;
index 3f3eca078b081ac28b4789d342949b67d8c4edca..a688a06c74702c0b9c8b2ae05acbdbf230ec673a 100644 (file)
@@ -211,24 +211,13 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
 
    /* choose front or back face function, operator, etc */
    /* XXX we could do these initializations once per primitive */
-   if (softpipe->depth_stencil->stencil.back_enabled && quad->facing) {
-      func = softpipe->depth_stencil->stencil.back_func;
-      failOp = softpipe->depth_stencil->stencil.back_fail_op;
-      zFailOp = softpipe->depth_stencil->stencil.back_zfail_op;
-      zPassOp = softpipe->depth_stencil->stencil.back_zpass_op;
-      ref = softpipe->depth_stencil->stencil.ref_value[1];
-      wrtMask = softpipe->depth_stencil->stencil.write_mask[1];
-      valMask = softpipe->depth_stencil->stencil.value_mask[1];
-   }
-   else {
-      func = softpipe->depth_stencil->stencil.front_func;
-      failOp = softpipe->depth_stencil->stencil.front_fail_op;
-      zFailOp = softpipe->depth_stencil->stencil.front_zfail_op;
-      zPassOp = softpipe->depth_stencil->stencil.front_zpass_op;
-      ref = softpipe->depth_stencil->stencil.ref_value[0];
-      wrtMask = softpipe->depth_stencil->stencil.write_mask[0];
-      valMask = softpipe->depth_stencil->stencil.value_mask[0];
-   }
+   func    = softpipe->depth_stencil->stencil[quad->facing].func;
+   failOp  = softpipe->depth_stencil->stencil[quad->facing].fail_op;
+   zFailOp = softpipe->depth_stencil->stencil[quad->facing].zfail_op;
+   zPassOp = softpipe->depth_stencil->stencil[quad->facing].zpass_op;
+   ref     = softpipe->depth_stencil->stencil[quad->facing].ref_value;
+   wrtMask = softpipe->depth_stencil->stencil[quad->facing].write_mask;
+   valMask = softpipe->depth_stencil->stencil[quad->facing].value_mask;
 
    assert(ps); /* shouldn't get here if there's no stencil buffer */
 
index a3bd078a718dd3ca0963dc81177e8096e4a5e2d6..76b79b528038c6d8ac8b0c31c9d15101459296a2 100644 (file)
@@ -52,13 +52,6 @@ struct sp_fragment_shader_state {
 #endif
 };
 
-void *
-softpipe_create_alpha_test_state(struct pipe_context *,
-                                 const struct pipe_alpha_test_state *);
-void
-softpipe_bind_alpha_test_state(struct pipe_context *, void *);
-void
-softpipe_delete_alpha_test_state(struct pipe_context *, void *);
 
 void *
 softpipe_create_blend_state(struct pipe_context *,
@@ -76,7 +69,7 @@ void softpipe_delete_sampler_state(struct pipe_context *, void *);
 
 void *
 softpipe_create_depth_stencil_state(struct pipe_context *,
-                                    const struct pipe_depth_stencil_state *);
+                                    const struct pipe_depth_stencil_alpha_state *);
 void softpipe_bind_depth_stencil_state(struct pipe_context *, void *);
 void softpipe_delete_depth_stencil_state(struct pipe_context *, void *);
 
index 5ceec2513f19ff66f93a89e9d8927cc5681ae6e4..160ca5cbc09d35f1937eb0e6f562e57bde6af486 100644 (file)
@@ -73,40 +73,14 @@ void softpipe_set_blend_color( struct pipe_context *pipe,
  * into one file.
  */
 
-void *
-softpipe_create_alpha_test_state(struct pipe_context *pipe,
-                                 const struct pipe_alpha_test_state *alpha)
-{
-   struct pipe_alpha_test_state *state = MALLOC( sizeof(struct pipe_alpha_test_state) );
-   memcpy(state, alpha, sizeof(struct pipe_alpha_test_state));
-   return state;
-}
-
-void
-softpipe_bind_alpha_test_state(struct pipe_context *pipe,
-                               void *alpha)
-{
-   struct softpipe_context *softpipe = softpipe_context(pipe);
-
-   softpipe->alpha_test = (const struct pipe_alpha_test_state *)alpha;
-
-   softpipe->dirty |= SP_NEW_ALPHA_TEST;
-}
-
-void
-softpipe_delete_alpha_test_state(struct pipe_context *pipe,
-                                 void *alpha)
-{
-   FREE( alpha );
-}
 
 void *
 softpipe_create_depth_stencil_state(struct pipe_context *pipe,
-                              const struct pipe_depth_stencil_state *depth_stencil)
+                                   const struct pipe_depth_stencil_alpha_state *depth_stencil)
 {
-   struct pipe_depth_stencil_state *state =
-      MALLOC( sizeof(struct pipe_depth_stencil_state) );
-   memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_state));
+   struct pipe_depth_stencil_alpha_state *state =
+      MALLOC( sizeof(struct pipe_depth_stencil_alpha_state) );
+   memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_alpha_state));
    return state;
 }
 
@@ -116,9 +90,9 @@ softpipe_bind_depth_stencil_state(struct pipe_context *pipe,
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
 
-   softpipe->depth_stencil = (const struct pipe_depth_stencil_state *)depth_stencil;
+   softpipe->depth_stencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil;
 
-   softpipe->dirty |= SP_NEW_DEPTH_STENCIL;
+   softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA;
 }
 
 void
index 736ac1c33b2eedbe7ad5fd3532acca6a7b047714..94072a2d305d59d96bfca8a4dcf1dee6a700f0c4 100644 (file)
@@ -201,16 +201,16 @@ void softpipe_update_derived( struct softpipe_context *softpipe )
       calculate_vertex_layout( softpipe );
 
    if (softpipe->dirty & (SP_NEW_SCISSOR |
-                          SP_NEW_DEPTH_STENCIL |
+                          SP_NEW_DEPTH_STENCIL_ALPHA |
                           SP_NEW_FRAMEBUFFER))
       compute_cliprect(softpipe);
 
    if (softpipe->dirty & (SP_NEW_BLEND |
-                          SP_NEW_DEPTH_STENCIL |
-                          SP_NEW_ALPHA_TEST |
+                          SP_NEW_DEPTH_STENCIL_ALPHA |
                           SP_NEW_FRAMEBUFFER |
                           SP_NEW_RASTERIZER |
-                          SP_NEW_FS))
+                          SP_NEW_FS | 
+                         SP_NEW_QUERY))
       sp_build_quad_pipeline(softpipe);
 
    softpipe->dirty = 0;
index 5d29d20aed4a71ba61971a6e325aacfaee32a6be..56ea6dbce2ed72aa16ab2486f02ba81745476f1b 100644 (file)
@@ -201,7 +201,6 @@ PIPEUTIL_SOURCES = \
 
 STATETRACKER_SOURCES = \
        state_tracker/st_atom.c \
-       state_tracker/st_atom_alphatest.c \
        state_tracker/st_atom_blend.c \
        state_tracker/st_atom_clip.c \
        state_tracker/st_atom_constbuf.c \
index bde81edd8c6d80adec054acc7ba05984497f8627..0e22a2fa6e74546563ac9bd883ae2ee8140566cf 100644 (file)
@@ -45,7 +45,7 @@
 static const struct st_tracked_state *atoms[] =
 {
    &st_update_framebuffer,
-   &st_update_depth_stencil,
+   &st_update_depth_stencil_alpha,
    &st_update_clip,
 
    &st_update_shader,
@@ -59,7 +59,6 @@ static const struct st_tracked_state *atoms[] =
    &st_update_texture,
    &st_update_vs_constants,
    &st_update_fs_constants,
-   &st_update_alpha_test,
    &st_update_pixel_transfer
 };
 
index 0114f42ba523f70602b4846cb981bc2c4974b8ca..3a63e2dec036742c842c91d46bd49e1572fb3547 100644 (file)
@@ -46,7 +46,7 @@ void st_validate_state( struct st_context *st );
 
 const struct st_tracked_state st_update_framebuffer;
 const struct st_tracked_state st_update_clip;
-const struct st_tracked_state st_update_depth_stencil;
+const struct st_tracked_state st_update_depth_stencil_alpha;
 const struct st_tracked_state st_update_shader;
 const struct st_tracked_state st_update_rasterizer;
 const struct st_tracked_state st_update_polygon_stipple;
@@ -57,7 +57,6 @@ const struct st_tracked_state st_update_sampler;
 const struct st_tracked_state st_update_texture;
 const struct st_tracked_state st_update_fs_constants;
 const struct st_tracked_state st_update_vs_constants;
-const struct st_tracked_state st_update_alpha_test;
 const struct st_tracked_state st_update_pixel_transfer;
 
 
diff --git a/src/mesa/state_tracker/st_atom_alphatest.c b/src/mesa/state_tracker/st_atom_alphatest.c
deleted file mode 100644 (file)
index 873520a..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
- /*
-  * Authors:
-  *   Keith Whitwell <keith@tungstengraphics.com>
-  *   Brian Paul
-  */
-
-#include "st_context.h"
-#include "st_cache.h"
-#include "st_atom.h"
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-
-
-/**
- * Convert GLenum stencil func tokens to pipe tokens.
- */
-static GLuint
-gl_alpha_func_to_sp(GLenum func)
-{
-   /* Same values, just biased */
-   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;
-}
-
-
-static void 
-update_alpha_test( struct st_context *st )
-{
-   struct pipe_alpha_test_state alpha;
-   const struct cso_alpha_test *cso;
-
-   memset(&alpha, 0, sizeof(alpha));
-
-   if (st->ctx->Color.AlphaEnabled) {
-      alpha.enabled = 1;
-      alpha.func = gl_alpha_func_to_sp(st->ctx->Color.AlphaFunc);
-      alpha.ref = st->ctx->Color.AlphaRef;
-   }
-   cso = st_cached_alpha_test_state(st, &alpha);
-   if (st->state.alpha_test != cso) {
-      /* state has changed */
-      st->state.alpha_test = cso;
-      st->pipe->bind_alpha_test_state(st->pipe, cso->data); /* bind new state */
-   }
-}
-
-
-const struct st_tracked_state st_update_alpha_test = {
-   .name = "st_update_alpha_test",
-   .dirty = {
-      .mesa = (_NEW_COLOR),
-      .st  = 0,
-   },
-   .update = update_alpha_test
-};
index e785434cecfeef03394b4d68c3a1fbec8925e597..7aecdbfbcc0e73e7c0caf8d88ee191592be0fb9f 100644 (file)
@@ -91,10 +91,10 @@ gl_stencil_op_to_pipe(GLenum func)
 }
 
 static void
-update_depth_stencil(struct st_context *st)
+update_depth_stencil_alpha(struct st_context *st)
 {
-   struct pipe_depth_stencil_state depth_stencil;
-   const struct cso_depth_stencil *cso;
+   struct pipe_depth_stencil_alpha_state depth_stencil;
+   const struct cso_depth_stencil_alpha *cso;
 
    memset(&depth_stencil, 0, sizeof(depth_stencil));
 
@@ -107,40 +107,47 @@ update_depth_stencil(struct st_context *st)
       depth_stencil.depth.occlusion_count = 1;
 
    if (st->ctx->Stencil.Enabled) {
-      depth_stencil.stencil.front_enabled = 1;
-      depth_stencil.stencil.front_func = st_compare_func_to_pipe(st->ctx->Stencil.Function[0]);
-      depth_stencil.stencil.front_fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[0]);
-      depth_stencil.stencil.front_zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[0]);
-      depth_stencil.stencil.front_zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[0]);
-      depth_stencil.stencil.ref_value[0] = st->ctx->Stencil.Ref[0] & 0xff;
-      depth_stencil.stencil.value_mask[0] = st->ctx->Stencil.ValueMask[0] & 0xff;
-      depth_stencil.stencil.write_mask[0] = st->ctx->Stencil.WriteMask[0] & 0xff;
+      depth_stencil.stencil[0].enabled = 1;
+      depth_stencil.stencil[0].func = st_compare_func_to_pipe(st->ctx->Stencil.Function[0]);
+      depth_stencil.stencil[0].fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[0]);
+      depth_stencil.stencil[0].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[0]);
+      depth_stencil.stencil[0].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[0]);
+      depth_stencil.stencil[0].ref_value = st->ctx->Stencil.Ref[0] & 0xff;
+      depth_stencil.stencil[0].value_mask = st->ctx->Stencil.ValueMask[0] & 0xff;
+      depth_stencil.stencil[0].write_mask = st->ctx->Stencil.WriteMask[0] & 0xff;
+
       if (st->ctx->Stencil.TestTwoSide) {
-         depth_stencil.stencil.back_enabled = 1;
-         depth_stencil.stencil.back_func = st_compare_func_to_pipe(st->ctx->Stencil.Function[1]);
-         depth_stencil.stencil.back_fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[1]);
-         depth_stencil.stencil.back_zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[1]);
-         depth_stencil.stencil.back_zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[1]);
-         depth_stencil.stencil.ref_value[1] = st->ctx->Stencil.Ref[1] & 0xff;
-         depth_stencil.stencil.value_mask[1] = st->ctx->Stencil.ValueMask[1] & 0xff;
-         depth_stencil.stencil.write_mask[1] = st->ctx->Stencil.WriteMask[1] & 0xff;
+         depth_stencil.stencil[1].enabled = 1;
+         depth_stencil.stencil[1].func = st_compare_func_to_pipe(st->ctx->Stencil.Function[1]);
+         depth_stencil.stencil[1].fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[1]);
+         depth_stencil.stencil[1].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[1]);
+         depth_stencil.stencil[1].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[1]);
+         depth_stencil.stencil[1].ref_value = st->ctx->Stencil.Ref[1] & 0xff;
+         depth_stencil.stencil[1].value_mask = st->ctx->Stencil.ValueMask[1] & 0xff;
+         depth_stencil.stencil[1].write_mask = st->ctx->Stencil.WriteMask[1] & 0xff;
       }
    }
 
-   cso = st_cached_depth_stencil_state(st, &depth_stencil);
+   if (st->ctx->Color.AlphaEnabled) {
+      depth_stencil.alpha.enabled = 1;
+      depth_stencil.alpha.func = st_compare_func_to_pipe(st->ctx->Color.AlphaFunc);
+      depth_stencil.alpha.ref = st->ctx->Color.AlphaRef;
+   }
+
+   cso = st_cached_depth_stencil_alpha_state(st, &depth_stencil);
    if (st->state.depth_stencil != cso) {
       /* state has changed */
       st->state.depth_stencil = cso;
-      st->pipe->bind_depth_stencil_state(st->pipe, cso->data); /* bind new state */
+      st->pipe->bind_depth_stencil_alpha_state(st->pipe, cso->data); /* bind new state */
    }
 }
 
 
-const struct st_tracked_state st_update_depth_stencil = {
+const struct st_tracked_state st_update_depth_stencil_alpha = {
    .name = "st_update_depth_stencil",
    .dirty = {
-      .mesa = (_NEW_DEPTH|_NEW_STENCIL),
+      .mesa = (_NEW_DEPTH|_NEW_STENCIL|_NEW_COLOR),
       .st  = 0,
    },
-   .update = update_depth_stencil
+   .update = update_depth_stencil_alpha
 };
index c0f712ba1d1594e5c16efc49a4fb349a874271b9..e0965b217ab9d17c72603867555667fb08e619de 100644 (file)
@@ -87,24 +87,25 @@ st_cached_sampler_state(struct st_context *st,
    return (struct cso_sampler*)(cso_hash_iter_data(iter));
 }
 
-const struct cso_depth_stencil *
-st_cached_depth_stencil_state(struct st_context *st,
-                              const struct pipe_depth_stencil_state *templ)
+const struct cso_depth_stencil_alpha *
+st_cached_depth_stencil_alpha_state(struct st_context *st,
+                              const struct pipe_depth_stencil_alpha_state *templ)
 {
    unsigned hash_key = cso_construct_key((void*)templ,
-                                         sizeof(struct pipe_depth_stencil_state));
+                                         sizeof(struct pipe_depth_stencil_alpha_state));
    struct cso_hash_iter iter = cso_find_state_template(st->cache,
-                                                       hash_key, CSO_DEPTH_STENCIL,
+                                                       hash_key, 
+                                                      CSO_DEPTH_STENCIL_ALPHA,
                                                        (void*)templ);
    if (cso_hash_iter_is_null(iter)) {
-      struct cso_depth_stencil *cso = malloc(sizeof(struct cso_depth_stencil));
-      memcpy(&cso->state, templ, sizeof(struct pipe_depth_stencil_state));
-      cso->data = st->pipe->create_depth_stencil_state(st->pipe, &cso->state);
+      struct cso_depth_stencil_alpha *cso = malloc(sizeof(struct cso_depth_stencil_alpha));
+      memcpy(&cso->state, templ, sizeof(struct pipe_depth_stencil_alpha_state));
+      cso->data = st->pipe->create_depth_stencil_alpha_state(st->pipe, &cso->state);
       if (!cso->data)
          cso->data = &cso->state;
-      iter = cso_insert_state(st->cache, hash_key, CSO_DEPTH_STENCIL, cso);
+      iter = cso_insert_state(st->cache, hash_key, CSO_DEPTH_STENCIL_ALPHA, cso);
    }
-   return (struct cso_depth_stencil*)(cso_hash_iter_data(iter));
+   return (struct cso_depth_stencil_alpha*)(cso_hash_iter_data(iter));
 }
 
 const struct cso_rasterizer* st_cached_rasterizer_state(
@@ -167,22 +168,3 @@ st_cached_vs_state(struct st_context *st,
    return (struct cso_vertex_shader*)(cso_hash_iter_data(iter));
 }
 
-const struct cso_alpha_test *
-st_cached_alpha_test_state(struct st_context *st,
-                           const struct pipe_alpha_test_state *templ)
-{
-   unsigned hash_key = cso_construct_key((void*)templ,
-                                         sizeof(struct pipe_alpha_test_state));
-   struct cso_hash_iter iter = cso_find_state_template(st->cache,
-                                                       hash_key, CSO_ALPHA_TEST,
-                                                       (void*)templ);
-   if (cso_hash_iter_is_null(iter)) {
-      struct cso_alpha_test *cso = malloc(sizeof(struct cso_alpha_test));
-      memcpy(&cso->state, templ, sizeof(struct pipe_alpha_test_state));
-      cso->data = st->pipe->create_alpha_test_state(st->pipe, &cso->state);
-      if (!cso->data)
-         cso->data = &cso->state;
-      iter = cso_insert_state(st->cache, hash_key, CSO_ALPHA_TEST, cso);
-   }
-   return ((struct cso_alpha_test *)cso_hash_iter_data(iter));
-}
index 422f668c56195a0b65774e5af7683209c7fbfe38..e0c176b0ffc0bec9861d584297aaad7ac58f9e4d 100644 (file)
@@ -39,9 +39,6 @@ struct pipe_blend_state;
 struct pipe_sampler_state;
 struct st_context;
 
-const struct cso_alpha_test *
-st_cached_alpha_test_state(struct st_context *st,
-                           const struct pipe_alpha_test_state *alpha);
 
 const struct cso_blend *
 st_cached_blend_state(struct st_context *st,
@@ -51,9 +48,9 @@ const struct cso_sampler *
 st_cached_sampler_state(struct st_context *st,
                         const struct pipe_sampler_state *sampler);
 
-const struct cso_depth_stencil *
-st_cached_depth_stencil_state(struct st_context *st,
-                              const struct pipe_depth_stencil_state *depth_stencil);
+const struct cso_depth_stencil_alpha *
+st_cached_depth_stencil_alpha_state(struct st_context *st,
+                              const struct pipe_depth_stencil_alpha_state *depth_stencil);
 
 const struct cso_rasterizer *
 st_cached_rasterizer_state(struct st_context *st,
index b4b2429a2aab8635adf4bc8850b182ad2fc37bbe..40319f4b4b87cfac6e045ea31cf9b0ec221e7db8 100644 (file)
@@ -272,14 +272,6 @@ clear_with_quad(GLcontext *ctx,
    const GLfloat x1 = ctx->DrawBuffer->_Xmax;
    const GLfloat y1 = ctx->DrawBuffer->_Ymax;
 
-   /* alpha state: disabled */
-   {
-      struct pipe_alpha_test_state alpha_test;
-      const struct cso_alpha_test *cso;
-      memset(&alpha_test, 0, sizeof(alpha_test));
-      cso = st_cached_alpha_test_state(st, &alpha_test);
-      pipe->bind_alpha_test_state(pipe, cso->data);
-   }
 
    /* blend state: RGBA masking */
    {
@@ -304,8 +296,8 @@ clear_with_quad(GLcontext *ctx,
 
    /* depth_stencil state: always pass/set to ref value */
    {
-      struct pipe_depth_stencil_state depth_stencil;
-      const struct cso_depth_stencil *cso;
+      struct pipe_depth_stencil_alpha_state depth_stencil;
+      const struct cso_depth_stencil_alpha *cso;
       memset(&depth_stencil, 0, sizeof(depth_stencil));
       if (depth) {
          depth_stencil.depth.enabled = 1;
@@ -314,17 +306,17 @@ clear_with_quad(GLcontext *ctx,
       }
 
       if (stencil) {
-         depth_stencil.stencil.front_enabled = 1;
-         depth_stencil.stencil.front_func = PIPE_FUNC_ALWAYS;
-         depth_stencil.stencil.front_fail_op = PIPE_STENCIL_OP_REPLACE;
-         depth_stencil.stencil.front_zpass_op = PIPE_STENCIL_OP_REPLACE;
-         depth_stencil.stencil.front_zfail_op = PIPE_STENCIL_OP_REPLACE;
-         depth_stencil.stencil.ref_value[0] = ctx->Stencil.Clear;
-         depth_stencil.stencil.value_mask[0] = 0xff;
-         depth_stencil.stencil.write_mask[0] = ctx->Stencil.WriteMask[0] & 0xff;
+         depth_stencil.stencil[0].enabled = 1;
+         depth_stencil.stencil[0].func = PIPE_FUNC_ALWAYS;
+         depth_stencil.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE;
+         depth_stencil.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
+         depth_stencil.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE;
+         depth_stencil.stencil[0].ref_value = ctx->Stencil.Clear;
+         depth_stencil.stencil[0].value_mask = 0xff;
+         depth_stencil.stencil[0].write_mask = ctx->Stencil.WriteMask[0] & 0xff;
       }
-      cso = st_cached_depth_stencil_state(st, &depth_stencil);
-      pipe->bind_depth_stencil_state(pipe, cso->data);
+      cso = st_cached_depth_stencil_alpha_state(st, &depth_stencil);
+      pipe->bind_depth_stencil_alpha_state(pipe, cso->data);
    }
 
    /* rasterizer state: nothing */
@@ -381,9 +373,8 @@ clear_with_quad(GLcontext *ctx,
    draw_quad(ctx, x0, y0, x1, y1, ctx->Depth.Clear, ctx->Color.ClearColor);
 
    /* Restore pipe state */
-   pipe->bind_alpha_test_state(pipe, st->state.alpha_test->data);
    pipe->bind_blend_state(pipe, st->state.blend->data);
-   pipe->bind_depth_stencil_state(pipe, st->state.depth_stencil->data);
+   pipe->bind_depth_stencil_alpha_state(pipe, st->state.depth_stencil->data);
    pipe->bind_fs_state(pipe, st->state.fs->data);
    pipe->bind_vs_state(pipe, st->state.vs->data);
    pipe->bind_rasterizer_state(pipe, st->state.rasterizer->data);
index 0bc48b70396a974fefc3e08b541a574adbc332d5..e70a5b49e125271d6726158846d7c53c5d08b591 100644 (file)
@@ -789,7 +789,7 @@ compatible_formats(GLenum format, GLenum type, enum pipe_format pipeFormat)
 static GLboolean
 any_fragment_ops(const struct st_context *st)
 {
-   if (st->state.alpha_test->state.enabled ||
+   if (st->state.depth_stencil->state.alpha.enabled ||
        st->state.blend->state.blend_enable ||
        st->state.blend->state.logicop_enable ||
        st->state.depth_stencil->state.depth.enabled)
index 87646b3c71341f80d51c176ec977f567e8b072d3..c3919d474cfad627d669e9fc9fd723fd9f2fbd85 100644 (file)
@@ -97,7 +97,7 @@ struct st_context
       const struct cso_alpha_test      *alpha_test;
       const struct cso_blend           *blend;
       const struct cso_sampler         *sampler[PIPE_MAX_SAMPLERS];
-      const struct cso_depth_stencil   *depth_stencil;
+      const struct cso_depth_stencil_alpha   *depth_stencil;
       const struct cso_rasterizer      *rasterizer;
       const struct cso_fragment_shader *fs;
       const struct cso_vertex_shader   *vs;