1 #ifndef MSP_GL_FRAMEFORMAT_H_
2 #define MSP_GL_FRAMEFORMAT_H_
5 #include "pixelformat.h"
11 Describes a single attachment of a framebuffer. The values are bitfields laid
15 │ │ │ └╴Number of components
16 │ │ └─────╴Size of one component
17 │ └──────────╴Floating-point flag
18 └────────────╴Attachment index
20 This information is presented for internal documentation purposes only; it is
21 inadvisable for programs to rely on it.
23 enum FrameAttachment: std::uint16_t
25 COLOR_ATTACHMENT = 0x0014,
26 DEPTH_ATTACHMENT = 0xF941,
27 STENCIL_ATTACHMENT = 0xFC11
31 Describes the complete format of a framebuffer. It can hold multiple
32 attachments (currently up to seven) as well as a sample count.
37 enum { MAX_ATTACHMENTS = 7 };
41 FrameAttachment attachments[MAX_ATTACHMENTS];
45 FrameFormat(FrameAttachment);
47 FrameFormat operator,(FrameAttachment) const;
48 FrameFormat operator,(PixelFormat) const;
49 FrameFormat operator,(unsigned) const;
51 FrameFormat &set_samples(unsigned);
52 unsigned get_samples() const { return samples; }
54 unsigned size() const { return count; }
55 bool empty() const { return !count; }
56 const FrameAttachment *begin() const { return attachments; }
57 const FrameAttachment *end() const { return attachments+count; }
58 int index(FrameAttachment) const;
61 inline FrameFormat operator,(FrameAttachment fa1, FrameAttachment fa2)
62 { return (FrameFormat(fa1), fa2); }
64 FrameAttachment make_typed_attachment(FrameAttachment, PixelFormat);
66 inline FrameAttachment operator,(FrameAttachment fa, PixelFormat pf)
67 { return make_typed_attachment(fa, pf); }
69 FrameAttachment make_indexed_attachment(FrameAttachment, unsigned);
71 inline FrameAttachment operator,(FrameAttachment fa, unsigned i)
72 { return make_indexed_attachment(fa, i); }
74 inline unsigned get_attach_point(FrameAttachment fa)
77 PixelFormat get_attachment_pixelformat(FrameAttachment);
82 #include "frameformat_backend.h"