]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/framebuffer_backend.cpp
Make it possible to query if a framebuffer can be presented
[libs/gl.git] / source / backends / vulkan / framebuffer_backend.cpp
index 9af8a2f7b1a7a9e52464d6d0027da801bee96700..4c68546f15ed322181aad3ef9c136f92c9892ff3 100644 (file)
@@ -3,6 +3,7 @@
 #include "framebuffer.h"
 #include "framebuffer_backend.h"
 #include "renderpass.h"
+#include "swapchaintexture.h"
 #include "vulkan.h"
 
 using namespace std;
@@ -53,6 +54,13 @@ bool VulkanFramebuffer::is_format_supported(const FrameFormat &fmt)
        return true;
 }
 
+bool VulkanFramebuffer::is_presentable() const
+{
+       const Framebuffer &self = *static_cast<const Framebuffer *>(this);
+       return std::any_of(self.attachments.begin(), self.attachments.end(),
+               [](const Framebuffer::Attachment &a){ return dynamic_cast<const SwapChainTexture *>(a.tex); });
+}
+
 void VulkanFramebuffer::update(unsigned mask) const
 {
        const Framebuffer &self = *static_cast<const Framebuffer *>(this);