OpenMfx icon indicating copy to clipboard operation
OpenMfx copied to clipboard

Attribute forwarding and memory safety

Open tkarabela opened this issue 3 years ago • 0 comments

Follow-up on question from #6 on how to safely do attribute forwarding.

@eliemichel It is possible already to point the output at the same buffer as the input, for unchanged attributes, and in particular for connectivity information when the effect only is a modifier.

@tkarabela In terms of API, it might be a minor issue that by the time the output mesh is inputReleaseMesh()-ed, the mesh with the forwarded attribute may have already been inputReleaseMesh()-ed before, as order of releasing is undefined.

Presently, mesh releasing is done by the effect at end of cooking, one mesh at a time. We could simply say in the spec that if you are using attribute forwarding, you must not release the mesh you're forwarding from before releasing the mesh you're forwarding to.

In practice, a general rule of thumb "first release outputs, then inputs" should work fine, as long as you don't have multiple outputs forwarding between one another.

tkarabela avatar Oct 24 '20 16:10 tkarabela