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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-17 01:36:30 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-17 01:36:30 +0400
commite9227c76d480c5e7973b6bce03cce3ad414b0348 (patch)
treebb635802c01c4239f18db5c9c2025580fdcc9b7f /intern/cycles/render
parent568e678fa3a72b5339f42449665c7403b3357a09 (diff)
Fix T37706: avoid cycles crash when using a stack that exceeds SVM stack limits.
This should be pretty rare, the shader in question had many parallel node links because of copying the nodes many times, which is inefficient to run anyway.
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/svm.cpp15
-rw-r--r--intern/cycles/render/svm.h1
2 files changed, 13 insertions, 3 deletions
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index e5140ea990b..538b1aae313 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -115,6 +115,7 @@ SVMCompiler::SVMCompiler(ShaderManager *shader_manager_, ImageManager *image_man
background = false;
mix_weight_offset = SVM_STACK_INVALID;
use_multi_closure = use_multi_closure_;
+ compile_failed = false;
}
int SVMCompiler::stack_size(ShaderSocketType type)
@@ -164,10 +165,12 @@ int SVMCompiler::stack_find_offset(ShaderSocketType type)
}
}
- fprintf(stderr, "Out of SVM stack space.\n");
- assert(0);
+ if(!compile_failed) {
+ compile_failed = true;
+ fprintf(stderr, "Cycles: out of SVM stack space, shader \"%s\" too big.\n", current_shader->name.c_str());
+ }
- return offset;
+ return 0;
}
void SVMCompiler::stack_clear_offset(ShaderSocketType type, int offset)
@@ -654,6 +657,12 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
node->compile(*this);
}
+ /* if compile failed, generate empty shader */
+ if(compile_failed) {
+ svm_nodes.clear();
+ compile_failed = false;
+ }
+
add_node(NODE_END, 0, 0, 0);
}
diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h
index 9693e54ce75..3d84a67e173 100644
--- a/intern/cycles/render/svm.h
+++ b/intern/cycles/render/svm.h
@@ -141,6 +141,7 @@ protected:
int max_stack_use;
uint mix_weight_offset;
bool use_multi_closure;
+ bool compile_failed;
};
CCL_NAMESPACE_END