Module: Mesa
Branch: master
Commit: 51e10c27702cf2ca23877ed0230785231e1758f3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=51e10c27702cf2ca23877ed0230785231e1758f3

Author: Marek Olšák <[email protected]>
Date:   Tue Aug 29 20:55:11 2017 +0200

radeonsi: add more state flags into si_state_dsa

3 flags for primitive binning, 2 flags for out-of-order rasterization
(but that will be done some other time)

Reviewed-by: Nicolai Hähnle <[email protected]>

---

 src/gallium/drivers/radeonsi/si_state.c | 17 +++++++++++++++++
 src/gallium/drivers/radeonsi/si_state.h |  7 ++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 2edd9826b2..076b583d96 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1044,6 +1044,14 @@ static uint32_t si_translate_stencil_op(int s_op)
        return 0;
 }
 
+static bool si_dsa_writes_stencil(const struct pipe_stencil_state *s)
+{
+       return s->enabled && s->writemask &&
+              (s->fail_op  != PIPE_STENCIL_OP_KEEP ||
+               s->zfail_op != PIPE_STENCIL_OP_KEEP ||
+               s->zpass_op != PIPE_STENCIL_OP_KEEP);
+}
+
 static void *si_create_dsa_state(struct pipe_context *ctx,
                                 const struct pipe_depth_stencil_alpha_state 
*state)
 {
@@ -1101,6 +1109,15 @@ static void *si_create_dsa_state(struct pipe_context 
*ctx,
                si_pm4_set_reg(pm4, R_028024_DB_DEPTH_BOUNDS_MAX, 
fui(state->depth.bounds_max));
        }
 
+       dsa->depth_enabled = state->depth.enabled;
+       dsa->depth_write_enabled = state->depth.enabled &&
+                                  state->depth.writemask;
+       dsa->stencil_enabled = state->stencil[0].enabled;
+       dsa->stencil_write_enabled = state->stencil[0].enabled &&
+                                    (si_dsa_writes_stencil(&state->stencil[0]) 
||
+                                     
si_dsa_writes_stencil(&state->stencil[1]));
+       dsa->db_can_write = dsa->depth_write_enabled ||
+                           dsa->stencil_write_enabled;
        return dsa;
 }
 
diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index 7b7d96c066..9770960dd2 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -91,8 +91,13 @@ struct si_dsa_stencil_ref_part {
 
 struct si_state_dsa {
        struct si_pm4_state             pm4;
-       unsigned                        alpha_func;
        struct si_dsa_stencil_ref_part  stencil_ref;
+       ubyte                           alpha_func:3;
+       bool                            depth_enabled:1;
+       bool                            depth_write_enabled:1;
+       bool                            stencil_enabled:1;
+       bool                            stencil_write_enabled:1;
+       bool                            db_can_write:1;
 };
 
 struct si_stencil_ref {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to