From 3639a70eaec1d49e5634f2cd5f6d4ecb7d79ef14 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 6 Apr 2015 14:11:28 +0500 Subject: [PATCH] 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. --- intern/cycles/render/nodes.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index a62634efa42..40bb82c6330 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -2248,10 +2248,15 @@ void GeometryNode::compile(SVMCompiler& compiler) out = output("Pointiness"); if(!out->links.empty()) { compiler.stack_assign(out); - compiler.add_node(attr_node, - ATTR_STD_POINTINESS, - out->stack_offset, - NODE_ATTR_FLOAT); + if(compiler.output_type() != SHADER_TYPE_VOLUME) { + compiler.add_node(attr_node, + ATTR_STD_POINTINESS, + out->stack_offset, + NODE_ATTR_FLOAT); + } + else { + compiler.add_node(NODE_VALUE_F, __float_as_int(0.0f), out->stack_offset); + } } }