--- /dev/null
+extension ARB_internalformat_query2
+# Some of the constants are only defined in conjunction of other extensions
+ignore GL_SRGB_DECODE_ARB
+ignore GL_VIEW_CLASS_EAC_R11
+ignore GL_VIEW_CLASS_EAC_RG11
+ignore GL_VIEW_CLASS_ETC2_RGB
+ignore GL_VIEW_CLASS_ETC2_RGBA
+ignore GL_VIEW_CLASS_ETC2_EAC_RGBA
+ignore GL_VIEW_CLASS_ASTC_4x4_RGBA
+ignore GL_VIEW_CLASS_ASTC_5x4_RGBA
+ignore GL_VIEW_CLASS_ASTC_5x5_RGBA
+ignore GL_VIEW_CLASS_ASTC_6x5_RGBA
+ignore GL_VIEW_CLASS_ASTC_6x6_RGBA
+ignore GL_VIEW_CLASS_ASTC_8x5_RGBA
+ignore GL_VIEW_CLASS_ASTC_8x6_RGBA
+ignore GL_VIEW_CLASS_ASTC_8x8_RGBA
+ignore GL_VIEW_CLASS_ASTC_10x5_RGBA
+ignore GL_VIEW_CLASS_ASTC_10x6_RGBA
+ignore GL_VIEW_CLASS_ASTC_10x8_RGBA
+ignore GL_VIEW_CLASS_ASTC_10x10_RGBA
+ignore GL_VIEW_CLASS_ASTC_12x10_RGBA
+ignore GL_VIEW_CLASS_ASTC_12x12_RGBA
#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());
}