summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-12-02 03:34:07 +0100
committerMarek Olšák <[email protected]>2016-12-07 19:40:03 +0100
commit6caa558ca677941f9a2f0570563b51fbe88cd1b9 (patch)
tree15378a5a10bb75f9818e41e9f5484a85955c6265 /src/gallium
parentf2b0c66c3c012023433874b6e28f8cc8c3f64139 (diff)
radeonsi: check for sampler state CSO corruption
It really happens. v2: declare "magic" in debug builds only Reviewed-by: Nicolai Hähnle <[email protected]> (v1)
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c3
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h5
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c9
3 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 8b6e0bbb3a7..7ffd7fa609d 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -803,6 +803,9 @@ static void si_bind_sampler_states(struct pipe_context *ctx,
sstates[i] == samplers->views.sampler_states[slot])
continue;
+#ifdef DEBUG
+ assert(sstates[i]->magic == SI_SAMPLER_STATE_MAGIC);
+#endif
samplers->views.sampler_states[slot] = sstates[i];
/* If FMASK is bound, don't overwrite it.
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 42cbecbf13e..31b7985fef9 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -137,7 +137,12 @@ struct si_sampler_view {
bool is_stencil_sampler;
};
+#define SI_SAMPLER_STATE_MAGIC 0x34f1c35a
+
struct si_sampler_state {
+#ifdef DEBUG
+ unsigned magic;
+#endif
uint32_t val[4];
};
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 1ccf5b6b214..04c1a9f4c66 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -3247,6 +3247,9 @@ static void *si_create_sampler_state(struct pipe_context *ctx,
}
}
+#ifdef DEBUG
+ rstate->magic = SI_SAMPLER_STATE_MAGIC;
+#endif
rstate->val[0] = (S_008F30_CLAMP_X(si_tex_wrap(state->wrap_s)) |
S_008F30_CLAMP_Y(si_tex_wrap(state->wrap_t)) |
S_008F30_CLAMP_Z(si_tex_wrap(state->wrap_r)) |
@@ -3303,6 +3306,12 @@ static void si_emit_sample_mask(struct si_context *sctx, struct r600_atom *atom)
static void si_delete_sampler_state(struct pipe_context *ctx, void *state)
{
+ struct si_sampler_state *s = state;
+
+#ifdef DEBUG
+ assert(s->magic == SI_SAMPLER_STATE_MAGIC);
+ s->magic = 0;
+#endif
free(state);
}