]> git.tdb.fi Git - libs/gl.git/commitdiff
Expose the maximum number of attributes and attachments
authorMikko Rasa <tdb@tdb.fi>
Sat, 13 Nov 2021 15:01:36 +0000 (17:01 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 14 Nov 2021 09:47:47 +0000 (11:47 +0200)
source/core/frameformat.h
source/core/vertexformat.h
source/render/sequence.cpp

index c55a0f303b269a2d495d29be5cd3354bf4a3e06b..669261ff6f49582b5e663d2d8fee756e3c329408 100644 (file)
@@ -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];
index d5835013b53a925584bbfa8055a663f1f1382ed4..64c89e13166abae491fa2a50d30785cddd7a86cc 100644 (file)
@@ -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];
 
index 2a5b351c888d2b7e3c609706061f8ae352301bda..6c98b4023c293db017d8b43dcc3c9619dbeeacc4 100644 (file)
@@ -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;