X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fprogram.h;h=9fa757479eacf11d09ca7880bbab83daeb74c6db;hb=c93e0613e96ec6817e26b533e90dc49d45787941;hp=e86ee0595f0ed307047681f74be256fbf06b3d70;hpb=dccad64b2ec82249d850b9745614042171499972;p=libs%2Fgl.git diff --git a/source/core/program.h b/source/core/program.h index e86ee059..9fa75747 100644 --- a/source/core/program.h +++ b/source/core/program.h @@ -11,6 +11,7 @@ namespace Msp { namespace GL { +class GlslModule; class Module; class Shader; @@ -36,6 +37,25 @@ public: void vertex_shader(const std::string &); }; +private: + class SpecializationLoader: public DataFile::Loader + { + private: + std::map &spec_values; + + static ActionMap shared_actions; + + public: + SpecializationLoader(std::map &); + + private: + virtual void init_actions(); + + void specialize_bool(const std::string &, bool); + void specialize_int(const std::string &, int); + }; + +public: typedef unsigned LayoutHash; struct UniformBlockInfo; @@ -73,7 +93,7 @@ public: private: unsigned id; - std::vector shader_ids; + std::vector stage_ids; const Module *module; bool linked; UniformBlockMap uniform_blocks; @@ -82,29 +102,37 @@ private: AttributeMap attributes; public: - /// Constructs an empty Program with no Shaders attached. + /// Constructs an empty Program with no shader stages attached. Program(); /// Constructs a Program from unified source code using ProgramCompiler. - Program(const std::string &); + DEPRECATED Program(const std::string &); /// Constructs a Program from vertex and fragment shader source code. DEPRECATED Program(const std::string &, const std::string &); + /// Constructs a Program from a Module, with specialization constants. + Program(const Module &, const std::map & = std::map()); + private: void init(); public: virtual ~Program(); - void add_stages(const Module &); + void add_stages(const Module &, const std::map & = std::map()); +private: + unsigned add_stage(GLenum); + void add_glsl_stages(const GlslModule &, const std::map &); + void compile_glsl_stage(unsigned); +public: DEPRECATED void attach_shader(Shader &shader); DEPRECATED void attach_shader_owned(Shader *shader); DEPRECATED void detach_shader(Shader &shader); DEPRECATED const std::vector &get_attached_shaders() const; DEPRECATED void bind_attribute(unsigned, const std::string &); - DEPRECATED void bind_attribute(VertexComponent, const std::string &); + DEPRECATED void bind_attribute(VertexAttribute, const std::string &); DEPRECATED void bind_fragment_data(unsigned, const std::string &); void link();