It really happens.
v2: declare "magic" in debug builds only
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
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.
bool is_stencil_sampler;
};
+#define SI_SAMPLER_STATE_MAGIC 0x34f1c35a
+
struct si_sampler_state {
+#ifdef DEBUG
+ unsigned magic;
+#endif
uint32_t val[4];
};
}
}
+#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)) |
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);
}