[Bf-blender-cvs] [03cb146] master: Fix T43496: Infinite loop in kernel when using surface attribute for volume

Sergey Sharybin noreply at git.blender.org
Sat Jan 31 10:44:05 CET 2015


Commit: 03cb146afa812c95acf0da7f30b3282e71bffcf0
Author: Sergey Sharybin
Date:   Sat Jan 31 14:39:19 2015 +0500
Branches: master
https://developer.blender.org/rB03cb146afa812c95acf0da7f30b3282e71bffcf0

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.

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

M	intern/cycles/kernel/geom/geom_attribute.h

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

diff --git a/intern/cycles/kernel/geom/geom_attribute.h b/intern/cycles/kernel/geom/geom_attribute.h
index 2ade0df..9ac16e8 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);
 	}




More information about the Bf-blender-cvs mailing list