r600g: remove needless wrapper r600_texture_depth_flush
authorMarek Olšák <maraeo@gmail.com>
Tue, 17 Jul 2012 22:17:46 +0000 (00:17 +0200)
committerMarek Olšák <maraeo@gmail.com>
Tue, 17 Jul 2012 22:21:53 +0000 (00:21 +0200)
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_resource.h
src/gallium/drivers/r600/r600_texture.c

index 9429a1bdcc878565cd03f6ac96394668ddd71c2e..6147a9fd610b6bfde077f4160f7cef3f1be64601 100644 (file)
@@ -336,10 +336,15 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
                return;
        }
 
-       if (rsrc->is_depth && !rsrc->is_flushing_texture)
-               r600_texture_depth_flush(ctx, src, NULL,
-                                        src_level, src_level,
-                                        src_box->z, src_box->z + src_box->depth - 1);
+       /* This must be done before entering u_blitter to avoid recursion. */
+       if (rsrc->is_depth && !rsrc->is_flushing_texture) {
+               if (!r600_init_flushed_depth_texture(ctx, src, NULL))
+                       return; /* error */
+
+               r600_blit_uncompress_depth(ctx, rsrc, NULL,
+                                          src_level, src_level,
+                                          src_box->z, src_box->z + src_box->depth - 1);
+       }
 
        restore_orig[0] = restore_orig[1] = FALSE;
 
index 8e5225e2c6fd32ef20377d32c2dc0f121063d073..0d872308c0aba6b4dc6a81365e131f98456ab19a 100644 (file)
@@ -92,11 +92,6 @@ static INLINE struct r600_resource *r600_resource(struct pipe_resource *r)
 bool r600_init_flushed_depth_texture(struct pipe_context *ctx,
                                     struct pipe_resource *texture,
                                     struct r600_resource_texture **staging);
-void r600_texture_depth_flush(struct pipe_context *ctx,
-                             struct pipe_resource *texture,
-                             struct r600_resource_texture **staging,
-                             unsigned first_level, unsigned last_level,
-                             unsigned first_layer, unsigned last_layer);
 
 /* r600_texture.c texture transfer functions. */
 struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
index 5a6d755e10983ebe690228e6845b80cf6c154f86..3a5a912f63fbb540ec1bad20506f6b1d42d4c5f4 100644 (file)
@@ -775,28 +775,6 @@ bool r600_init_flushed_depth_texture(struct pipe_context *ctx,
        return true;
 }
 
-void r600_texture_depth_flush(struct pipe_context *ctx,
-                             struct pipe_resource *texture,
-                             struct r600_resource_texture **staging,
-                             unsigned first_level, unsigned last_level,
-                             unsigned first_layer, unsigned last_layer)
-{
-       struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
-
-       if (!r600_init_flushed_depth_texture(ctx, texture, staging))
-               return;
-
-       if (staging) {
-               r600_blit_uncompress_depth(ctx, rtex, *staging,
-                                          first_level, last_level,
-                                          first_layer, last_layer);
-       } else {
-               r600_blit_uncompress_depth(ctx, rtex, NULL,
-                                          first_level, last_level,
-                                          first_layer, last_layer);
-       }
-}
-
 /* Needs adjustment for pixelformat:
  */
 static INLINE unsigned u_box_volume( const struct pipe_box *box )
@@ -860,15 +838,17 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
                */
                struct r600_resource_texture *staging_depth;
 
-               r600_texture_depth_flush(ctx, texture, &staging_depth,
-                                        level, level,
-                                        box->z, box->z + box->depth - 1);
-               if (!staging_depth) {
+               if (!r600_init_flushed_depth_texture(ctx, texture, &staging_depth)) {
                        R600_ERR("failed to create temporary texture to hold untiled copy\n");
                        pipe_resource_reference(&trans->transfer.resource, NULL);
                        FREE(trans);
                        return NULL;
                }
+
+               r600_blit_uncompress_depth(ctx, rtex, staging_depth,
+                                          level, level,
+                                          box->z, box->z + box->depth - 1);
+
                trans->transfer.stride = staging_depth->pitch_in_bytes[level];
                trans->offset = r600_texture_get_offset(staging_depth, level, box->z);
                trans->staging = (struct r600_resource*)staging_depth;