Fix cycles volume render crash when trying to access primitive attributes

like generated texture coordinates or tangents.
This commit is contained in:
Brecht Van Lommel 2013-12-28 23:39:15 +01:00
parent fe222643b4
commit 3f39af9cc2
Notes: blender-bot 2023-10-12 12:49:04 +02:00
Referenced by issue #37986, error building with updated ffmpg vs2012‏
2 changed files with 2 additions and 2 deletions

View File

@ -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__

View File

@ -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;