nvc0: save some CPU cycles in nvc0_context_unreference_resources()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 12 May 2016 19:06:05 +0000 (21:06 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 12 May 2016 19:37:08 +0000 (21:37 +0200)
This reduces the number of loop iterations for invalidating buffers
and images.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/nvc0/nvc0_context.c

index d51e89d672fad5fefb08aea90d34fdadb8bc56ab..bf8437130e9e89ce567de030277e78ad13a1ea91 100644 (file)
@@ -150,20 +150,18 @@ nvc0_context_unreference_resources(struct nvc0_context *nvc0)
       for (i = 0; i < NVC0_MAX_PIPE_CONSTBUFS; ++i)
          if (!nvc0->constbuf[s][i].user)
             pipe_resource_reference(&nvc0->constbuf[s][i].u.buf, NULL);
-   }
-
-   for (s = 0; s < 2; ++s) {
-      for (i = 0; i < NVC0_MAX_SURFACE_SLOTS; ++i)
-         pipe_surface_reference(&nvc0->surfaces[s][i], NULL);
-   }
 
-   for (s = 0; s < 6; ++s)
       for (i = 0; i < NVC0_MAX_BUFFERS; ++i)
          pipe_resource_reference(&nvc0->buffers[s][i].buffer, NULL);
 
-   for (s = 0; s < 6; ++s)
       for (i = 0; i < NVC0_MAX_IMAGES; ++i)
          pipe_resource_reference(&nvc0->images[s][i].resource, NULL);
+   }
+
+   for (s = 0; s < 2; ++s) {
+      for (i = 0; i < NVC0_MAX_SURFACE_SLOTS; ++i)
+         pipe_surface_reference(&nvc0->surfaces[s][i], NULL);
+   }
 
    for (i = 0; i < nvc0->num_tfbbufs; ++i)
       pipe_so_target_reference(&nvc0->tfbbuf[i], NULL);