#include <msp/gl/extensions/arb_draw_buffers.h>
#include <msp/gl/extensions/arb_direct_state_access.h>
+#include <msp/gl/extensions/arb_internalformat_query.h>
+#include <msp/gl/extensions/arb_internalformat_query2.h>
#include <msp/gl/extensions/ext_framebuffer_object.h>
#include <msp/gl/extensions/ext_texture_array.h>
#include <msp/gl/extensions/ext_texture3d.h>
if(fmt.empty())
throw invalid_argument("Framebuffer::set_format");
+ if(ARB_internalformat_query && ARB_internalformat_query2)
+ {
+ unsigned target = (fmt.get_samples()>1 ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D);
+ for(FrameAttachment a: fmt)
+ {
+ unsigned pf = get_gl_pixelformat(get_attachment_pixelformat(a));
+ int supported = 0;
+ glGetInternalformativ(target, pf, GL_FRAMEBUFFER_RENDERABLE, 1, &supported);
+ if(supported!=GL_FULL_SUPPORT)
+ throw invalid_argument("Framebuffer::set_format");
+ }
+ }
+
format = fmt;
attachments.resize(format.size());
}