X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fprogram.h;h=a494e0798f5d67ef5ecaf7f770d7e289a06bc150;hb=9b3bce7ae76ff8c0c81315d2505ea96bf422a318;hp=201d927037c57edf0d1464ca1af4002fb28a6d1a;hpb=52335491d6e3b568f2b19bd0ec15c8d7b5f011da;p=libs%2Fgl.git diff --git a/source/core/program.h b/source/core/program.h index 201d9270..a494e079 100644 --- a/source/core/program.h +++ b/source/core/program.h @@ -20,7 +20,7 @@ class Shader; A complete shader program. Programs can be assembled of individual Shaders or generated with a set of standard features. */ -class Program: public Bindable +class Program { public: class Loader: public DataFile::CollectionObjectLoader @@ -101,6 +101,14 @@ public: }; private: + enum Stage + { + VERTEX, + GEOMETRY, + FRAGMENT, + MAX_STAGES + }; + struct TransientData { std::map textures; @@ -109,7 +117,7 @@ private: }; unsigned id; - std::vector stage_ids; + unsigned stage_ids[MAX_STAGES]; const Module *module; TransientData *transient; bool linked; @@ -117,6 +125,7 @@ private: std::vector uniforms; LayoutHash uniform_layout_hash; std::vector attributes; + std::string debug_name; public: /// Constructs an empty Program with no shader stages attached. @@ -138,7 +147,8 @@ public: void add_stages(const Module &, const std::map & = std::map()); private: - unsigned add_stage(GLenum); + bool has_stages() const; + unsigned add_stage(Stage); void add_glsl_stages(const GlslModule &, const std::map &); void compile_glsl_stage(unsigned); void add_spirv_stages(const SpirVModule &, const std::map &); @@ -181,8 +191,11 @@ public: const AttributeInfo &get_attribute_info(const std::string &) const; int get_attribute_location(const std::string &) const; - void bind() const; - static void unbind(); + unsigned get_id() const { return id; } + + void set_debug_name(const std::string &); +private: + void set_stage_debug_name(unsigned, Stage); }; } // namespace GL