X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fprogram.h;h=fd1c1ae09d10e12943ca13140339b96d59cd5ecf;hp=6301edbe2c6e23ded094519e38f30db842ebbb55;hb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;hpb=b7f46931a9878b2fd7ec863d520dc22ac89c0baf diff --git a/source/core/program.h b/source/core/program.h index 6301edbe..fd1c1ae0 100644 --- a/source/core/program.h +++ b/source/core/program.h @@ -1,13 +1,13 @@ #ifndef MSP_GL_PROGRAM_H_ #define MSP_GL_PROGRAM_H_ +#include #include #include #include -#include "gl.h" #include "module.h" +#include "program_backend.h" #include "reflectdata.h" -#include "vertexformat.h" namespace Msp { namespace GL { @@ -16,9 +16,9 @@ namespace GL { A complete shader program. Programs can be assembled of individual Shaders or generated with a set of standard features. */ -class Program +class Program: public ProgramBackend { - friend class PipelineState; + friend ProgramBackend; public: class Loader: public DataFile::CollectionObjectLoader @@ -48,51 +48,17 @@ private: void specialize_int(const std::string &, int); }; - enum Stage - { - VERTEX, - GEOMETRY, - FRAGMENT, - MAX_STAGES - }; - - struct TransientData - { - std::map textures; - std::map blocks; - std::map spec_values; - }; - - unsigned id; - unsigned stage_ids[MAX_STAGES]; - bool linked; ReflectData reflect_data; - std::string debug_name; public: /// Constructs an empty Program with no shader stages attached. - Program(); + Program() = default; /// 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 &, const std::map & = std::map()); private: - bool has_stages() const; - unsigned add_stage(Stage); - void add_glsl_stages(const GlslModule &, const std::map &, TransientData &); - void compile_glsl_stage(const GlslModule &, unsigned); - void add_spirv_stages(const SpirVModule &, const std::map &, TransientData &); - - void finalize(const Module &, const TransientData &); - void query_uniforms(); - void query_uniform_blocks(const std::vector &); - void query_attributes(); void collect_uniforms(const SpirVModule &, const std::map &); void collect_block_uniforms(const SpirVModule::Structure &, const std::string &, unsigned, const std::map &, std::vector &); void collect_attributes(const SpirVModule &); @@ -111,9 +77,7 @@ public: const ReflectData::AttributeInfo &get_attribute_info(const std::string &) const; int get_attribute_location(const std::string &) const; - void set_debug_name(const std::string &); -private: - void set_stage_debug_name(unsigned, Stage); + using ProgramBackend::set_debug_name; }; } // namespace GL