From: Mikko Rasa Date: Sat, 13 Nov 2021 15:01:36 +0000 (+0200) Subject: Expose the maximum number of attributes and attachments X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=08e74e913d80693c79c00c18da1130cc5604952c;p=libs%2Fgl.git Expose the maximum number of attributes and attachments --- diff --git a/source/core/frameformat.h b/source/core/frameformat.h index c55a0f30..669261ff 100644 --- a/source/core/frameformat.h +++ b/source/core/frameformat.h @@ -36,9 +36,10 @@ 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; +private: std::uint8_t count = 0; std::uint8_t samples = 0; FrameAttachment attachments[MAX_ATTACHMENTS]; diff --git a/source/core/vertexformat.h b/source/core/vertexformat.h index d5835013..64c89e13 100644 --- a/source/core/vertexformat.h +++ b/source/core/vertexformat.h @@ -76,9 +76,10 @@ Describes the attributes of a vertex. Up to 15 attributes are allowed. */ class VertexFormat { -private: - enum { MAX_ATTRIBUTES = 15 }; +public: + static constexpr unsigned MAX_ATTRIBUTES = 15; +private: std::uint8_t count = 0; VertexAttribute attributes[MAX_ATTRIBUTES]; diff --git a/source/render/sequence.cpp b/source/render/sequence.cpp index 2a5b351c..6c98b402 100644 --- a/source/render/sequence.cpp +++ b/source/render/sequence.cpp @@ -109,7 +109,7 @@ void Sequence::render(Renderer &renderer, Tag tag) const throw invalid_operation("Sequence::render"); const FrameFormat &format = target_fbo->get_format(); - ClearValue clear_values[7]; + ClearValue clear_values[FrameFormat::MAX_ATTACHMENTS]; unsigned i = 0; Color default_color = (clear_colors.empty() ? Color(0.0f, 0.0f, 0.0f, 0.0f) : clear_colors.front()); ClearValue *cv = clear_values;