radv/meta: clean up buffer->image code.
authorDave Airlie <airlied@redhat.com>
Wed, 30 Nov 2016 01:56:11 +0000 (01:56 +0000)
committerDave Airlie <airlied@redhat.com>
Thu, 8 Dec 2016 23:05:58 +0000 (23:05 +0000)
Removes some unnecessary functions and pull
some stuff out of the loop.

Reviewed by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_meta_bufimage.c

index a2c5fb4d5d798a798f52e00079eaa61691c9f5c6..01e48e43b46f7bb94d3d5613cbbf69165964b7cb 100644 (file)
@@ -300,29 +300,10 @@ create_bview(struct radv_cmd_buffer *cmd_buffer,
 
 struct itob_temps {
        struct radv_image_view src_iview;
-
        struct radv_buffer_view dst_bview;
        VkDescriptorSet set;
 };
 
-static void
-itob_bind_src_image(struct radv_cmd_buffer *cmd_buffer,
-                  struct radv_meta_blit2d_surf *src,
-                  struct radv_meta_blit2d_rect *rect,
-                  struct itob_temps *tmp)
-{
-       create_iview(cmd_buffer, src, VK_IMAGE_USAGE_SAMPLED_BIT, &tmp->src_iview);
-}
-
-static void
-itob_bind_dst_buffer(struct radv_cmd_buffer *cmd_buffer,
-                    struct radv_meta_blit2d_buffer *dst,
-                    struct radv_meta_blit2d_rect *rect,
-                    struct itob_temps *tmp)
-{
-       create_bview(cmd_buffer, dst->buffer, dst->offset, dst->format, &tmp->dst_bview);
-}
-
 static void
 itob_bind_descriptors(struct radv_cmd_buffer *cmd_buffer,
                      struct itob_temps *tmp)
@@ -369,12 +350,6 @@ itob_bind_descriptors(struct radv_cmd_buffer *cmd_buffer,
                                   &tmp->set, 0, NULL);
 }
 
-static void
-itob_unbind_src_image(struct radv_cmd_buffer *cmd_buffer,
-                     struct itob_temps *temps)
-{
-}
-
 static void
 bind_pipeline(struct radv_cmd_buffer *cmd_buffer)
 {
@@ -395,16 +370,15 @@ radv_meta_image_to_buffer(struct radv_cmd_buffer *cmd_buffer,
                          struct radv_meta_blit2d_rect *rects)
 {
        struct radv_device *device = cmd_buffer->device;
+       struct itob_temps temps;
 
-       for (unsigned r = 0; r < num_rects; ++r) {
-               struct itob_temps temps;
-
-               itob_bind_src_image(cmd_buffer, src, &rects[r], &temps);
-               itob_bind_dst_buffer(cmd_buffer, dst, &rects[r], &temps);
-               itob_bind_descriptors(cmd_buffer, &temps);
+       create_iview(cmd_buffer, src, VK_IMAGE_USAGE_SAMPLED_BIT, &temps.src_iview);
+       create_bview(cmd_buffer, dst->buffer, dst->offset, dst->format, &temps.dst_bview);
+       itob_bind_descriptors(cmd_buffer, &temps);
 
-               bind_pipeline(cmd_buffer);
+       bind_pipeline(cmd_buffer);
 
+       for (unsigned r = 0; r < num_rects; ++r) {
                unsigned push_constants[3] = {
                        rects[r].src_x,
                        rects[r].src_y,
@@ -416,8 +390,6 @@ radv_meta_image_to_buffer(struct radv_cmd_buffer *cmd_buffer,
                                      push_constants);
 
                radv_unaligned_dispatch(cmd_buffer, rects[r].width, rects[r].height, 1);
-               radv_temp_descriptor_set_destroy(cmd_buffer->device, temps.set);
-               itob_unbind_src_image(cmd_buffer, &temps);
        }
-
+       radv_temp_descriptor_set_destroy(cmd_buffer->device, temps.set);
 }