r600g: use memcmp instead of a loop in state_set_resource
authorDave Airlie <airlied@redhat.com>
Tue, 7 Jun 2011 00:38:46 +0000 (10:38 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 8 Jun 2011 01:46:50 +0000 (11:46 +1000)
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/winsys/r600/drm/r600_hw_context.c

index 6b62d163860c690198defd8a95e4821dd2f170ce..cd52eadbf5ce5196040e1c114bf1f5b8ecdf8c3d 100644 (file)
@@ -1070,11 +1070,9 @@ void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_
        is_vertex = ((state->val[num_regs-1] & 0xc0000000) == 0xc0000000);
        dirty = block->status & R600_BLOCK_STATUS_DIRTY;
 
-       for (i = 0; i < num_regs; i++) {
-               if (dirty || (block->reg[i] != state->val[i])) {
-                       dirty |= R600_BLOCK_STATUS_DIRTY;
-                       block->reg[i] = state->val[i];
-               }
+       if (memcmp(block->reg, state->val, num_regs*4)) {
+               memcpy(block->reg, state->val, num_regs * 4);
+               dirty |= R600_BLOCK_STATUS_DIRTY;
        }
 
        /* if no BOs on block, force dirty */