Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-12-28 17:30:43 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-12-28 17:42:37 +0300
commit1a246afe0330546a9fb526558d24b47c69e678d4 (patch)
tree77354c1e52b576dfa921bdbf88195eef0497cb63 /intern/cycles/render/svm.cpp
parentb26fb531f3699d384775703e7da7277a5b2eb1bd (diff)
Cycles: Use different approach for SVM summary report
Use Summary structure to collect all summary related on the shader compilation process which then could be either simply reported to the log or be passed to some user interface or so. This is type of the summary / report which is most flexible and useful and something we could use for other parts like shader optimization.
Diffstat (limited to 'intern/cycles/render/svm.cpp')
-rw-r--r--intern/cycles/render/svm.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index 5b085d74857..cfc961ab330 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -76,9 +76,14 @@ void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
if(shader->use_mis && shader->has_surface_emission)
scene->light_manager->need_update = true;
+ SVMCompiler::Summary summary;
SVMCompiler compiler(scene->shader_manager, scene->image_manager);
compiler.background = ((int)i == scene->default_background);
- compiler.compile(scene, shader, svm_nodes, i);
+ compiler.compile(scene, shader, svm_nodes, i, &summary);
+
+ VLOG(1) << "Compilation summary:\n"
+ << "Shader name: " << shader->name << "\n"
+ << summary.full_report();
}
dscene->svm_nodes.copy((uint4*)&svm_nodes[0], svm_nodes.size());
@@ -706,10 +711,12 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
void SVMCompiler::compile(Scene *scene,
Shader *shader,
vector<int4>& global_svm_nodes,
- int index)
+ int index,
+ Summary *summary)
{
/* copy graph for shader with bump mapping */
ShaderNode *node = shader->graph->output();
+ int start_num_svm_nodes = global_svm_nodes.size();
if(node->input("Surface")->link && node->input("Displacement")->link)
if(!shader->graph_bump)
@@ -764,10 +771,27 @@ void SVMCompiler::compile(Scene *scene,
global_svm_nodes[index*2 + 1].w = global_svm_nodes.size();
global_svm_nodes.insert(global_svm_nodes.end(), svm_nodes.begin(), svm_nodes.end());
- /* TODO(sergey): Consider making it more generic compile report. */
- VLOG(1) << "Statistics for compiled shader " << shader->name << ":";
- VLOG(1) << " Number of SVM nodes: " << global_svm_nodes.size();
- VLOG(1) << " Maximum stack usage: " << max_stack_use;
+ /* Fill in summary information. */
+ if(summary != NULL) {
+ summary->peak_stack_usage = max_stack_use;
+ summary->num_svm_nodes = global_svm_nodes.size() - start_num_svm_nodes;
+ }
+}
+
+/* Compiler summary implementation. */
+
+SVMCompiler::Summary::Summary()
+ : num_svm_nodes(0),
+ peak_stack_usage(0)
+{
+}
+
+string SVMCompiler::Summary::full_report() const
+{
+ string report = "";
+ report += string_printf("Number of SVM nodes: %d\n", num_svm_nodes);
+ report += string_printf("Peak stack usage: %d", peak_stack_usage);
+ return report;
}
CCL_NAMESPACE_END