r300g: do not emit ZTOP every draw call
authorMarek Olšák <maraeo@gmail.com>
Tue, 22 Jun 2010 03:01:58 +0000 (05:01 +0200)
committerMarek Olšák <maraeo@gmail.com>
Tue, 22 Jun 2010 04:50:22 +0000 (06:50 +0200)
src/gallium/drivers/r300/r300_hyperz.c

index 6358d98b8381190245512b6d424ee9e2e2e677e9..e5c76589528ace95aab54e55a1a4dc37e2be1445 100644 (file)
@@ -70,6 +70,7 @@ static void r300_update_ztop(struct r300_context* r300)
 {
     struct r300_ztop_state* ztop_state =
         (struct r300_ztop_state*)r300->ztop_state.state;
+    uint32_t old_ztop = ztop_state->z_buffer_top;
 
     /* This is important enough that I felt it warranted a comment.
      *
@@ -111,7 +112,8 @@ static void r300_update_ztop(struct r300_context* r300)
         ztop_state->z_buffer_top = R300_ZTOP_ENABLE;
     }
 
-    r300->ztop_state.dirty = TRUE;
+    if (ztop_state->z_buffer_top != old_ztop)
+        r300->ztop_state.dirty = TRUE;
 }
 
 void r300_update_hyperz_state(struct r300_context* r300)