diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-29 03:43:02 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-29 03:43:02 +0200 |
commit | 548bac89894df1fdb4ef008be74295082cac73f1 (patch) | |
tree | fcd797e56ccf85202a58d80fb4e9b38a5d1e3b62 | |
parent | vk_blit_screen: Make Draw method more generic (diff) | |
download | yuzu-548bac89894df1fdb4ef008be74295082cac73f1.tar yuzu-548bac89894df1fdb4ef008be74295082cac73f1.tar.gz yuzu-548bac89894df1fdb4ef008be74295082cac73f1.tar.bz2 yuzu-548bac89894df1fdb4ef008be74295082cac73f1.tar.lz yuzu-548bac89894df1fdb4ef008be74295082cac73f1.tar.xz yuzu-548bac89894df1fdb4ef008be74295082cac73f1.tar.zst yuzu-548bac89894df1fdb4ef008be74295082cac73f1.zip |
-rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.cpp | 29 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.h | 3 |
2 files changed, 18 insertions, 14 deletions
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index f1e8082d2..5c43b8acf 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp @@ -278,6 +278,20 @@ VkSemaphore VKBlitScreen::DrawToSwapchain(const Tegra::FramebufferConfig& frameb return Draw(framebuffer, *framebuffers[image_index], layout, render_area, use_accelerated); } +vk::Framebuffer VKBlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent) { + return device.GetLogical().CreateFramebuffer(VkFramebufferCreateInfo{ + .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, + .pNext = nullptr, + .flags = 0, + .renderPass = *renderpass, + .attachmentCount = 1, + .pAttachments = &image_view, + .width = extent.width, + .height = extent.height, + .layers = 1, + }); +} + void VKBlitScreen::CreateStaticResources() { CreateShaders(); CreateSemaphores(); @@ -621,22 +635,9 @@ void VKBlitScreen::CreateFramebuffers() { const VkExtent2D size{swapchain.GetSize()}; framebuffers.resize(image_count); - VkFramebufferCreateInfo ci{ - .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, - .pNext = nullptr, - .flags = 0, - .renderPass = *renderpass, - .attachmentCount = 1, - .pAttachments = nullptr, - .width = size.width, - .height = size.height, - .layers = 1, - }; - for (std::size_t i = 0; i < image_count; ++i) { const VkImageView image_view{swapchain.GetImageViewIndex(i)}; - ci.pAttachments = &image_view; - framebuffers[i] = device.GetLogical().CreateFramebuffer(ci); + framebuffers[i] = CreateFramebuffer(image_view, size); } } diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.h b/src/video_core/renderer_vulkan/vk_blit_screen.h index 44b93b4af..430bcfbca 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.h +++ b/src/video_core/renderer_vulkan/vk_blit_screen.h @@ -63,6 +63,9 @@ public: [[nodiscard]] VkSemaphore DrawToSwapchain(const Tegra::FramebufferConfig& framebuffer, bool use_accelerated); + [[nodiscard]] vk::Framebuffer CreateFramebuffer(const VkImageView& image_view, + VkExtent2D extent); + private: struct BufferData; |