Blender Git Loki

Git Commits -> Revision 12a0629

Revision 12a0629 by Kévin Dietrich (master)
May 26, 2021, 10:18 (GMT)
Cycles: optimize attributes device updates

When an `AttributeSet` is tagged as modified, which happens after the addition or
removal of an `Attribute` from the set, during the following GeometryManager device
update, we update and repack the kernel data for all attribute types. However, if we
only add or remove a `float` attribute, `float2` or `float3` attributes should not
be repacked for efficiency.

This patch adds some mechanisms to detect which attribute types are modified from
the AttributeSet.

Firstly, this adds an `AttrKernelDataType` to map the data type of the Attribute to
the one used in the kernel as there is no one to one match between the two since e.g.
`Transform` or `float4` data are stored as `float3s` in the kernel.

Then, this replaces the `AttributeSet.modified` boolean with a set of flags to detect
which types have been modified. There is no specific flag type (e.g.
`enum ModifiedType`), rather the flags used derive simply from the
`AttrKernelDataType` enumeration, to keep things synchronized.

The logic to remove an `Attribute` from the `AttributeSet` and tag the latter as modified
is centralized in a new `AttributeSet.remove` method taking an iterator as input.

Lastly, as some attributes like standard normals are not stored in the various
kernel attribute arrays (`DeviceScene::attribute_*`), the modified flags are only
set if the associated standard corresponds to an attribute which will be stored
in the kernel's attribute arrays. This makes it so adding or removing such attributes
does not trigger an unnecessary update of other type-related attributes.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11373

Commit Details:

Full Hash: 12a06292af8678c2371b36369a96c088f438c9dd
Parent Commit: 2a09634
Lines Changed: +138, -45

4 Modified Paths:

/intern/cycles/render/alembic.cpp (+1, -2) (Diff)
/intern/cycles/render/attribute.cpp (+50, -11) (Diff)
/intern/cycles/render/attribute.h (+32, -1) (Diff)
/intern/cycles/render/geometry.cpp (+55, -31) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021