radv/clear: add r32g32b32a32 fast clear support (v2)
authorDave Airlie <airlied@redhat.com>
Sun, 25 Jun 2017 23:52:07 +0000 (00:52 +0100)
committerDave Airlie <airlied@redhat.com>
Mon, 17 Jul 2017 00:44:25 +0000 (01:44 +0100)
We can only fast clear 128-bit images if the r/g/b channels
are the same, and we are using DCC.

For DCC we'll bail out on translate if this isn't true,
and we catch cmask clears explicitly.

v2: remove 64-bit block (Bas), add uint32 as well.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_formats.c
src/amd/vulkan/radv_meta_clear.c

index 4d0aca1490db77ac29afbd473eea49f9083e77be..7c3bbc0f66f81644959db6f8060f85ba25bc35f8 100644 (file)
@@ -977,6 +977,27 @@ bool radv_format_pack_clear_color(VkFormat format,
                clear_vals[0] = float3_to_r11g11b10f(value->float32);
                clear_vals[1] = 0;
                break;
+       case VK_FORMAT_R32G32B32A32_SFLOAT:
+               if (value->float32[0] != value->float32[1] ||
+                   value->float32[0] != value->float32[2])
+                       return false;
+               clear_vals[0] = fui(value->float32[0]);
+               clear_vals[1] = fui(value->float32[3]);
+               break;
+       case VK_FORMAT_R32G32B32A32_UINT:
+               if (value->uint32[0] != value->uint32[1] ||
+                   value->uint32[0] != value->uint32[2])
+                       return false;
+               clear_vals[0] = value->uint32[0];
+               clear_vals[1] = value->uint32[3];
+               break;
+       case VK_FORMAT_R32G32B32A32_SINT:
+               if (value->int32[0] != value->int32[1] ||
+                   value->int32[0] != value->int32[2])
+                       return false;
+               clear_vals[0] = value->int32[0];
+               clear_vals[1] = value->int32[3];
+               break;
        default:
                fprintf(stderr, "failed to fast clear %d\n", format);
                return false;
index 7f3cfdccc8670be9322a0942b478563f00a8b606..bf58345245373066c0e6141af02ccf7081ff17f2 100644 (file)
@@ -881,8 +881,6 @@ emit_fast_color_clear(struct radv_cmd_buffer *cmd_buffer,
 
        if (!radv_layout_can_fast_clear(iview->image, image_layout, radv_image_queue_family_mask(iview->image, cmd_buffer->queue_family_index, cmd_buffer->queue_family_index)))
                goto fail;
-       if (vk_format_get_blocksizebits(iview->image->vk_format) > 64)
-               goto fail;
 
        /* don't fast clear 3D */
        if (iview->image->type == VK_IMAGE_TYPE_3D)
@@ -936,6 +934,11 @@ emit_fast_color_clear(struct radv_cmd_buffer *cmd_buffer,
                                 iview->image->offset + iview->image->dcc_offset,
                                 iview->image->surface.dcc_size, 0x20202020);
        } else {
+
+               if (iview->image->surface.bpe > 8) {
+                       /* 128 bit formats not supported */
+                       return false;
+               }
                radv_fill_buffer(cmd_buffer, iview->image->bo,
                                 iview->image->offset + iview->image->cmask.offset,
                                 iview->image->cmask.size, 0);