[Bf-blender-cvs] [3f39af9] master: Fix cycles volume render crash when trying to access primitive attributes like generated texture coordinates or tangents.

Brecht Van Lommel noreply at git.blender.org
Sat Dec 28 23:47:24 CET 2013


Commit: 3f39af9cc2765c2cf3daab30c4ad0be58e341e19
Author: Brecht Van Lommel
Date:   Sat Dec 28 23:39:15 2013 +0100
https://developer.blender.org/rB3f39af9cc2765c2cf3daab30c4ad0be58e341e19

Fix cycles volume render crash when trying to access primitive attributes
like generated texture coordinates or tangents.

===================================================================

M	intern/cycles/kernel/kernel_primitive.h
M	intern/cycles/kernel/svm/svm_attribute.h

===================================================================

diff --git a/intern/cycles/kernel/kernel_primitive.h b/intern/cycles/kernel/kernel_primitive.h
index 0e39c48..5a050c4 100644
--- a/intern/cycles/kernel/kernel_primitive.h
+++ b/intern/cycles/kernel/kernel_primitive.h
@@ -23,7 +23,7 @@ CCL_NAMESPACE_BEGIN
 
 ccl_device_inline int find_attribute(KernelGlobals *kg, ShaderData *sd, uint id, AttributeElement *elem)
 {
-	if(sd->object == ~0)
+	if(sd->object == ~0 || sd->prim == ~0)
 		return (int)ATTR_STD_NOT_FOUND;
 
 #ifdef __OSL__
diff --git a/intern/cycles/kernel/svm/svm_attribute.h b/intern/cycles/kernel/svm/svm_attribute.h
index 90409e1..4c53bfd 100644
--- a/intern/cycles/kernel/svm/svm_attribute.h
+++ b/intern/cycles/kernel/svm/svm_attribute.h
@@ -22,7 +22,7 @@ ccl_device void svm_node_attr_init(KernelGlobals *kg, ShaderData *sd,
 	uint4 node, NodeAttributeType *type,
 	NodeAttributeType *mesh_type, AttributeElement *elem, int *offset, uint *out_offset)
 {
-	if(sd->object != ~0) {
+	if(sd->object != ~0 && sd->prim != ~0) {
 		/* find attribute by unique id */
 		uint id = node.y;
 		uint attr_offset = sd->object*kernel_data.bvh.attributes_map_stride;




More information about the Bf-blender-cvs mailing list