summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-07-30 17:43:41 -0400
committerMarek Olšák <[email protected]>2019-08-06 17:08:39 -0400
commit8b8819e88af0070c242d2d4289ace0eebedbc09c (patch)
treef89a0b09c866595bfe06042ea5238c8325bfc4b4 /src
parentb758eed9c373db14a5acc04d9522ec9d74e51f1b (diff)
radeonsi: make sure that DSA state != NULL and remove all NULL checking
Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c7
-rw-r--r--src/gallium/auxiliary/util/u_blitter.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c3
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c12
-rw-r--r--src/gallium/drivers/radeonsi/si_state_binning.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c5
7 files changed, 19 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index ff4e9a721b3..036c04fda9e 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -347,6 +347,13 @@ void *util_blitter_get_noop_blend_state(struct blitter_context *blitter)
return ctx->blend[0][0];
}
+void *util_blitter_get_noop_dsa_state(struct blitter_context *blitter)
+{
+ struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
+
+ return ctx->dsa_keep_depth_stencil;
+}
+
static void bind_vs_pos_only(struct blitter_context_priv *ctx,
unsigned num_so_channels)
{
diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h
index 0db9c2a2816..6d25ba57671 100644
--- a/src/gallium/auxiliary/util/u_blitter.h
+++ b/src/gallium/auxiliary/util/u_blitter.h
@@ -155,6 +155,7 @@ void util_blitter_destroy(struct blitter_context *blitter);
void util_blitter_cache_all_shaders(struct blitter_context *blitter);
void *util_blitter_get_noop_blend_state(struct blitter_context *blitter);
+void *util_blitter_get_noop_dsa_state(struct blitter_context *blitter);
/**
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 98f15db8cad..ab5c9064d0a 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -547,6 +547,9 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
sctx->noop_blend = util_blitter_get_noop_blend_state(sctx->blitter);
sctx->queued.named.blend = sctx->noop_blend;
+ sctx->noop_dsa = util_blitter_get_noop_dsa_state(sctx->blitter);
+ sctx->queued.named.dsa = sctx->noop_dsa;
+
si_init_draw_functions(sctx);
si_initialize_prim_discard_tunables(sctx);
}
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 6060c579ceb..2be5f338bb3 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -887,6 +887,7 @@ struct si_context {
struct blitter_context *blitter;
void *noop_blend;
+ void *noop_dsa;
void *custom_dsa_flush;
void *custom_blend_resolve;
void *custom_blend_fmask_decompress;
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index eb191b927c4..fad027a13f2 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1303,8 +1303,8 @@ static void si_bind_dsa_state(struct pipe_context *ctx, void *state)
struct si_state_dsa *old_dsa = sctx->queued.named.dsa;
struct si_state_dsa *dsa = state;
- if (!state)
- return;
+ if (!dsa)
+ dsa = (struct si_state_dsa *)sctx->noop_dsa;
si_pm4_bind_state(sctx, dsa, dsa);
@@ -1314,19 +1314,17 @@ static void si_bind_dsa_state(struct pipe_context *ctx, void *state)
si_mark_atom_dirty(sctx, &sctx->atoms.s.stencil_ref);
}
- if (!old_dsa || old_dsa->alpha_func != dsa->alpha_func)
+ if (old_dsa->alpha_func != dsa->alpha_func)
sctx->do_update_shaders = true;
if (sctx->screen->dpbb_allowed &&
- (!old_dsa ||
- (old_dsa->depth_enabled != dsa->depth_enabled ||
+ ((old_dsa->depth_enabled != dsa->depth_enabled ||
old_dsa->stencil_enabled != dsa->stencil_enabled ||
old_dsa->db_can_write != dsa->db_can_write)))
si_mark_atom_dirty(sctx, &sctx->atoms.s.dpbb_state);
if (sctx->screen->has_out_of_order_rast &&
- (!old_dsa ||
- memcmp(old_dsa->order_invariance, dsa->order_invariance,
+ (memcmp(old_dsa->order_invariance, dsa->order_invariance,
sizeof(old_dsa->order_invariance))))
si_mark_atom_dirty(sctx, &sctx->atoms.s.msaa_config);
}
diff --git a/src/gallium/drivers/radeonsi/si_state_binning.c b/src/gallium/drivers/radeonsi/si_state_binning.c
index ce87acab69a..ba599e055e2 100644
--- a/src/gallium/drivers/radeonsi/si_state_binning.c
+++ b/src/gallium/drivers/radeonsi/si_state_binning.c
@@ -483,7 +483,7 @@ void si_emit_dpbb_state(struct si_context *sctx)
assert(sctx->chip_class >= GFX9);
- if (!sscreen->dpbb_allowed || !dsa || sctx->dpbb_force_off) {
+ if (!sscreen->dpbb_allowed || sctx->dpbb_force_off) {
si_emit_dpbb_disable(sctx);
return;
}
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 81ba9410cdb..5371ac81039 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1689,10 +1689,7 @@ static void si_shader_init_pm4_state(struct si_screen *sscreen,
static unsigned si_get_alpha_test_func(struct si_context *sctx)
{
/* Alpha-test should be disabled if colorbuffer 0 is integer. */
- if (sctx->queued.named.dsa)
- return sctx->queued.named.dsa->alpha_func;
-
- return PIPE_FUNC_ALWAYS;
+ return sctx->queued.named.dsa->alpha_func;
}
void si_shader_selector_key_vs(struct si_context *sctx,