X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fprogram.h;h=f2d7d07672643edb8c83dd4a214bd45a7594be4b;hb=e92de029768eef5f0fd744329e589161b46d0762;hp=666cfd3eeda8f6a00449b9ab4d899ff64aa0af78;hpb=6f39983060a27634c012f66c82fea0d09fea9774;p=libs%2Fgl.git diff --git a/source/core/program.h b/source/core/program.h index 666cfd3e..f2d7d076 100644 --- a/source/core/program.h +++ b/source/core/program.h @@ -4,7 +4,6 @@ #include #include #include -#include "bindable.h" #include "datatype.h" #include "gl.h" #include "module.h" @@ -20,7 +19,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,21 +100,31 @@ public: }; private: - struct Bindings + enum Stage + { + VERTEX, + GEOMETRY, + FRAGMENT, + MAX_STAGES + }; + + struct TransientData { std::map textures; std::map blocks; + std::map spec_values; }; unsigned id; - std::vector stage_ids; + unsigned stage_ids[MAX_STAGES]; const Module *module; - Bindings *bindings; + TransientData *transient; bool linked; std::vector uniform_blocks; std::vector uniforms; LayoutHash uniform_layout_hash; std::vector attributes; + std::string debug_name; public: /// Constructs an empty Program with no shader stages attached. @@ -137,7 +146,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 &); @@ -180,8 +190,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