bool to_present = false;
unsigned n_attachments = framebuffer->get_format().size();
for(unsigned i=0; i<n_attachments; ++i)
- if(dynamic_cast<const SwapChainTexture *>(framebuffer->VulkanFramebuffer::get_attachment(i)))
+ if(dynamic_cast<const SwapChainTexture *>(framebuffer->get_attachment(i)))
to_present = true;
VkRenderPass render_pass = device.get_pipeline_cache().get_render_pass(framebuffer->get_format(), clear, !clear_values, to_present);
return true;
}
-const Texture *VulkanFramebuffer::get_attachment(unsigned i) const
-{
- return static_cast<const Framebuffer *>(this)->attachments[i].tex;
-}
-
void VulkanFramebuffer::update(unsigned) const
{
const Framebuffer &self = *static_cast<const Framebuffer *>(this);
bool is_format_supported(const FrameFormat &);
static void require_layered() { }
- const Texture *get_attachment(unsigned) const;
void update(unsigned) const;
void require_complete() const { }
}
}
+const Texture *Framebuffer::get_attachment(FrameAttachment attch) const
+{
+ if(attachments.empty())
+ return 0;
+
+ int i = format.index(attch);
+ return (i>=0 ? attachments[i].tex : 0);
+}
+
+const Texture *Framebuffer::get_attachment(unsigned i) const
+{
+ return (i<attachments.size() ? attachments[i].tex : 0);
+}
+
void Framebuffer::require_complete() const
{
bool layered = (!attachments.empty() && attachments.front().layer<0);
void attach_layered(FrameAttachment attch, TextureCube &, unsigned level = 0);
void detach(FrameAttachment attch);
+ const Texture *get_attachment(FrameAttachment) const;
+ const Texture *get_attachment(unsigned) const;
+
/** Ensures that the framebuffer is complete, throwing an exception if it
isn't. */
void require_complete() const;