From 3a32858fc3633193e3e7811ff8c59369a316a229 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 15 Nov 2017 12:08:29 +0100 Subject: [PATCH] radv: use a 16 bytes array for the sampled/storage image descriptors This allows to update them with only one memcpy(). Signed-off-by: Samuel Pitoiset Reviewed-by: Dave Airlie --- src/amd/vulkan/radv_descriptor_set.c | 9 +++++---- src/amd/vulkan/radv_image.c | 5 +---- src/amd/vulkan/radv_private.h | 6 ++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index a98ff37ced6..382fc9330aa 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -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 diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 163d35d76bd..b532aa916ae 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -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) { diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 93f93b98364..addd35e5ce1 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -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 { -- 2.30.2