radv/image: don't rescale width/height if the format isn't changing
authorDave Airlie <airlied@redhat.com>
Mon, 21 Aug 2017 03:58:27 +0000 (13:58 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 24 Aug 2017 00:14:14 +0000 (01:14 +0100)
If the image view has the same format, we don't need to rescale
the w/h.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_image.c

index 5e3804117015e1bdc65e8a49f0cac25732a47a15..ddf15bc8361e265a26a0f0182303c892b0278d04 100644 (file)
@@ -947,10 +947,12 @@ radv_image_view_init(struct radv_image_view *iview,
                .depth  = radv_minify(image->info.depth , range->baseMipLevel),
        };
 
-       iview->extent.width = round_up_u32(iview->extent.width * vk_format_get_blockwidth(iview->vk_format),
-                                          vk_format_get_blockwidth(image->vk_format));
-       iview->extent.height = round_up_u32(iview->extent.height * vk_format_get_blockheight(iview->vk_format),
-                                           vk_format_get_blockheight(image->vk_format));
+       if (iview->vk_format != image->vk_format) {
+               iview->extent.width = round_up_u32(iview->extent.width * vk_format_get_blockwidth(iview->vk_format),
+                                                  vk_format_get_blockwidth(image->vk_format));
+               iview->extent.height = round_up_u32(iview->extent.height * vk_format_get_blockheight(iview->vk_format),
+                                                   vk_format_get_blockheight(image->vk_format));
+       }
 
        iview->base_layer = range->baseArrayLayer;
        iview->layer_count = radv_get_layerCount(image, range);