X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Frender%2Fprogramdata.cpp;h=a908284b3abae9de3e8f177b8165daf084ff6eba;hp=cfd2c0f5257b0d45d341ff15119805ea96038474;hb=9ec0e018234391efa66cc0f4080bfe470b910288;hpb=e70662d7812464159f2e47f4bebb69d88f89ae93 diff --git a/source/render/programdata.cpp b/source/render/programdata.cpp index cfd2c0f5..a908284b 100644 --- a/source/render/programdata.cpp +++ b/source/render/programdata.cpp @@ -20,46 +20,6 @@ ProgramData::ProgramData(const Program *p): tied_program(p) { } -// Blocks are intentionally left uncopied -ProgramData::ProgramData(const ProgramData &other): - tied_program(other.tied_program), - uniforms(other.uniforms), - uniform_data(other.uniform_data), - generation(other.generation) -{ } - -ProgramData::ProgramData(const ProgramData &other, const Program *p): - tied_program(p) -{ - if(tied_program) - { - for(const TaggedUniform &u: other.uniforms) - validate_tag(u.tag); - } - - uniforms = other.uniforms; - uniform_data = other.uniform_data; -} - -ProgramData &ProgramData::operator=(const ProgramData &other) -{ - tied_program = other.tied_program; - - uniforms = other.uniforms; - uniform_data = other.uniform_data; - - for(SharedBlock &b: blocks) - delete b.block; - blocks.clear(); - programs.clear(); - - last_buffer_block = 0; - buffer = 0; - dirty = 0; - - return *this; -} - ProgramData::ProgramData(ProgramData &&other): tied_program(other.tied_program), uniforms(move(other.uniforms)), @@ -482,6 +442,12 @@ void ProgramData::copy_uniform(const ProgramData &source, Tag tag) uniform(tag, tu.type, tu.array_size, source.uniform_data.data()+tu.data_offset); } +void ProgramData::copy_uniforms(const ProgramData &source) +{ + for(const TaggedUniform &u: source.uniforms) + uniform(u.tag, u.type, u.array_size, source.uniform_data.data()+u.data_offset); +} + int ProgramData::find_uniform_index(Tag tag) const { auto i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);