radv: use a 16 bytes array for the sampled/storage image descriptors
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 15 Nov 2017 11:08:29 +0000 (12:08 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 20 Nov 2017 10:18:22 +0000 (11:18 +0100)
This allows to update them with only one memcpy().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_descriptor_set.c
src/amd/vulkan/radv_image.c
src/amd/vulkan/radv_private.h

index a98ff37ced690755d671ce52e200bb453ac878d3..382fc9330aa76a71cef0042998d1e81172163674 100644 (file)
@@ -629,15 +629,16 @@ write_image_descriptor(struct radv_device *device,
                       const VkDescriptorImageInfo *image_info)
 {
        RADV_FROM_HANDLE(radv_image_view, iview, image_info->imageView);
+       uint32_t *descriptor;
 
        if (descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) {
-               memcpy(dst, iview->storage_descriptor, 8 * 4);
-               memcpy(dst + 8, iview->storage_fmask_descriptor, 8 * 4);
+               descriptor = iview->storage_descriptor;
        } else {
-               memcpy(dst, iview->descriptor, 8 * 4);
-               memcpy(dst + 8, iview->fmask_descriptor, 8 * 4);
+               descriptor = iview->descriptor;
        }
 
+       memcpy(dst, descriptor, 16 * 4);
+
        if (cmd_buffer)
                radv_cs_add_buffer(device->ws, cmd_buffer->cs, iview->bo, 7);
        else
index 163d35d76bdcc7bf09fd495294ed1a4b771b58bf..b532aa916ae6b1097defa069d53c04eb0262a0a7 100644 (file)
@@ -956,15 +956,12 @@ radv_image_view_make_descriptor(struct radv_image_view *iview,
        bool is_stencil = iview->aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT;
        uint32_t blk_w;
        uint32_t *descriptor;
-       uint32_t *fmask_descriptor;
        uint32_t hw_level = 0;
 
        if (is_storage_image) {
                descriptor = iview->storage_descriptor;
-               fmask_descriptor = iview->storage_fmask_descriptor;
        } else {
                descriptor = iview->descriptor;
-               fmask_descriptor = iview->fmask_descriptor;
        }
 
        assert(image->surface.blk_w % vk_format_get_blockwidth(image->vk_format) == 0);
@@ -983,7 +980,7 @@ radv_image_view_make_descriptor(struct radv_image_view *iview,
                                   iview->extent.height,
                                   iview->extent.depth,
                                   descriptor,
-                                  fmask_descriptor);
+                                  descriptor + 8);
 
        const struct legacy_surf_level *base_level_info = NULL;
        if (device->physical_device->rad_info.chip_class <= GFX9) {
index 93f93b98364c918cb64ec5ef74bded7611652bd4..addd35e5ce10fa37bd3f36875b068d7b41a065dc 100644 (file)
@@ -1360,14 +1360,12 @@ struct radv_image_view {
        uint32_t level_count;
        VkExtent3D extent; /**< Extent of VkImageViewCreateInfo::baseMipLevel. */
 
-       uint32_t descriptor[8];
-       uint32_t fmask_descriptor[8];
+       uint32_t descriptor[16];
 
        /* Descriptor for use as a storage image as opposed to a sampled image.
         * This has a few differences for cube maps (e.g. type).
         */
-       uint32_t storage_descriptor[8];
-       uint32_t storage_fmask_descriptor[8];
+       uint32_t storage_descriptor[16];
 };
 
 struct radv_image_create_info {