radv: don't use iview for meta image width/height.
authorDave Airlie <airlied@redhat.com>
Tue, 22 Aug 2017 03:35:53 +0000 (13:35 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 12 Sep 2017 22:40:18 +0000 (08:40 +1000)
Work out the width/height from the level manually, as on GFX9
we won't minify the iview width/height.

This fixes:
dEQP-VK.api.image_clearing.core.clear_color_image* on gfx9

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_meta_blit.c
src/amd/vulkan/radv_meta_clear.c

index 3510e871bbef075650a490141edcf4a792b195f3..2c1a13228d29368a1224735db50aae500ee44625 100644 (file)
@@ -275,15 +275,20 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer,
                VkFilter blit_filter)
 {
        struct radv_device *device = cmd_buffer->device;
+       uint32_t src_width = radv_minify(src_iview->image->info.width, src_iview->base_mip);
+       uint32_t src_height = radv_minify(src_iview->image->info.height, src_iview->base_mip);
+       uint32_t src_depth = radv_minify(src_iview->image->info.depth, src_iview->base_mip);
+       uint32_t dst_width = radv_minify(dest_iview->image->info.width, dest_iview->base_mip);
+       uint32_t dst_height = radv_minify(dest_iview->image->info.height, dest_iview->base_mip);
 
        assert(src_image->info.samples == dest_image->info.samples);
 
        float vertex_push_constants[5] = {
-               (float)src_offset_0.x / (float)src_iview->extent.width,
-               (float)src_offset_0.y / (float)src_iview->extent.height,
-               (float)src_offset_1.x / (float)src_iview->extent.width,
-               (float)src_offset_1.y / (float)src_iview->extent.height,
-               (float)src_offset_0.z / (float)src_iview->extent.depth,
+               (float)src_offset_0.x / (float)src_width,
+               (float)src_offset_0.y / (float)src_height,
+               (float)src_offset_1.x / (float)src_width,
+               (float)src_offset_1.y / (float)src_height,
+               (float)src_offset_0.z / (float)src_depth,
        };
 
        radv_CmdPushConstants(radv_cmd_buffer_to_handle(cmd_buffer),
@@ -310,8 +315,8 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer,
                                               .pAttachments = (VkImageView[]) {
                                               radv_image_view_to_handle(dest_iview),
                                       },
-                                      .width = dest_iview->extent.width,
-                                      .height = dest_iview->extent.height,
+                                      .width = dst_width,
+                                      .height = dst_height,
                                       .layers = 1,
                                }, &cmd_buffer->pool->alloc, &fb);
        VkPipeline pipeline;
index b3eb3893d893715fb5e1f46cc1191cad6ac66a73..08a6278a5c26e9f5dabb953a7cb51057579a375b 100644 (file)
@@ -1202,6 +1202,9 @@ radv_clear_image_layer(struct radv_cmd_buffer *cmd_buffer,
 {
        VkDevice device_h = radv_device_to_handle(cmd_buffer->device);
        struct radv_image_view iview;
+       uint32_t width = radv_minify(image->info.width, range->baseMipLevel + level);
+       uint32_t height = radv_minify(image->info.height, range->baseMipLevel + level);
+
        radv_image_view_init(&iview, cmd_buffer->device,
                             &(VkImageViewCreateInfo) {
                                     .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
@@ -1225,9 +1228,9 @@ radv_clear_image_layer(struct radv_cmd_buffer *cmd_buffer,
                                               .pAttachments = (VkImageView[]) {
                                               radv_image_view_to_handle(&iview),
                                       },
-                                              .width = iview.extent.width,
-                                                       .height = iview.extent.height,
-                                                       .layers = 1
+                                              .width = width,
+                                              .height = height,
+                                              .layers = 1
                               },
                               &cmd_buffer->pool->alloc,
                               &fb);
@@ -1283,8 +1286,8 @@ radv_clear_image_layer(struct radv_cmd_buffer *cmd_buffer,
                                                .renderArea = {
                                                .offset = { 0, 0, },
                                                .extent = {
-                                                       .width = iview.extent.width,
-                                                       .height = iview.extent.height,
+                                                       .width = width,
+                                                       .height = height,
                                                },
                                        },
                                                .renderPass = pass,
@@ -1303,7 +1306,7 @@ radv_clear_image_layer(struct radv_cmd_buffer *cmd_buffer,
        VkClearRect clear_rect = {
                .rect = {
                        .offset = { 0, 0 },
-                       .extent = { iview.extent.width, iview.extent.height },
+                       .extent = { width, height },
                },
                .baseArrayLayer = range->baseArrayLayer,
                .layerCount = 1, /* FINISHME: clear multi-layer framebuffer */