[Bf-blender-cvs] [83a4f5600d7] master: Fix T65957: Cycles crash with OSL and UV maps

Brecht Van Lommel noreply at git.blender.org
Fri Jun 21 14:54:01 CEST 2019


Commit: 83a4f5600d7b9fe3352d2f66898ea3f4a0c86738
Author: Brecht Van Lommel
Date:   Fri Jun 21 14:33:06 2019 +0200
Branches: master
https://developer.blender.org/rB83a4f5600d7b9fe3352d2f66898ea3f4a0c86738

Fix T65957: Cycles crash with OSL and UV maps

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

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

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

diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index 08821ffa099..9196caad1b3 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -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);
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index f1622493455..78b9ec03273 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -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;



More information about the Bf-blender-cvs mailing list