From 3bc44233c08dfc4af0cff89a14681f86dfebf5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Sun, 2 May 2021 02:34:56 +0200 Subject: Cycles: use reference count to detect used shaders Shaders are only compiled if they are used by some other Node (Geometry, Light, etc.). This usage detection is done before updating the Scene, however it fails at detecting Shaders used by Procedurals not known to Cycles (e.g. ones defined by third party applications), as Procedurals are only updated after the shaders are compiled. To remedy this, we now use the Node reference counting mechanism to detect whether a Shader is used and therefore should be compiled. This removes `ShaderManager::update_shaders_used` as it is not needed anymore, however, since it would also update the Shader ids, this is now performed in `ShaderManager::device_update`, and a new virtual `device_update_specific` method was added to handle device updates for SVM and OSL. Reviewed By: brecht Differential Revision: https://developer.blender.org/D10965 --- intern/cycles/render/svm.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'intern/cycles/render/svm.h') diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h index a4ca68e1d8d..85b4b9c419f 100644 --- a/intern/cycles/render/svm.h +++ b/intern/cycles/render/svm.h @@ -46,7 +46,10 @@ class SVMShaderManager : public ShaderManager { void reset(Scene *scene); - void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress); + void device_update_specific(Device *device, + DeviceScene *dscene, + Scene *scene, + Progress &progress) override; void device_free(Device *device, DeviceScene *dscene, Scene *scene); protected: -- cgit v1.2.3