From 03cb146afa812c95acf0da7f30b3282e71bffcf0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 31 Jan 2015 14:39:19 +0500 Subject: [PATCH] Fix T43496: Infinite loop in kernel when using surface attribute for volume The issue was caused bu the optimization in surface attributes for cases when there's only a volume shader used. Some attributes doesn't make sense in that case and were skipped from calculation. However, it is possible that kernel would still try to access them (because of the shader setup etc). Prevented an infinite loop in the kernel now, which should not have much affect on regular renders. --- intern/cycles/kernel/geom/geom_attribute.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/intern/cycles/kernel/geom/geom_attribute.h b/intern/cycles/kernel/geom/geom_attribute.h index 2ade0df768f..9ac16e86085 100644 --- a/intern/cycles/kernel/geom/geom_attribute.h +++ b/intern/cycles/kernel/geom/geom_attribute.h @@ -40,6 +40,9 @@ ccl_device_inline int find_attribute(KernelGlobals *kg, const ShaderData *sd, ui uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset); while(attr_map.x != id) { + if(UNLIKELY(attr_map.x == ATTR_STD_NONE)) { + return ATTR_STD_NOT_FOUND; + } attr_offset += ATTR_PRIM_TYPES; attr_map = kernel_tex_fetch(__attributes_map, attr_offset); }