In Vulkan shader modules are objects of their own.
--- /dev/null
+#ifndef MSP_GL_MODULE_BACKEND_H_
+#define MSP_GL_MODULE_BACKEND_H_
+
+#include <msp/core/noncopyable.h>
+
+namespace Msp {
+namespace GL {
+
+class OpenGLSpirVModule: public NonCopyable
+{
+protected:
+ OpenGLSpirVModule() = default;
+ OpenGLSpirVModule(OpenGLSpirVModule &&) { };
+ ~OpenGLSpirVModule() = default;
+};
+
+using SpirVModuleBackend = OpenGLSpirVModule;
+
+} // namespace GL
+} // namespace Msp
+
+#endif
}
-SpirVModule::SpirVModule(const SpirVModule &other):
- code(other.code),
- entry_points(other.entry_points),
- structs(other.structs),
- variables(other.variables)
-{
- remap_pointers_from(other);
-}
-
-SpirVModule &SpirVModule::operator=(const SpirVModule &other)
-{
- code = other.code;
- entry_points = other.entry_points;
- structs = other.structs;
- variables = other.variables;
- remap_pointers_from(other);
- return *this;
-}
-
-void SpirVModule::remap_pointers_from(const SpirVModule &other)
-{
- for(EntryPoint &e: entry_points)
- for(const Variable *&v: e.globals)
- v = &variables[v-&other.variables.front()];
-
- for(Variable &v: variables)
- if(v.struct_type)
- v.struct_type = &structs[v.struct_type-&other.structs.front()];
-
- for(Structure &s: structs)
- for(StructMember &m: s.members)
- if(m.struct_type)
- m.struct_type = &structs[m.struct_type-&other.structs.front()];
-}
-
void SpirVModule::load_code(IO::Base &io)
{
uint32_t buffer[1024];
#include <vector>
#include <msp/io/base.h>
#include "datatype.h"
+#include "module_backend.h"
#include "glsl/compiler.h"
#include "glsl/sourcemap.h"
Afterwards reflection data is available, providing information about variables
forming the module's interface.
*/
-class SpirVModule: public Module
+class SpirVModule: public Module, public SpirVModuleBackend
{
public:
enum Stage
std::vector<Variable> variables;
std::vector<Constant> spec_constants;
-public:
- SpirVModule() = default;
- SpirVModule(const SpirVModule &);
- SpirVModule &operator=(const SpirVModule &);
-private:
- void remap_pointers_from(const SpirVModule &);
-
public:
virtual Format get_format() const { return SPIR_V; }