X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fframeformat.h;h=669261ff6f49582b5e663d2d8fee756e3c329408;hb=11a5d4f2a35dfdcf61e16d4fcfba22e20ea6a3db;hp=45ea9198cd772b1adc3f370307df1ee4a9b17971;hpb=6353307898cd397e2bcde13e2448a8a678a60004;p=libs%2Fgl.git diff --git a/source/core/frameformat.h b/source/core/frameformat.h index 45ea9198..669261ff 100644 --- a/source/core/frameformat.h +++ b/source/core/frameformat.h @@ -1,29 +1,32 @@ #ifndef MSP_GL_FRAMEFORMAT_H_ #define MSP_GL_FRAMEFORMAT_H_ -#include +#include #include "pixelformat.h" namespace Msp { namespace GL { /** -Describes a single attachment of a framebuffer. The values are bitfields laid -as follows: +Describes a single attachment of a framebuffer, including the type and index +of the attachment point and the format of the attached texture. -nnnn nn__ fsss _ccc - │ │ │ └╴Number of components - │ │ └─────╴Size of one component - │ └────────╴Floating-point flag +The values are bitfields laid as follows: + +nnnn nn_f _sss rccc + │ │ │ │ └╴Number of components + │ │ │ └───╴Reverse order flag + │ │ └─────╴Size of one component + │ └──────────╴Floating-point flag └────────────╴Attachment index This information is presented for internal documentation purposes only; it is -inadvisable for programs to rely on it. +inadvisable for applications to rely on it. */ -enum FrameAttachment +enum FrameAttachment: std::uint16_t { COLOR_ATTACHMENT = 0x0014, - DEPTH_ATTACHMENT = 0xF8C1, + DEPTH_ATTACHMENT = 0xF941, STENCIL_ATTACHMENT = 0xFC11 }; @@ -33,15 +36,16 @@ attachments (currently up to seven) as well as a sample count. */ class FrameFormat { -private: - enum { MAX_ATTACHMENTS = 7 }; +public: + static constexpr unsigned MAX_ATTACHMENTS = 7; - UInt8 count; - UInt8 samples; - UInt16 attachments[MAX_ATTACHMENTS]; +private: + std::uint8_t count = 0; + std::uint8_t samples = 0; + FrameAttachment attachments[MAX_ATTACHMENTS]; public: - FrameFormat(); + FrameFormat() = default; FrameFormat(FrameAttachment); FrameFormat operator,(FrameAttachment) const; @@ -53,8 +57,8 @@ public: unsigned size() const { return count; } bool empty() const { return !count; } - const UInt16 *begin() const { return attachments; } - const UInt16 *end() const { return attachments+count; } + const FrameAttachment *begin() const { return attachments; } + const FrameAttachment *end() const { return attachments+count; } int index(FrameAttachment) const; }; @@ -71,14 +75,14 @@ FrameAttachment make_indexed_attachment(FrameAttachment, unsigned); inline FrameAttachment operator,(FrameAttachment fa, unsigned i) { return make_indexed_attachment(fa, i); } -inline unsigned get_attach_point(UInt16 fa) +inline unsigned get_attach_point(FrameAttachment fa) { return fa>>10; } -PixelFormat get_attachment_pixelformat(UInt16); - -GLenum get_gl_attachment(FrameAttachment); +PixelFormat get_attachment_pixelformat(FrameAttachment); } // namespace GL } // namespace Msp +#include "frameformat_backend.h" + #endif