diff options
| author | 2021-11-21 00:50:46 -0500 | |
|---|---|---|
| committer | 2021-12-05 15:38:59 -0500 | |
| commit | ad99bbf5fe1c09f9c4db44d054d18c79393a1848 (patch) | |
| tree | 49803597243adefd85ce96ab831bfbe1a57f8b94 /src | |
| parent | vk_blit_screen: Minor refactor of filter pipeline selection (diff) | |
| download | yuzu-ad99bbf5fe1c09f9c4db44d054d18c79393a1848.tar.gz yuzu-ad99bbf5fe1c09f9c4db44d054d18c79393a1848.tar.xz yuzu-ad99bbf5fe1c09f9c4db44d054d18c79393a1848.zip | |
blit_image: Refactor ConvertPipelineEx functions
reduces much of the duplication between the color/depth variants
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/blit_image.cpp | 44 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/blit_image.h | 7 |
2 files changed, 18 insertions, 33 deletions
diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cpp index 2e69e270f..821270236 100644 --- a/src/video_core/renderer_vulkan/blit_image.cpp +++ b/src/video_core/renderer_vulkan/blit_image.cpp | |||
| @@ -455,7 +455,7 @@ void BlitImageHelper::ConvertR16ToD16(const Framebuffer* dst_framebuffer, | |||
| 455 | void BlitImageHelper::ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, | 455 | void BlitImageHelper::ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, |
| 456 | ImageView& src_image_view, u32 up_scale, u32 down_shift) { | 456 | ImageView& src_image_view, u32 up_scale, u32 down_shift) { |
| 457 | ConvertPipelineDepthTargetEx(convert_abgr8_to_d24s8_pipeline, dst_framebuffer->RenderPass(), | 457 | ConvertPipelineDepthTargetEx(convert_abgr8_to_d24s8_pipeline, dst_framebuffer->RenderPass(), |
| 458 | convert_abgr8_to_d24s8_frag, true); | 458 | convert_abgr8_to_d24s8_frag); |
| 459 | ConvertColor(*convert_abgr8_to_d24s8_pipeline, dst_framebuffer, src_image_view, up_scale, | 459 | ConvertColor(*convert_abgr8_to_d24s8_pipeline, dst_framebuffer, src_image_view, up_scale, |
| 460 | down_shift); | 460 | down_shift); |
| 461 | } | 461 | } |
| @@ -463,7 +463,7 @@ void BlitImageHelper::ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, | |||
| 463 | void BlitImageHelper::ConvertD24S8ToABGR8(const Framebuffer* dst_framebuffer, | 463 | void BlitImageHelper::ConvertD24S8ToABGR8(const Framebuffer* dst_framebuffer, |
| 464 | ImageView& src_image_view, u32 up_scale, u32 down_shift) { | 464 | ImageView& src_image_view, u32 up_scale, u32 down_shift) { |
| 465 | ConvertPipelineColorTargetEx(convert_d24s8_to_abgr8_pipeline, dst_framebuffer->RenderPass(), | 465 | ConvertPipelineColorTargetEx(convert_d24s8_to_abgr8_pipeline, dst_framebuffer->RenderPass(), |
| 466 | convert_d24s8_to_abgr8_frag, false); | 466 | convert_d24s8_to_abgr8_frag); |
| 467 | ConvertDepthStencil(*convert_d24s8_to_abgr8_pipeline, dst_framebuffer, src_image_view, up_scale, | 467 | ConvertDepthStencil(*convert_d24s8_to_abgr8_pipeline, dst_framebuffer, src_image_view, up_scale, |
| 468 | down_shift); | 468 | down_shift); |
| 469 | } | 469 | } |
| @@ -751,8 +751,9 @@ void BlitImageHelper::ConvertColorToDepthPipeline(vk::Pipeline& pipeline, VkRend | |||
| 751 | }); | 751 | }); |
| 752 | } | 752 | } |
| 753 | 753 | ||
| 754 | void BlitImageHelper::ConvertPipelineColorTargetEx(vk::Pipeline& pipeline, VkRenderPass renderpass, | 754 | void BlitImageHelper::ConvertPipelineEx(vk::Pipeline& pipeline, VkRenderPass renderpass, |
| 755 | vk::ShaderModule& module, bool single_texture) { | 755 | vk::ShaderModule& module, bool single_texture, |
| 756 | bool is_target_depth) { | ||
| 756 | if (pipeline) { | 757 | if (pipeline) { |
| 757 | return; | 758 | return; |
| 758 | } | 759 | } |
| @@ -769,7 +770,7 @@ void BlitImageHelper::ConvertPipelineColorTargetEx(vk::Pipeline& pipeline, VkRen | |||
| 769 | .pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO, | 770 | .pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO, |
| 770 | .pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO, | 771 | .pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO, |
| 771 | .pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, | 772 | .pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, |
| 772 | .pDepthStencilState = nullptr, | 773 | .pDepthStencilState = is_target_depth ? &PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO : nullptr, |
| 773 | .pColorBlendState = &PIPELINE_COLOR_BLEND_STATE_GENERIC_CREATE_INFO, | 774 | .pColorBlendState = &PIPELINE_COLOR_BLEND_STATE_GENERIC_CREATE_INFO, |
| 774 | .pDynamicState = &PIPELINE_DYNAMIC_STATE_CREATE_INFO, | 775 | .pDynamicState = &PIPELINE_DYNAMIC_STATE_CREATE_INFO, |
| 775 | .layout = single_texture ? *one_texture_pipeline_layout : *two_textures_pipeline_layout, | 776 | .layout = single_texture ? *one_texture_pipeline_layout : *two_textures_pipeline_layout, |
| @@ -780,33 +781,14 @@ void BlitImageHelper::ConvertPipelineColorTargetEx(vk::Pipeline& pipeline, VkRen | |||
| 780 | }); | 781 | }); |
| 781 | } | 782 | } |
| 782 | 783 | ||
| 784 | void BlitImageHelper::ConvertPipelineColorTargetEx(vk::Pipeline& pipeline, VkRenderPass renderpass, | ||
| 785 | vk::ShaderModule& module) { | ||
| 786 | ConvertPipelineEx(pipeline, renderpass, module, false, false); | ||
| 787 | } | ||
| 788 | |||
| 783 | void BlitImageHelper::ConvertPipelineDepthTargetEx(vk::Pipeline& pipeline, VkRenderPass renderpass, | 789 | void BlitImageHelper::ConvertPipelineDepthTargetEx(vk::Pipeline& pipeline, VkRenderPass renderpass, |
| 784 | vk::ShaderModule& module, bool single_texture) { | 790 | vk::ShaderModule& module) { |
| 785 | if (pipeline) { | 791 | ConvertPipelineEx(pipeline, renderpass, module, true, true); |
| 786 | return; | ||
| 787 | } | ||
| 788 | const std::array stages = MakeStages(*full_screen_vert, *module); | ||
| 789 | pipeline = device.GetLogical().CreateGraphicsPipeline({ | ||
| 790 | .sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, | ||
| 791 | .pNext = nullptr, | ||
| 792 | .flags = 0, | ||
| 793 | .stageCount = static_cast<u32>(stages.size()), | ||
| 794 | .pStages = stages.data(), | ||
| 795 | .pVertexInputState = &PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, | ||
| 796 | .pInputAssemblyState = &PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, | ||
| 797 | .pTessellationState = nullptr, | ||
| 798 | .pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO, | ||
| 799 | .pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO, | ||
| 800 | .pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, | ||
| 801 | .pDepthStencilState = &PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, | ||
| 802 | .pColorBlendState = &PIPELINE_COLOR_BLEND_STATE_EMPTY_CREATE_INFO, | ||
| 803 | .pDynamicState = &PIPELINE_DYNAMIC_STATE_CREATE_INFO, | ||
| 804 | .layout = single_texture ? *one_texture_pipeline_layout : *two_textures_pipeline_layout, | ||
| 805 | .renderPass = renderpass, | ||
| 806 | .subpass = 0, | ||
| 807 | .basePipelineHandle = VK_NULL_HANDLE, | ||
| 808 | .basePipelineIndex = 0, | ||
| 809 | }); | ||
| 810 | } | 792 | } |
| 811 | 793 | ||
| 812 | } // namespace Vulkan | 794 | } // namespace Vulkan |
diff --git a/src/video_core/renderer_vulkan/blit_image.h b/src/video_core/renderer_vulkan/blit_image.h index 0b73cf444..566e8b5d6 100644 --- a/src/video_core/renderer_vulkan/blit_image.h +++ b/src/video_core/renderer_vulkan/blit_image.h | |||
| @@ -80,11 +80,14 @@ private: | |||
| 80 | 80 | ||
| 81 | void ConvertColorToDepthPipeline(vk::Pipeline& pipeline, VkRenderPass renderpass); | 81 | void ConvertColorToDepthPipeline(vk::Pipeline& pipeline, VkRenderPass renderpass); |
| 82 | 82 | ||
| 83 | void ConvertPipelineEx(vk::Pipeline& pipeline, VkRenderPass renderpass, | ||
| 84 | vk::ShaderModule& module, bool single_texture, bool is_target_depth); | ||
| 85 | |||
| 83 | void ConvertPipelineColorTargetEx(vk::Pipeline& pipeline, VkRenderPass renderpass, | 86 | void ConvertPipelineColorTargetEx(vk::Pipeline& pipeline, VkRenderPass renderpass, |
| 84 | vk::ShaderModule& module, bool single_texture); | 87 | vk::ShaderModule& module); |
| 85 | 88 | ||
| 86 | void ConvertPipelineDepthTargetEx(vk::Pipeline& pipeline, VkRenderPass renderpass, | 89 | void ConvertPipelineDepthTargetEx(vk::Pipeline& pipeline, VkRenderPass renderpass, |
| 87 | vk::ShaderModule& module, bool single_texture); | 90 | vk::ShaderModule& module); |
| 88 | 91 | ||
| 89 | const Device& device; | 92 | const Device& device; |
| 90 | VKScheduler& scheduler; | 93 | VKScheduler& scheduler; |