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 using FuncPtr = void (*)(unsigned, unsigned, const void *);
34 UniformCall(unsigned l, unsigned s, FuncPtr f): location(l), size(s), func(f) { }
38 unsigned stage_ids[MAX_STAGES] = { };
40 std::vector<UniformCall> uniform_calls;
41 std::string debug_name;
44 OpenGLProgram(OpenGLProgram &&);
47 bool has_stages() const;
48 unsigned add_stage(Stage);
49 void add_glsl_stages(const GlslModule &, const std::map<std::string, int> &);
50 void compile_glsl_stage(const GlslModule &, unsigned);
51 void add_spirv_stages(const SpirVModule &, const std::map<std::string, int> &);
53 void link(const Module &);
54 void query_uniforms();
55 void query_uniform_blocks(const std::vector<ReflectData::UniformInfo *> &);
56 void query_attributes();
57 void finalize_uniforms();
59 void set_debug_name(const std::string &);
60 void set_stage_debug_name(unsigned, Stage);
63 using ProgramBackend = OpenGLProgram;