[Bf-blender-cvs] [82745f2] temp-cycles-microdisplacement: Fix OSLRenderServices not finding attributes when subdivision is enabled

Mai Lavelle noreply at git.blender.org
Mon Apr 18 15:07:36 CEST 2016


Commit: 82745f299d57e57b3393d92581f1d86c938e12e0
Author: Mai Lavelle
Date:   Tue Apr 12 15:17:01 2016 -0400
Branches: temp-cycles-microdisplacement
https://developer.blender.org/rB82745f299d57e57b3393d92581f1d86c938e12e0

Fix OSLRenderServices not finding attributes when subdivision is enabled

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

M	intern/cycles/kernel/osl/osl_services.cpp

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

diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index 3da3b2b..a27b4ed 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -795,7 +795,7 @@ bool OSLRenderServices::get_attribute(ShaderData *sd, bool derivatives, ustring
                                       TypeDesc type, ustring name, void *val)
 {
 	KernelGlobals *kg = sd->osl_globals;
-	bool is_curve;
+	int prim_type = 0;
 	int object;
 
 	/* lookup of attribute on another object */
@@ -806,18 +806,18 @@ bool OSLRenderServices::get_attribute(ShaderData *sd, bool derivatives, ustring
 			return false;
 
 		object = it->second;
-		is_curve = false;
 	}
 	else {
 		object = sd->object;
-		is_curve = (sd->type & PRIMITIVE_ALL_CURVE) != 0;
+		prim_type |= (sd->type & PRIMITIVE_ALL_CURVE) != 0 ? ATTR_PRIM_CURVE : 0;
+		prim_type |= (sd->type & PRIMITIVE_CACHE_TRIANGLE) != 0 ? ATTR_PRIM_SUBD : 0;
 
 		if(object == OBJECT_NONE)
 			return get_background_attribute(kg, sd, name, type, derivatives, val);
 	}
 
 	/* find attribute on object */
-	object = object*ATTR_PRIM_TYPES + (is_curve == true);
+	object = object*ATTR_PRIM_TYPES + prim_type;
 	OSLGlobals::AttributeMap& attribute_map = kg->osl->attribute_map[object];
 	OSLGlobals::AttributeMap::iterator it = attribute_map.find(name);




More information about the Bf-blender-cvs mailing list