X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fopengl%2Fprogram_backend.cpp;h=685f15421d6d726f34f6b73840a5f7ac96eb3e3f;hb=8a8cce8ef4ee28b3572a72958b8b407759f9f826;hp=911ce34e69fbf591ccd1950adea30ed91d6fda83;hpb=2e6e6fd559010aad6ae0d44c433e32acb387e8b9;p=libs%2Fgl.git diff --git a/source/backends/opengl/program_backend.cpp b/source/backends/opengl/program_backend.cpp index 911ce34e..685f1542 100644 --- a/source/backends/opengl/program_backend.cpp +++ b/source/backends/opengl/program_backend.cpp @@ -12,6 +12,7 @@ #include #include #include +#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 &spec_values, TransientData &transient) { - SL::Compiler compiler; + SL::Compiler compiler(Device::get_current().get_info().glsl_features); compiler.set_source(mod.get_prepared_source(), ""); compiler.specialize(spec_values); compiler.compile(SL::Compiler::PROGRAM); @@ -162,7 +174,7 @@ void OpenGLProgram::compile_glsl_stage(const GlslModule &mod, unsigned stage_id) #endif } -void OpenGLProgram::add_spirv_stages(const SpirVModule &mod, const map &spec_values, TransientData &transient) +void OpenGLProgram::add_spirv_stages(const SpirVModule &mod, const map &spec_values) { static Require _req(ARB_gl_spirv); static Require _req2(ARB_ES2_compatibility); @@ -201,7 +213,6 @@ void OpenGLProgram::add_spirv_stages(const SpirVModule &mod, const mapsecond); - transient.spec_values[c.constant_id] = i->second; } } @@ -493,6 +504,12 @@ void OpenGLProgram::finalize_uniforms() if(func) uniform_calls.push_back(UniformCall(u->location, u->array_size, func)); } + + if(i->data_size<=0) + { + const ReflectData::UniformInfo &last = *i->uniforms.back(); + i->data_size = last.location*16+last.array_size*get_type_size(last.type); + } } }