Page MenuHome

Cycles: Avoid unnecessary data updates in viewport
ClosedPublic

Authored by Sergey Sharybin (sergey) on May 17 2021, 4:17 PM.

Details

Summary

The BlenderSync will do quite a bit of work on every sync_data() call
even if there is nothing changed in the scene. There will be early
outputs done deeper in the call graph, but this is not really enough to
ensure best performance during viewport navigation.

This change makes it so sync_data() is only used when dependency graph
has any update tags: if something changed in the scene the dependency
graph will know it. If nothing changed there will be no IDs tagged for an
update in the dependency graph.

There are two weak parts in the current change:

  • With the persistent data there is a special call to ignore the check of the dependency graph tags. This is more of a safety, because it is not immediately clear what the correct state of recalc flags is.
  • Deletion of objects is detected indirectly, via tags of scene and collections.

It might not be bad for the first version of the change.

The test file used:

Simply open the file, start viewport render, and navigate the viewport.
On my computer this avoids 0.2sec spend on data_sync() on every
up[date of viewport navigation.

We can do way more granular updates in the future: for example, avoid
heavy objects sync when it is only camera object which changed. This
will need an extended support from the dependency graph API. Doing
nothing if nothing is changed is something we would want to do anyway.

Diff Detail

Repository
rB Blender
Branch
cycles-x_updates (branched from master)
Build Status
Buildable 14603
Build 14603: arc lint + arc unit

Event Timeline

Sergey Sharybin (sergey) requested review of this revision.May 17 2021, 4:17 PM
Sergey Sharybin (sergey) created this revision.
Sergey Sharybin (sergey) updated this revision to Diff 37179.EditedMay 17 2021, 6:29 PM

Removed the force update call. Rely on tags of the dependency graph
for both viewport and final renders with the persistent data.

Edit: Forgot to mention that the patch is now against the master branch.

Sergey Sharybin (sergey) retitled this revision from Cycles X: Avoid unnecessary data updates in viewport to Cycles: Avoid unnecessary data updates in viewport.May 17 2021, 6:30 PM
This revision is now accepted and ready to land.May 17 2021, 6:36 PM