Merge per-shader SVM nodes in the main update thread to avoid locking and resizing overhead

In a test file containing 1300 copies of the same shader, this reduces shader update time from 3.1 sec to 0.05 sec.

Thanks to @swerner for noticing this issue.

Reviewers: brecht, sergey, swerner

Subscribers: swerner

Differential Revision: https://developer.blender.org/D5376
This commit is contained in:
2019-07-30 23:29:18 -07:00
parent c72f6b713f
commit feed46c4ae
2 changed files with 65 additions and 52 deletions

View File

@@ -50,13 +50,10 @@ class SVMShaderManager : public ShaderManager {
void device_free(Device *device, DeviceScene *dscene, Scene *scene);
protected:
/* Lock used to synchronize threaded nodes compilation. */
thread_spin_lock nodes_lock_;
void device_update_shader(Scene *scene,
Shader *shader,
Progress *progress,
array<int4> *global_svm_nodes);
array<int4> *svm_nodes);
};
/* Graph Compiler */