]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/opengl/program_backend.cpp
Add support for padding in vertex formats
[libs/gl.git] / source / backends / opengl / program_backend.cpp
index 1fc8c4420556257c19a5611ce66b9d212b86da86..685f15421d6d726f34f6b73840a5f7ac96eb3e3f 100644 (file)
@@ -12,6 +12,7 @@
 #include <msp/gl/extensions/khr_debug.h>
 #include <msp/gl/extensions/nv_non_square_matrices.h>
 #include <msp/io/print.h>
+#include "device.h"
 #include "error.h"
 #include "program.h"
 #include "program_backend.h"
@@ -45,6 +46,17 @@ OpenGLProgram::OpenGLProgram()
        id = glCreateProgram();
 }
 
+OpenGLProgram::OpenGLProgram(OpenGLProgram &&other):
+       id(other.id),
+       linked(other.linked),
+       uniform_calls(move(other.uniform_calls)),
+       debug_name(move(other.debug_name))
+{
+       move(other.stage_ids, other.stage_ids+MAX_STAGES, stage_ids);
+       other.id = 0;
+       fill(other.stage_ids, other.stage_ids+MAX_STAGES, 0);
+}
+
 OpenGLProgram::~OpenGLProgram()
 {
        for(unsigned i=0; i<MAX_STAGES; ++i)
@@ -89,7 +101,7 @@ unsigned OpenGLProgram::add_stage(Stage type)
 
 void OpenGLProgram::add_glsl_stages(const GlslModule &mod, const map<string, int> &spec_values, TransientData &transient)
 {
-       SL::Compiler compiler;
+       SL::Compiler compiler(Device::get_current().get_info().glsl_features);
        compiler.set_source(mod.get_prepared_source(), "<module>");
        compiler.specialize(spec_values);
        compiler.compile(SL::Compiler::PROGRAM);