Fix T44222: Crash using pointiness attribute for volume shaders

This attribute is not really supported for volumes, so it get's converted to
constant 0 at shader compile time.

TODO: We should consider doing the same for tangent attribute in order to save
some annoying checks at tracing time.
This commit is contained in:
Sergey Sharybin 2015-04-06 14:11:28 +05:00
parent a9bb8d8a73
commit 3639a70eae

@ -2248,10 +2248,15 @@ void GeometryNode::compile(SVMCompiler& compiler)
out = output("Pointiness"); out = output("Pointiness");
if(!out->links.empty()) { if(!out->links.empty()) {
compiler.stack_assign(out); compiler.stack_assign(out);
compiler.add_node(attr_node, if(compiler.output_type() != SHADER_TYPE_VOLUME) {
ATTR_STD_POINTINESS, compiler.add_node(attr_node,
out->stack_offset, ATTR_STD_POINTINESS,
NODE_ATTR_FLOAT); out->stack_offset,
NODE_ATTR_FLOAT);
}
else {
compiler.add_node(NODE_VALUE_F, __float_as_int(0.0f), out->stack_offset);
}
} }
} }