summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-05-16 09:44:10 +1000
committerDave Airlie <[email protected]>2011-05-18 17:31:51 +1000
commit6bd8647b54054a59bdb4f0c170c4481eaadc81ff (patch)
tree28b5a3e33743063fe2d3dedae24ef78d8860b49f /src/mesa/state_tracker
parentecc051d65b6e17115439fb3609cccfd59f6272bf (diff)
st/mesa: only memset sampler when about to use it.
This function was taking a lot more CPU than required due to it memsetting a bunch of memory that didn't require it from what I can see. We should only memset here when we are about to fill out the sampler, otherwise we end up doing a bunch of memsets for everytime this function is called, basically setting 0 memory to 0. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index ccbd5489226..06024ad2657 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -133,6 +133,8 @@ static void convert_sampler(struct st_context *st,
}
msamp = _mesa_get_samplerobj(st->ctx, texUnit);
+
+ memset(sampler, 0, sizeof(*sampler));
sampler->wrap_s = gl_wrap_xlate(msamp->WrapS);
sampler->wrap_t = gl_wrap_xlate(msamp->WrapT);
sampler->wrap_r = gl_wrap_xlate(msamp->WrapR);
@@ -201,8 +203,6 @@ update_vertex_samplers(struct st_context *st)
for (su = 0; su < st->ctx->Const.MaxVertexTextureImageUnits; su++) {
struct pipe_sampler_state *sampler = st->state.vertex_samplers + su;
- memset(sampler, 0, sizeof(*sampler));
-
if (vprog->Base.SamplersUsed & (1 << su)) {
GLuint texUnit;
@@ -232,7 +232,6 @@ update_fragment_samplers(struct st_context *st)
for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) {
struct pipe_sampler_state *sampler = st->state.samplers + su;
- memset(sampler, 0, sizeof(*sampler));
if (fprog->Base.SamplersUsed & (1 << su)) {
GLuint texUnit;