#include <string>
#include <vector>
#include <msp/datafile/objectloader.h>
-#include "bindable.h"
#include "datatype.h"
#include "gl.h"
#include "module.h"
A complete shader program. Programs can be assembled of individual Shaders or
generated with a set of standard features.
*/
-class Program: public Bindable<Program>
+class Program
{
public:
class Loader: public DataFile::CollectionObjectLoader<Program>
};
private:
- struct Bindings
+ enum Stage
+ {
+ VERTEX,
+ GEOMETRY,
+ FRAGMENT,
+ MAX_STAGES
+ };
+
+ struct TransientData
{
std::map<std::string, unsigned> textures;
std::map<std::string, unsigned> blocks;
+ std::map<unsigned, int> spec_values;
};
unsigned id;
- std::vector<unsigned> stage_ids;
+ unsigned stage_ids[MAX_STAGES];
const Module *module;
- Bindings *bindings;
+ TransientData *transient;
bool linked;
std::vector<UniformBlockInfo> uniform_blocks;
std::vector<UniformInfo> uniforms;
LayoutHash uniform_layout_hash;
std::vector<AttributeInfo> attributes;
+ std::string debug_name;
public:
/// Constructs an empty Program with no shader stages attached.
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> &);
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