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;
29 using FuncPtr = void (*)(unsigned, unsigned, const void *);
35 UniformCall(unsigned l, unsigned s, FuncPtr f): location(l), size(s), func(f) { }
39 unsigned stage_ids[MAX_STAGES] = { };
41 std::vector<UniformCall> uniform_calls;
42 std::string debug_name;
45 OpenGLProgram(OpenGLProgram &&);
48 bool has_stages() const;
49 unsigned add_stage(Stage);
50 void add_glsl_stages(const GlslModule &, const std::map<std::string, int> &);
51 void compile_glsl_stage(const GlslModule &, unsigned);
52 void add_spirv_stages(const SpirVModule &, const std::map<std::string, int> &);
54 void link(const Module &);
55 void query_uniforms();
56 void query_uniform_blocks(const std::vector<ReflectData::UniformInfo *> &);
57 void query_attributes();
58 void finalize_uniforms();
60 bool is_compute() const { return stage_ids[COMPUTE]; }
62 void set_debug_name(const std::string &);
63 void set_stage_debug_name(unsigned, Stage);
66 using ProgramBackend = OpenGLProgram;