X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Fframebuffer_backend.cpp;h=dcf63e9860c1b4c75beb71f3bdfdc53f64420ca2;hb=664421e9f9327f2c6ea5967930b386c142557e39;hp=9af8a2f7b1a7a9e52464d6d0027da801bee96700;hpb=89d543c07ba80430baebcba19f9a353b25cd8ab4;p=libs%2Fgl.git diff --git a/source/backends/vulkan/framebuffer_backend.cpp b/source/backends/vulkan/framebuffer_backend.cpp index 9af8a2f7..dcf63e98 100644 --- a/source/backends/vulkan/framebuffer_backend.cpp +++ b/source/backends/vulkan/framebuffer_backend.cpp @@ -3,6 +3,7 @@ #include "framebuffer.h" #include "framebuffer_backend.h" #include "renderpass.h" +#include "swapchaintexture.h" #include "vulkan.h" using namespace std; @@ -32,7 +33,7 @@ VulkanFramebuffer::~VulkanFramebuffer() dq.destroy(h); } -bool VulkanFramebuffer::is_format_supported(const FrameFormat &fmt) +bool VulkanFramebuffer::is_format_supported(const FrameFormat &fmt) const { const VulkanFunctions &vk = device.get_functions(); for(FrameAttachment a: fmt) @@ -53,6 +54,13 @@ bool VulkanFramebuffer::is_format_supported(const FrameFormat &fmt) return true; } +bool VulkanFramebuffer::is_presentable() const +{ + const Framebuffer &self = *static_cast(this); + return std::any_of(self.attachments.begin(), self.attachments.end(), + [](const Framebuffer::Attachment &a){ return dynamic_cast(a.tex); }); +} + void VulkanFramebuffer::update(unsigned mask) const { const Framebuffer &self = *static_cast(this); @@ -122,6 +130,7 @@ void VulkanFramebuffer::update(unsigned mask) const RenderPass render_pass; render_pass.framebuffer = &self; + render_pass.to_present = is_presentable(); render_pass.update(device); VkFramebufferCreateInfo framebuffer_info = { };