void format_changed(const FrameFormat &);
static void require_layered();
+ bool is_presentable() const { return id==0; }
+
void resize_system(unsigned, unsigned);
void update(unsigned) const;
void update(unsigned, bool) const;
#include "rect.h"
#include "renderpass.h"
#include "semaphore.h"
-#include "swapchaintexture.h"
#include "vulkan.h"
using namespace std;
if(!primary_buffer)
begin_buffer(0);
- fb_is_swapchain = false;
- unsigned n_attachments = framebuffer->get_format().size();
- for(unsigned i=0; (!fb_is_swapchain && i<n_attachments); ++i)
- if(dynamic_cast<const SwapChainTexture *>(framebuffer->get_attachment(i)))
- fb_is_swapchain = true;
-
+ fb_is_swapchain = framebuffer->is_presentable();
framebuffer->refresh();
RenderPass render_pass;
#include "framebuffer.h"
#include "framebuffer_backend.h"
#include "renderpass.h"
+#include "swapchaintexture.h"
#include "vulkan.h"
using namespace std;
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);
void format_changed(const FrameFormat &) { }
static void require_layered() { }
+ bool is_presentable() const;
+
void update(unsigned) const;
void require_complete() const { }
const Texture *get_resolve_attachment(unsigned) const;
bool has_resolve_attachments() const;
+ using FramebufferBackend::is_presentable;
+
/** Ensures that the framebuffer is complete, throwing an exception if it
isn't. */
void require_complete() const;