Fix T65957: Cycles crash with OSL and UV maps
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 21 Jun 2019 12:33:06 +0000 (14:33 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 21 Jun 2019 12:46:50 +0000 (14:46 +0200)
intern/cycles/kernel/osl/osl_services.cpp
intern/cycles/render/mesh.cpp

index 08821ffa099cfb59b3b35fda790bb1934f2b499b..9196caad1b326811d99be41fafde488099721128 100644 (file)
@@ -617,7 +617,7 @@ static bool get_primitive_attribute(KernelGlobals *kg,
     return set_attribute_float3(fval, type, derivatives, val);
   }
   else if (attr.type == TypeFloat2) {
-    float2 fval[2];
+    float2 fval[3];
     fval[0] = primitive_attribute_float2(
         kg, sd, attr.desc, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
     return set_attribute_float2(fval, type, derivatives, val);
index f16224934551214376e960b99ca436359e839dfc..78b9ec032734b0e02433f9c4bac167fd9d8efdf2 100644 (file)
@@ -1222,6 +1222,8 @@ void MeshManager::update_osl_attributes(Device *device,
           osl_attr.type = TypeDesc::TypeFloat;
         else if (req.curve_type == TypeDesc::TypeMatrix)
           osl_attr.type = TypeDesc::TypeMatrix;
+        else if (req.curve_type == TypeFloat2)
+          osl_attr.type = TypeFloat2;
         else
           osl_attr.type = TypeDesc::TypeColor;
 
@@ -1243,6 +1245,8 @@ void MeshManager::update_osl_attributes(Device *device,
           osl_attr.type = TypeDesc::TypeFloat;
         else if (req.subd_type == TypeDesc::TypeMatrix)
           osl_attr.type = TypeDesc::TypeMatrix;
+        else if (req.subd_type == TypeFloat2)
+          osl_attr.type = TypeFloat2;
         else
           osl_attr.type = TypeDesc::TypeColor;