forked from ShuriZma/suyu
1
0
Fork 0

vk_blit_screen: Add public CreateFramebuffer method

This commit is contained in:
ameerj 2021-07-28 21:43:02 -04:00
parent 1e6c5d323d
commit 548bac8989
2 changed files with 18 additions and 14 deletions

View File

@ -278,6 +278,20 @@ VkSemaphore VKBlitScreen::DrawToSwapchain(const Tegra::FramebufferConfig& frameb
return Draw(framebuffer, *framebuffers[image_index], layout, render_area, use_accelerated); 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() { void VKBlitScreen::CreateStaticResources() {
CreateShaders(); CreateShaders();
CreateSemaphores(); CreateSemaphores();
@ -621,22 +635,9 @@ void VKBlitScreen::CreateFramebuffers() {
const VkExtent2D size{swapchain.GetSize()}; const VkExtent2D size{swapchain.GetSize()};
framebuffers.resize(image_count); 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) { for (std::size_t i = 0; i < image_count; ++i) {
const VkImageView image_view{swapchain.GetImageViewIndex(i)}; const VkImageView image_view{swapchain.GetImageViewIndex(i)};
ci.pAttachments = &image_view; framebuffers[i] = CreateFramebuffer(image_view, size);
framebuffers[i] = device.GetLogical().CreateFramebuffer(ci);
} }
} }

View File

@ -63,6 +63,9 @@ public:
[[nodiscard]] VkSemaphore DrawToSwapchain(const Tegra::FramebufferConfig& framebuffer, [[nodiscard]] VkSemaphore DrawToSwapchain(const Tegra::FramebufferConfig& framebuffer,
bool use_accelerated); bool use_accelerated);
[[nodiscard]] vk::Framebuffer CreateFramebuffer(const VkImageView& image_view,
VkExtent2D extent);
private: private:
struct BufferData; struct BufferData;