Fix T65957: Cycles crash with OSL and UV maps

This commit is contained in:
Brecht Van Lommel 2019-06-21 14:33:06 +02:00
parent d6b542b854
commit 83a4f5600d
Notes: blender-bot 2023-02-14 10:32:59 +01:00
Referenced by issue #65957, swapping texture co-ordinate causes Blender to crash
2 changed files with 5 additions and 1 deletions

View 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);

View 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;