]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/program.h
Refactor program stage management
[libs/gl.git] / source / core / program.h
index 201d927037c57edf0d1464ca1af4002fb28a6d1a..090d8ed5ebc5c4d191ab24d13f7cef402502cdc3 100644 (file)
@@ -101,6 +101,14 @@ public:
        };
 
 private:
+       enum Stage
+       {
+               VERTEX,
+               GEOMETRY,
+               FRAGMENT,
+               MAX_STAGES
+       };
+
        struct TransientData
        {
                std::map<std::string, unsigned> textures;
@@ -109,7 +117,7 @@ private:
        };
 
        unsigned id;
-       std::vector<unsigned> stage_ids;
+       unsigned stage_ids[MAX_STAGES];
        const Module *module;
        TransientData *transient;
        bool linked;
@@ -138,7 +146,8 @@ public:
 
        void add_stages(const Module &, const std::map<std::string, int> & = std::map<std::string, int>());
 private:
-       unsigned add_stage(GLenum);
+       bool has_stages() const;
+       unsigned add_stage(Stage);
        void add_glsl_stages(const GlslModule &, const std::map<std::string, int> &);
        void compile_glsl_stage(unsigned);
        void add_spirv_stages(const SpirVModule &, const std::map<std::string, int> &);