From: Samuel Pitoiset Date: Mon, 10 Jun 2019 15:45:33 +0000 (+0200) Subject: radv: add radv_get_resolve_pipeline() helper in the graphics path X-Git-Tag: upstream/19.3.0~5641 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c39a1611ab36cbeb10590dde937a8c11f3b87b02;p=platform%2Fupstream%2Fmesa.git radv: add radv_get_resolve_pipeline() helper in the graphics path Signed-off-by: Samuel Pitoiset Reviewed-By: Bas Nieuwenhuizen --- diff --git a/src/amd/vulkan/radv_meta_resolve_fs.c b/src/amd/vulkan/radv_meta_resolve_fs.c index 9f20f67..d059760 100644 --- a/src/amd/vulkan/radv_meta_resolve_fs.c +++ b/src/amd/vulkan/radv_meta_resolve_fs.c @@ -367,6 +367,32 @@ radv_device_finish_meta_resolve_fragment_state(struct radv_device *device) &state->alloc); } +static VkPipeline * +radv_get_resolve_pipeline(struct radv_cmd_buffer *cmd_buffer, + struct radv_image_view *src_iview, + struct radv_image_view *dst_iview) +{ + struct radv_device *device = cmd_buffer->device; + unsigned fs_key = radv_format_meta_fs_key(dst_iview->vk_format); + const uint32_t samples = src_iview->image->info.samples; + const uint32_t samples_log2 = ffs(samples) - 1; + VkPipeline *pipeline; + + pipeline = &device->meta_state.resolve_fragment.rc[samples_log2].pipeline[fs_key]; + if (!*pipeline ) { + VkResult ret; + + ret = create_resolve_pipeline(device, samples_log2, + radv_fs_key_format_exemplars[fs_key]); + if (ret != VK_SUCCESS) { + cmd_buffer->record_result = ret; + return NULL; + } + } + + return pipeline; +} + static void emit_resolve(struct radv_cmd_buffer *cmd_buffer, struct radv_image_view *src_iview, @@ -377,8 +403,8 @@ emit_resolve(struct radv_cmd_buffer *cmd_buffer, { struct radv_device *device = cmd_buffer->device; VkCommandBuffer cmd_buffer_h = radv_cmd_buffer_to_handle(cmd_buffer); - const uint32_t samples = src_iview->image->info.samples; - const uint32_t samples_log2 = ffs(samples) - 1; + VkPipeline *pipeline; + radv_meta_push_descriptor_set(cmd_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, cmd_buffer->device->meta_state.resolve_fragment.p_layout, @@ -412,16 +438,7 @@ emit_resolve(struct radv_cmd_buffer *cmd_buffer, VK_SHADER_STAGE_FRAGMENT_BIT, 0, 8, push_constants); - unsigned fs_key = radv_format_meta_fs_key(dest_iview->vk_format); - VkPipeline* pipeline = &device->meta_state.resolve_fragment.rc[samples_log2].pipeline[fs_key]; - - if (*pipeline == VK_NULL_HANDLE) { - VkResult ret = create_resolve_pipeline(device, samples_log2, radv_fs_key_format_exemplars[fs_key]); - if (ret != VK_SUCCESS) { - cmd_buffer->record_result = ret; - return; - } - } + pipeline = radv_get_resolve_pipeline(cmd_buffer, src_iview, dest_iview); radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline);