From f117327a3f246713abfd4dc4320d4a1a7f1b811a Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 17 Sep 2007 09:47:41 -0400 Subject: Make sampler an immutable state object. Switch the sample to be an immutable state object. --- src/mesa/state_tracker/st_atom_sampler.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/mesa/state_tracker/st_atom_sampler.c') diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index d65565f991..9a728e2d79 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -33,6 +33,7 @@ #include "st_context.h" +#include "st_cache.h" #include "st_atom.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -142,10 +143,13 @@ update_samplers(struct st_context *st) /* XXX more sampler state here */ } - if (memcmp(&sampler, &st->state.sampler[u], sizeof(sampler)) != 0) { + const struct pipe_sampler_state *cached_sampler = + st_cached_sampler_state(st, &sampler); + + if (cached_sampler == st->state.sampler[u]) { /* state has changed */ - st->state.sampler[u] = sampler; - st->pipe->set_sampler_state(st->pipe, u, &sampler); + st->state.sampler[u] = cached_sampler; + st->pipe->bind_sampler_state(st->pipe, u, cached_sampler); } } } -- cgit v1.2.3