diff options
author | Dave Airlie <[email protected]> | 2012-02-07 16:18:05 +0000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2012-02-08 12:12:10 +0000 |
commit | 833a33bf6e085a79ec74c5f296a8e55ebec9f9b5 (patch) | |
tree | b14c8bcd614ab3b3d64fa0272e09f7ebe2149034 /src | |
parent | 33f4461ec9e35b8de13d68b628dc1b0854c2314c (diff) |
st/mesa: avoid vertex texture and sampler updates for 0 case
If we had no vertex textures or samplers previously and we have none now,
don't bother doing the enables dance.
I was profiling nexuiz on noop and noticed these two functions in the
profile, this drops their usage from 0.86% to 0.03% and 0.23% to 0.03%
for texture and samplers.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_atom_sampler.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_texture.c | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index ad159c64dc1..8845fed512f 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -201,6 +201,8 @@ update_vertex_samplers(struct st_context *st) struct gl_vertex_program *vprog = ctx->VertexProgram._Current; GLuint su; + if (st->state.num_vertex_samplers == 0 && vprog->Base.SamplersUsed == 0) + return; st->state.num_vertex_samplers = 0; /* loop over sampler units (aka tex image units) */ diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 88e6128c8f7..d241527cc6a 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -260,6 +260,9 @@ update_vertex_textures(struct st_context *st) struct gl_vertex_program *vprog = ctx->VertexProgram._Current; GLuint su; + if (!vprog->Base.SamplersUsed && st->state.num_vertex_textures == 0) + return; + st->state.num_vertex_textures = 0; /* loop over sampler units (aka tex image units) */ |