From 216a9d887163122d2e1f959a816b6ec0b918d159 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Mon, 5 Aug 2019 01:07:04 +0200 Subject: [PATCH] radv: Add extra struct to image view creation. For extra args. Unlike image creation, I'm not embedding the vk struct in there, so all the inline structs can be kept. Reviewed-by: Dave Airlie --- src/amd/vulkan/radv_image.c | 5 +++-- src/amd/vulkan/radv_meta_blit.c | 4 ++-- src/amd/vulkan/radv_meta_blit2d.c | 2 +- src/amd/vulkan/radv_meta_bufimage.c | 2 +- src/amd/vulkan/radv_meta_clear.c | 4 ++-- src/amd/vulkan/radv_meta_decompress.c | 2 +- src/amd/vulkan/radv_meta_fast_clear.c | 4 ++-- src/amd/vulkan/radv_meta_fmask_expand.c | 2 +- src/amd/vulkan/radv_meta_resolve.c | 4 ++-- src/amd/vulkan/radv_meta_resolve_cs.c | 8 ++++---- src/amd/vulkan/radv_meta_resolve_fs.c | 6 +++--- src/amd/vulkan/radv_private.h | 6 +++++- 12 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 0c34e296154..8654e7f382c 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -1488,7 +1488,8 @@ radv_get_aspect_format(struct radv_image *image, VkImageAspectFlags mask) void radv_image_view_init(struct radv_image_view *iview, struct radv_device *device, - const VkImageViewCreateInfo* pCreateInfo) + const VkImageViewCreateInfo* pCreateInfo, + const struct radv_image_view_extra_create_info* extra_create_info) { RADV_FROM_HANDLE(radv_image, image, pCreateInfo->image); const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange; @@ -1766,7 +1767,7 @@ radv_CreateImageView(VkDevice _device, if (view == NULL) return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY); - radv_image_view_init(view, device, pCreateInfo); + radv_image_view_init(view, device, pCreateInfo, NULL); *pView = radv_image_view_to_handle(view); diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c index eb131e68fd1..16c5b93c093 100644 --- a/src/amd/vulkan/radv_meta_blit.c +++ b/src/amd/vulkan/radv_meta_blit.c @@ -660,7 +660,7 @@ void radv_CmdBlitImage( .baseArrayLayer = dest_array_slice, .layerCount = 1 }, - }); + }, NULL); radv_image_view_init(&src_iview, cmd_buffer->device, &(VkImageViewCreateInfo) { .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, @@ -674,7 +674,7 @@ void radv_CmdBlitImage( .baseArrayLayer = src_array_slice, .layerCount = 1 }, - }); + }, NULL); meta_emit_blit(cmd_buffer, src_image, &src_iview, srcImageLayout, src_offset_0, src_offset_1, diff --git a/src/amd/vulkan/radv_meta_blit2d.c b/src/amd/vulkan/radv_meta_blit2d.c index 8142faef5f8..de3d5791611 100644 --- a/src/amd/vulkan/radv_meta_blit2d.c +++ b/src/amd/vulkan/radv_meta_blit2d.c @@ -79,7 +79,7 @@ create_iview(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = surf->layer, .layerCount = 1 }, - }); + }, NULL); } static void diff --git a/src/amd/vulkan/radv_meta_bufimage.c b/src/amd/vulkan/radv_meta_bufimage.c index a2a62798c33..89bb8535b09 100644 --- a/src/amd/vulkan/radv_meta_bufimage.c +++ b/src/amd/vulkan/radv_meta_bufimage.c @@ -1552,7 +1552,7 @@ create_iview(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = surf->layer, .layerCount = 1 }, - }); + }, NULL); } static void diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c index 6003fa51503..2b47570b213 100644 --- a/src/amd/vulkan/radv_meta_clear.c +++ b/src/amd/vulkan/radv_meta_clear.c @@ -1896,7 +1896,7 @@ radv_clear_image_layer(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = range->baseArrayLayer + layer, .layerCount = 1 }, - }); + }, NULL); VkFramebuffer fb; radv_CreateFramebuffer(device_h, @@ -2026,7 +2026,7 @@ radv_fast_clear_range(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = range->baseArrayLayer, .layerCount = range->layerCount, }, - }); + }, NULL); VkClearRect clear_rect = { .rect = { diff --git a/src/amd/vulkan/radv_meta_decompress.c b/src/amd/vulkan/radv_meta_decompress.c index fa5de24314a..027ab299c15 100644 --- a/src/amd/vulkan/radv_meta_decompress.c +++ b/src/amd/vulkan/radv_meta_decompress.c @@ -433,7 +433,7 @@ static void radv_process_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = subresourceRange->baseArrayLayer + layer, .layerCount = 1, }, - }); + }, NULL); VkFramebuffer fb_h; diff --git a/src/amd/vulkan/radv_meta_fast_clear.c b/src/amd/vulkan/radv_meta_fast_clear.c index d601686f8f6..6aaa85e5834 100644 --- a/src/amd/vulkan/radv_meta_fast_clear.c +++ b/src/amd/vulkan/radv_meta_fast_clear.c @@ -590,7 +590,7 @@ radv_process_color_image_layer(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = range->baseArrayLayer + layer, .layerCount = 1, }, - }); + }, NULL); VkFramebuffer fb_h; radv_CreateFramebuffer(radv_device_to_handle(device), @@ -832,7 +832,7 @@ radv_decompress_dcc_compute(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = subresourceRange->baseArrayLayer + s, .layerCount = 1 }, - }); + }, NULL); radv_meta_push_descriptor_set(cmd_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, diff --git a/src/amd/vulkan/radv_meta_fmask_expand.c b/src/amd/vulkan/radv_meta_fmask_expand.c index 7f3cbb2a6a6..a8dd4cf6966 100644 --- a/src/amd/vulkan/radv_meta_fmask_expand.c +++ b/src/amd/vulkan/radv_meta_fmask_expand.c @@ -139,7 +139,7 @@ radv_expand_fmask_image_inplace(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = subresourceRange->baseArrayLayer + l, .layerCount = 1, }, - }); + }, NULL); radv_meta_push_descriptor_set(cmd_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c index 063c48c8f1b..dc5c2c65ecd 100644 --- a/src/amd/vulkan/radv_meta_resolve.c +++ b/src/amd/vulkan/radv_meta_resolve.c @@ -551,7 +551,7 @@ void radv_CmdResolveImage( .baseArrayLayer = src_base_layer + layer, .layerCount = 1, }, - }); + }, NULL); struct radv_image_view dest_iview; radv_image_view_init(&dest_iview, cmd_buffer->device, @@ -567,7 +567,7 @@ void radv_CmdResolveImage( .baseArrayLayer = dest_base_layer + layer, .layerCount = 1, }, - }); + }, NULL); VkFramebuffer fb_h; radv_CreateFramebuffer(device_h, diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c index ef240a9c065..f3bdfdbbd11 100644 --- a/src/amd/vulkan/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/radv_meta_resolve_cs.c @@ -863,7 +863,7 @@ void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = src_base_layer + layer, .layerCount = 1, }, - }); + }, NULL); struct radv_image_view dest_iview; radv_image_view_init(&dest_iview, cmd_buffer->device, @@ -879,7 +879,7 @@ void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = dest_base_layer + layer, .layerCount = 1, }, - }); + }, NULL); emit_resolve(cmd_buffer, &src_iview, @@ -1011,7 +1011,7 @@ radv_depth_stencil_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = src_iview->base_layer + layer, .layerCount = 1, }, - }); + }, NULL); struct radv_image_view tdst_iview; radv_image_view_init(&tdst_iview, cmd_buffer->device, @@ -1027,7 +1027,7 @@ radv_depth_stencil_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = dst_iview->base_layer + layer, .layerCount = 1, }, - }); + }, NULL); emit_depth_stencil_resolve(cmd_buffer, &tsrc_iview, &tdst_iview, &(VkOffset2D) { 0, 0 }, diff --git a/src/amd/vulkan/radv_meta_resolve_fs.c b/src/amd/vulkan/radv_meta_resolve_fs.c index 1d6427b73fb..2068f39a2b9 100644 --- a/src/amd/vulkan/radv_meta_resolve_fs.c +++ b/src/amd/vulkan/radv_meta_resolve_fs.c @@ -1050,7 +1050,7 @@ void radv_meta_resolve_fragment_image(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = src_base_layer + layer, .layerCount = 1, }, - }); + }, NULL); struct radv_image_view dest_iview; radv_image_view_init(&dest_iview, cmd_buffer->device, @@ -1066,7 +1066,7 @@ void radv_meta_resolve_fragment_image(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = dest_base_layer + layer, .layerCount = 1, }, - }); + }, NULL); VkFramebuffer fb; @@ -1228,7 +1228,7 @@ radv_depth_stencil_resolve_subpass_fs(struct radv_cmd_buffer *cmd_buffer, .baseArrayLayer = 0, .layerCount = 1, }, - }); + }, NULL); emit_depth_stencil_resolve(cmd_buffer, &tsrc_iview, dst_iview, &(VkOffset2D) { 0, 0 }, diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 2e7d6975ca7..fbc4542cd72 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1882,9 +1882,13 @@ radv_image_from_gralloc(VkDevice device_h, const VkAllocationCallbacks *alloc, VkImage *out_image_h); +struct radv_image_view_extra_create_info { +}; + void radv_image_view_init(struct radv_image_view *view, struct radv_device *device, - const VkImageViewCreateInfo* pCreateInfo); + const VkImageViewCreateInfo *pCreateInfo, + const struct radv_image_view_extra_create_info* extra_create_info); VkFormat radv_get_aspect_format(struct radv_image *image, VkImageAspectFlags mask); -- 2.30.2