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:
-rw-r--r--intern/cycles/render/svm.cpp36
-rw-r--r--intern/cycles/render/svm.h18
2 files changed, 47 insertions, 7 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
diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h
index 02855f22fb3..bc641d2e00a 100644
--- a/intern/cycles/render/svm.h
+++ b/intern/cycles/render/svm.h
@@ -52,11 +52,27 @@ public:
class SVMCompiler {
public:
+ struct Summary {
+ Summary();
+
+ /* Number of SVM nodes shader was compiled into. */
+ int num_svm_nodes;
+
+ /* Peak stack usage during shader evaluation. */
+ int peak_stack_usage;
+
+ /* A full multiline description of the state of the compiler after
+ * compilation.
+ */
+ string full_report() const;
+ };
+
SVMCompiler(ShaderManager *shader_manager, ImageManager *image_manager);
void compile(Scene *scene,
Shader *shader,
vector<int4>& svm_nodes,
- int index);
+ int index,
+ Summary *summary = NULL);
void stack_assign(ShaderOutput *output);
void stack_assign(ShaderInput *input);