X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fframeformat.h;h=4662ae8f9d2d02ec8aebe576532f13e932d67ed8;hp=35d982ba8839f1489b75efab9489560a7aa2d6e3;hb=959efbf61663efd7879070ce0447e02c8a447ce0;hpb=3a1b9cbe2441ae670a97541dc8ccb0a2860c8302 diff --git a/source/core/frameformat.h b/source/core/frameformat.h index 35d982ba..4662ae8f 100644 --- a/source/core/frameformat.h +++ b/source/core/frameformat.h @@ -8,8 +8,10 @@ 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. + +The values are bitfields laid as follows: nnnn nn_f _sss _ccc │ │ │ └╴Number of components @@ -18,9 +20,9 @@ nnnn nn_f _sss _ccc └────────────╴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 = 0xF941, @@ -36,12 +38,12 @@ class FrameFormat private: enum { MAX_ATTACHMENTS = 7 }; - std::uint8_t count; - std::uint8_t samples; - std::uint16_t attachments[MAX_ATTACHMENTS]; + 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 +55,8 @@ public: unsigned size() const { return count; } bool empty() const { return !count; } - const std::uint16_t *begin() const { return attachments; } - const std::uint16_t *end() const { return attachments+count; } + const FrameAttachment *begin() const { return attachments; } + const FrameAttachment *end() const { return attachments+count; } int index(FrameAttachment) const; }; @@ -71,14 +73,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(std::uint16_t fa) +inline unsigned get_attach_point(FrameAttachment fa) { return fa>>10; } -PixelFormat get_attachment_pixelformat(std::uint16_t); - -GLenum get_gl_attachment(FrameAttachment); +PixelFormat get_attachment_pixelformat(FrameAttachment); } // namespace GL } // namespace Msp +#include "frameformat_backend.h" + #endif