#include "deviceinfo.h"
#include "error.h"
#include "frameformat.h"
+#include "gl.h"
using namespace std;
throw invalid_operation("FrameFormat::operator,");
FrameFormat r = *this;
- uint16_t &fa = r.attachments[r.count-1];
- fa = make_typed_attachment(static_cast<FrameAttachment>(fa), pf);
+ FrameAttachment &fa = r.attachments[r.count-1];
+ fa = make_typed_attachment(fa, pf);
return r;
}
throw invalid_operation("FrameFormat::operator,");
FrameFormat r = *this;
- uint16_t &fa = r.attachments[r.count-1];
- fa = make_indexed_attachment(static_cast<FrameAttachment>(fa), index);
+ FrameAttachment &fa = r.attachments[r.count-1];
+ fa = make_indexed_attachment(fa, index);
return r;
}
throw invalid_argument("make_indexed_attachment");
}
-PixelFormat get_attachment_pixelformat(uint16_t fa)
+PixelFormat get_attachment_pixelformat(FrameAttachment fa)
{
PixelComponents comp;
if(get_attach_point(fa)==get_attach_point(DEPTH_ATTACHMENT))
return make_pixelformat(comp, type);
}
-GLenum get_gl_attachment(FrameAttachment fa)
+unsigned get_gl_attachment(FrameAttachment fa)
{
if(get_attach_point(fa)==get_attach_point(DEPTH_ATTACHMENT))
return GL_DEPTH_ATTACHMENT;
return GL_COLOR_ATTACHMENT0+get_attach_point(fa);
}
+unsigned get_gl_buffer_bits(const FrameFormat &format)
+{
+ unsigned bits = 0;
+ for(FrameAttachment a: format)
+ {
+ if(get_attach_point(a)==get_attach_point(DEPTH_ATTACHMENT))
+ bits |= GL_DEPTH_BUFFER_BIT;
+ else if(get_attach_point(a)==get_attach_point(STENCIL_ATTACHMENT))
+ bits |= GL_STENCIL_BUFFER_BIT;
+ else
+ bits |= GL_COLOR_BUFFER_BIT;
+ }
+ return bits;
+}
+
} // namespace GL
} // namespace Msp