Cycles: Optimize shaders earlier to skip unneccessary attributes for noninteractive rendering

Before, Cycles would first sync the shader exactly as shown in the UI, then determine and sync the used attributes and later optimize the shader.
Therefore, even completely unconnected nodes would cause unneccessary attributes to be synced.

The reason for this is to avoid frequent resyncs when editing shaders interactively, but it can still be avoided for noninteractive renders - which is what this commit does.

Reviewed by: sergey

Differential Revision: https://developer.blender.org/D2285
This commit is contained in:
Lukas Stockner
2016-12-14 23:47:39 +01:00
parent 086320a62e
commit 5aaa643947
5 changed files with 39 additions and 9 deletions

View File

@@ -1096,11 +1096,9 @@ void OSLCompiler::compile(Scene *scene, OSLGlobals *og, Shader *shader)
/* finalize */
shader->graph->finalize(scene,
false,
true,
shader->has_integrator_dependency);
if(shader->graph_bump) {
shader->graph_bump->finalize(scene,
true,
true,
shader->has_integrator_dependency,
shader->displacement_method == DISPLACE_BOTH);