Fix #139002: Cycles particle object instance appears in center of scene

The particle system generates some particles with NaN values. The
set_if_different mechanism skipped copying those due to a refactor
in the matrix equality test. Revert that part of 689633d802 for now.

A better solution would be to improve handling of NaNs in Cycles,
and to find and fix the cause of the NaN in the particle system.

Pull Request: https://projects.blender.org/blender/blender/pulls/139238
This commit is contained in:
Brecht Van Lommel
2025-05-22 01:10:19 +02:00
committed by Brecht Van Lommel
parent 3f705ff898
commit fc686ff257

View File

@@ -293,7 +293,9 @@ ccl_device_inline Transform transform_identity()
ccl_device_inline bool operator==(const Transform &A, const Transform &B)
{
return A.x == B.x && A.y == B.y && A.z == B.z;
/* Using memcmp because it returns true for NaN unlike component ==,
* which we need for set_if_different for node sockets to copy the value. */
return memcmp(&A, &B, sizeof(Transform)) == 0;
}
ccl_device_inline bool operator!=(const Transform &A, const Transform &B)
@@ -594,7 +596,7 @@ class BoundBox2D;
ccl_device_inline bool operator==(const DecomposedTransform &A, const DecomposedTransform &B)
{
return A.x == B.x && A.y == B.y && A.z == B.z && A.w == B.w;
return memcmp(&A, &B, sizeof(DecomposedTransform)) == 0;
}
float4 transform_to_quat(const Transform &tfm);