1 #ifndef MSP_GL_PROGRAM_BACKEND_H_
2 #define MSP_GL_PROGRAM_BACKEND_H_
7 #include <msp/core/noncopyable.h>
8 #include "reflectdata.h"
13 class OpenGLProgram: public NonCopyable
15 friend class OpenGLPipelineState;
28 std::map<std::string, unsigned> textures;
29 std::map<std::string, unsigned> blocks;
34 using FuncPtr = void (*)(unsigned, unsigned, const void *);
40 UniformCall(unsigned l, unsigned s, FuncPtr f): location(l), size(s), func(f) { }
44 unsigned stage_ids[MAX_STAGES] = { };
46 std::vector<UniformCall> uniform_calls;
47 std::string debug_name;
50 OpenGLProgram(OpenGLProgram &&);
53 bool has_stages() const;
54 unsigned add_stage(Stage);
55 void add_glsl_stages(const GlslModule &, const std::map<std::string, int> &, TransientData &);
56 void compile_glsl_stage(const GlslModule &, unsigned);
57 void add_spirv_stages(const SpirVModule &, const std::map<std::string, int> &);
59 void finalize(const Module &, TransientData &);
60 void query_uniforms();
61 void query_uniform_blocks(const std::vector<ReflectData::UniformInfo *> &);
62 void query_attributes();
63 void apply_bindings(const TransientData &);
64 void finalize_uniforms();
66 void set_debug_name(const std::string &);
67 void set_stage_debug_name(unsigned, Stage);
70 using ProgramBackend = OpenGLProgram;