for(const auto &kvp: kf_uniforms)
{
if(find_member(uniforms, kvp.first, &UniformInfo::name)==uniforms.end())
- uniforms.push_back(UniformInfo(kvp.first, kvp.second.size));
+ uniforms.emplace_back(kvp.first, kvp.second.size);
}
}
{
typename Knot::Value cv = knots.back().y;
knots.back().y = (knots[knots.size()-2].y+cv*2.0)/3.0;
- knots.push_back(Knot(x, (dvalue+cv*2.0)/3.0));
+ knots.emplace_back(x, (dvalue+cv*2.0/3.0));
}
else if(n_control==0 && !knots.empty())
{
typename Knot::Value prev = knots.back().y;
- knots.push_back(Knot(knots.back().x, (prev*2.0+dvalue)/3.0));
- knots.push_back(Knot(x, (prev+dvalue*2.0)/3.0));
+ knots.emplace_back(knots.back().x, (prev*2.0+dvalue)/3.0);
+ knots.emplace_back(x, (prev+dvalue*2.0/3.0));
}
n_control = 0;
}
- knots.push_back(Knot(x, value));
+ knots.emplace_back(x, value);
}
}
target.stacked = stacked;
// TODO check for incompatible armature
target.armature = anim.get_armature();
- target.animations.push_back(PlayingAnimation(anim, speed));
+ target.animations.emplace_back(anim, speed);
return target;
}
Armature::Link &Armature::add_link()
{
- links.push_back(Link(string(), links.size()));
+ links.emplace_back(string(), links.size());
return links.back();
}
if(len>3 && !strcmp(name+len-3, "[0]"))
name[len-3] = 0;
- rd.uniforms.push_back(ReflectData::UniformInfo());
+ rd.uniforms.emplace_back();
ReflectData::UniformInfo &info = rd.uniforms.back();
info.name = name;
info.tag = name;
query_uniform_blocks(uniforms_by_index);
}
- rd.uniform_blocks.push_back(ReflectData::UniformBlockInfo());
+ rd.uniform_blocks.emplace_back();
ReflectData::UniformBlockInfo &default_block = rd.uniform_blocks.back();
for(ReflectData::UniformInfo &u: rd.uniforms)
char name[128];
int len;
glGetActiveUniformBlockName(id, i, sizeof(name), &len, name);
- rd.uniform_blocks.push_back(ReflectData::UniformBlockInfo());
+ rd.uniform_blocks.emplace_back();
ReflectData::UniformBlockInfo &info = rd.uniform_blocks.back();
info.name = name;
if(len>3 && !strcmp(name+len-3, "[0]"))
name[len-3] = 0;
- rd.attributes.push_back(ReflectData::AttributeInfo());
+ rd.attributes.emplace_back();
ReflectData::AttributeInfo &info = rd.attributes.back();
info.name = name;
info.location = glGetAttribLocation(id, name);
void SequenceTemplate::ClearLoader::color(float r, float g, float b, float a)
{
- obj.clear_colors.push_back(Color(r, g, b, a));
+ obj.clear_colors.emplace_back(r, g, b, a);
}
void SequenceTemplate::ClearLoader::depth(float d)
void Program::collect_uniforms(const SpirVModule &mod, const vector<uint8_t> &used_variables)
{
// Prepare the default block
- reflect_data.uniform_blocks.push_back(ReflectData::UniformBlockInfo());
+ reflect_data.uniform_blocks.emplace_back();
vector<vector<string> > block_uniform_names(1);
const vector<SpirVModule::Variable> &variables = mod.get_variables();
const SpirVModule::Variable &v = variables[i];
if((v.storage==SpirVModule::UNIFORM || v.storage==SpirVModule::PUSH_CONSTANT) && v.struct_type)
{
- reflect_data.uniform_blocks.push_back(ReflectData::UniformBlockInfo());
+ reflect_data.uniform_blocks.emplace_back();
ReflectData::UniformBlockInfo &info = reflect_data.uniform_blocks.back();
info.name = v.struct_type->name;
if(v.storage==SpirVModule::PUSH_CONSTANT)
string prefix;
if(!v.name.empty())
prefix = v.struct_type->name+".";
- block_uniform_names.push_back(vector<string>());
+ block_uniform_names.emplace_back();
collect_block_uniforms(*v.struct_type, prefix, 0, block_uniform_names.back());
}
else if(v.storage==SpirVModule::UNIFORM_CONSTANT && (v.location>=0 || v.binding>=0))
{
block_uniform_names[0].push_back(v.name);
- reflect_data.uniforms.push_back(ReflectData::UniformInfo());
+ reflect_data.uniforms.emplace_back();
ReflectData::UniformInfo &info = reflect_data.uniforms.back();
info.name = v.name;
info.tag = v.name;
{
string name = prefix+m.name;
uniform_names.push_back(name);
- reflect_data.uniforms.push_back(ReflectData::UniformInfo());
+ reflect_data.uniforms.emplace_back();
ReflectData::UniformInfo &info = reflect_data.uniforms.back();
info.name = name;
info.tag = name;
for(const SpirVModule::Variable *v: e.globals)
if(v->storage==SpirVModule::INPUT && used_variables[v-variables.data()])
{
- reflect_data.attributes.push_back(ReflectData::AttributeInfo());
+ reflect_data.attributes.emplace_back();
ReflectData::AttributeInfo &info = reflect_data.attributes.back();
info.name = v->name;
info.location = v->location;
vector<Branch> branches;
if(type.base_type)
- branches.push_back(format("%s: %%%d %s", (type.kind==BasicTypeDeclaration::ALIAS ? "Alias of" : "Base"), get_label(*type.base_type), type.base_type->name));
+ branches.emplace_back(format("%s: %%%d %s", (type.kind==BasicTypeDeclaration::ALIAS ? "Alias of" : "Base"), get_label(*type.base_type), type.base_type->name));
if(type.kind==BasicTypeDeclaration::VECTOR)
- branches.push_back(format("Vector: %d", type.size));
+ branches.emplace_back(format("Vector: %d", type.size));
else if(type.kind==BasicTypeDeclaration::MATRIX)
- branches.push_back(format("Matrix: %dx%d", type.size&0xFFFF, type.size>>16));
+ branches.emplace_back(format("Matrix: %dx%d", type.size&0xFFFF, type.size>>16));
append_subtree(branches);
}
append(type, format("%%%d typedef %s", get_label(type), type.name));
vector<Branch> branches;
- branches.push_back(format("Dimensions: %s%s", dims[type.dimensions-1], (type.array ? " array" : "")));
+ branches.emplace_back(format("Dimensions: %s%s", dims[type.dimensions-1], (type.array ? " array" : "")));
if(type.base_type)
- branches.push_back(format("Element type: %%%d %s", get_label(*type.base_type), type.base_type->name));
+ branches.emplace_back(format("Element type: %%%d %s", get_label(*type.base_type), type.base_type->name));
if(type.shadow)
- branches.push_back("Shadow");
+ branches.emplace_back("Shadow");
append_subtree(branches);
}
if(var.array)
{
if(var.array_size)
- branches.push_back(Branch("Array []", var.array_size.get()));
+ branches.emplace_back("Array []", var.array_size.get());
else
branches.push_back("Array []");
}
append(cond, "if()");
vector<Branch> branches;
- branches.push_back(cond.condition.get());
- branches.push_back(Branch("then", &cond.body));
+ branches.emplace_back(cond.condition.get());
+ branches.emplace_back("then", &cond.body);
if(!cond.else_body.body.empty())
- branches.push_back(Branch("else", &cond.else_body));
+ branches.emplace_back("else", &cond.else_body);
append_subtree(branches);
}
vector<Branch> branches;
if(iter.init_statement)
- branches.push_back(Branch("Initialization", iter.init_statement.get()));
+ branches.emplace_back("Initialization", iter.init_statement.get());
if(iter.condition)
- branches.push_back(Branch("Condition", iter.condition.get()));
+ branches.emplace_back("Condition", iter.condition.get());
if(iter.loop_expression)
- branches.push_back(Branch("Loop", iter.loop_expression.get()));
- branches.push_back(&iter.body);
+ branches.emplace_back("Loop", iter.loop_expression.get());
+ branches.emplace_back(&iter.body);
append_subtree(branches);
}
if(targets_overlap(i->first, assign.target))
i->second->blocked = true;
- expressions.push_back(ExpressionInfo());
+ expressions.emplace_back();
ExpressionInfo &info = expressions.back();
info.target = assign.target;
// Self-referencing assignments can't be inlined without additional work.
analyze and non-trivial expressions could be expensive to inline. */
if((current_block->parent || (constant && r_trivial)) && var.interface.empty())
{
- expressions.push_back(ExpressionInfo());
+ expressions.emplace_back();
ExpressionInfo &info = expressions.back();
info.target = &var;
/* Assume variables declared in an iteration initialization statement
void UnusedVariableRemover::record_assignment(const Assignment::Target &target, Node &node)
{
- assignments.push_back(AssignmentInfo());
+ assignments.emplace_back();
AssignmentInfo &assign_info = assignments.back();
assign_info.node = &node;
assign_info.target = target;
auto i = find_member(textures, tag, &TextureSlot::tag);
if(i==textures.end())
{
- textures.push_back(TextureSlot(tag));
+ textures.emplace_back(tag);
i = textures.end()-1;
}
i->texture = tex;
auto i = find_member(obj.textures, Tag(n), &TextureSlot::tag);
if(i==obj.textures.end())
{
- obj.textures.push_back(TextureSlot(n));
+ obj.textures.emplace_back(n);
i = obj.textures.end()-1;
}
TextureSlot::Loader ldr(*i, n, coll);
for(unsigned j=0; j<n_vertices; ++j)
{
const float *v = reinterpret_cast<const float *>(vertices[j]+offset);
- points.push_back(Vector3(v[0], v[1], (three ? v[2] : 0.0f)));
+ points.emplace_back(v[0], v[1], (three ? v[2] : 0.0f));
}
}
if(current_state)
throw invalid_operation("Renderer::begin");
- state_stack.push_back(State());
+ state_stack.emplace_back();
current_state = &state_stack.back();
RendererBackend::begin();
break;
}
- texture_stack.push_back(BoundTexture());
+ texture_stack.emplace_back();
BoundTexture &bound_tex = texture_stack.back();
bound_tex.tag = tag;
bound_tex.texture = tex;
Sequence::Step &Sequence::add_step(Tag tag, Renderable &r)
{
- steps.push_back(Step(tag, &r));
+ steps.emplace_back(tag, &r);
return steps.back();
}
catch(const exception &e)
{
MutexLock lock(queue_mutex);
- error_queue.push_back(resource_load_error(managed->location.name, e));
+ error_queue.emplace_back(managed->location.name, e);
managed->state = ManagedResource::LOAD_ERROR;
}