r600g: only make constant buffers dirty if there's something to update
authorMarek Olšák <maraeo@gmail.com>
Sat, 14 Jul 2012 16:15:29 +0000 (18:15 +0200)
committerMarek Olšák <maraeo@gmail.com>
Tue, 17 Jul 2012 19:22:15 +0000 (21:22 +0200)
src/gallium/drivers/r600/r600_state_common.c

index 23adf3b5746ffef3984ea6afd889c7be6a58e3ee..f1d5d57f8d5513d911dcbc44d00ca6e48ec381b3 100644 (file)
@@ -757,10 +757,12 @@ static void r600_update_alpha_ref(struct r600_context *rctx)
 
 void r600_constant_buffers_dirty(struct r600_context *rctx, struct r600_constbuf_state *state)
 {
-       r600_inval_shader_cache(rctx);
-       state->atom.num_dw = rctx->chip_class >= EVERGREEN ? util_bitcount(state->dirty_mask)*20
-                                                          : util_bitcount(state->dirty_mask)*19;
-       r600_atom_dirty(rctx, &state->atom);
+       if (state->dirty_mask) {
+               r600_inval_shader_cache(rctx);
+               state->atom.num_dw = rctx->chip_class >= EVERGREEN ? util_bitcount(state->dirty_mask)*20
+                                                                  : util_bitcount(state->dirty_mask)*19;
+               r600_atom_dirty(rctx, &state->atom);
+       }
 }
 
 void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,