Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/constant_fold.cpp
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
| void ConstantFolder::make_constant(float value) const | void ConstantFolder::make_constant(float value) const | ||||
| { | { | ||||
| VLOG(1) << "Folding " << node->name << "::" << output->name() << " to constant (" << value | VLOG(1) << "Folding " << node->name << "::" << output->name() << " to constant (" << value | ||||
| << ")."; | << ")."; | ||||
| foreach (ShaderInput *sock, output->links) { | foreach (ShaderInput *sock, output->links) { | ||||
| sock->set(value); | sock->set(value); | ||||
| sock->constant_folded_in = true; | |||||
| } | } | ||||
| graph->disconnect(output); | graph->disconnect(output); | ||||
| } | } | ||||
| void ConstantFolder::make_constant(float3 value) const | void ConstantFolder::make_constant(float3 value) const | ||||
| { | { | ||||
| VLOG(1) << "Folding " << node->name << "::" << output->name() << " to constant " << value << "."; | VLOG(1) << "Folding " << node->name << "::" << output->name() << " to constant " << value << "."; | ||||
| foreach (ShaderInput *sock, output->links) { | foreach (ShaderInput *sock, output->links) { | ||||
| sock->set(value); | sock->set(value); | ||||
| sock->constant_folded_in = true; | |||||
| } | } | ||||
| graph->disconnect(output); | graph->disconnect(output); | ||||
| } | } | ||||
| void ConstantFolder::make_constant_clamp(float value, bool clamp) const | void ConstantFolder::make_constant_clamp(float value, bool clamp) const | ||||
| { | { | ||||
| make_constant(clamp ? saturate(value) : value); | make_constant(clamp ? saturate(value) : value); | ||||
| ▲ Show 20 Lines • Show All 380 Lines • Show Last 20 Lines | |||||