Fix T95644: Cycles doesn't update modified object attributes on GPU

evice_update_preprocess is supposed to detect modified attributes and flag the
device_vector for a copy through device_update_flags. However, since object
attributes are only created in device_update_attributes afterwards, they can't
be included in that check.

Change the function that actually updates the device_vector to tag it as
modified as soon as its content gets updated.

Differential Revision: https://developer.blender.org/D14815
This commit is contained in:
Lukas Stockner 2022-05-04 20:05:59 +02:00 committed by Brecht Van Lommel
parent 54f447ecde
commit 0fa1c65ee3
Notes: blender-bot 2023-02-14 05:16:25 +01:00
Referenced by issue #95644, Regression: Cycles preview doesn't refresh viewport with animated colors in custom property (on GPU, CPU is fine)
Referenced by issue #93630, Regression: Attribute Node Object Attribute not updating in Cycles GPU Compute
1 changed files with 6 additions and 0 deletions

View File

@ -618,6 +618,7 @@ void GeometryManager::update_attribute_element_offset(Geometry *geom,
for (size_t k = 0; k < size; k++) {
attr_uchar4[offset + k] = data[k];
}
attr_uchar4.tag_modified();
}
attr_uchar4_offset += size;
}
@ -630,6 +631,7 @@ void GeometryManager::update_attribute_element_offset(Geometry *geom,
for (size_t k = 0; k < size; k++) {
attr_float[offset + k] = data[k];
}
attr_float.tag_modified();
}
attr_float_offset += size;
}
@ -642,6 +644,7 @@ void GeometryManager::update_attribute_element_offset(Geometry *geom,
for (size_t k = 0; k < size; k++) {
attr_float2[offset + k] = data[k];
}
attr_float2.tag_modified();
}
attr_float2_offset += size;
}
@ -654,6 +657,7 @@ void GeometryManager::update_attribute_element_offset(Geometry *geom,
for (size_t k = 0; k < size * 3; k++) {
attr_float4[offset + k] = (&tfm->x)[k];
}
attr_float4.tag_modified();
}
attr_float4_offset += size * 3;
}
@ -666,6 +670,7 @@ void GeometryManager::update_attribute_element_offset(Geometry *geom,
for (size_t k = 0; k < size; k++) {
attr_float4[offset + k] = data[k];
}
attr_float4.tag_modified();
}
attr_float4_offset += size;
}
@ -678,6 +683,7 @@ void GeometryManager::update_attribute_element_offset(Geometry *geom,
for (size_t k = 0; k < size; k++) {
attr_float3[offset + k] = data[k];
}
attr_float3.tag_modified();
}
attr_float3_offset += size;
}