From b9bb69a1147e76460ab92b7bb97f493e2a26d9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 3 Mar 2021 15:20:35 +0100 Subject: EEVEE: Avoid old files with too many volume shadow sample being too slow This clamp the volumetric shadow samples to the actual old max to avoid problematic slowdown after the bugfix rB3a29c19b2bff. --- source/blender/blenloader/intern/versioning_290.c | 25 ++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index fa9f00d67ec..5c8e9da41c4 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -1789,6 +1789,24 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) FOREACH_NODETREE_END; } + if (!MAIN_VERSION_ATLEAST(bmain, 293, 10)) { + FOREACH_NODETREE_BEGIN (bmain, ntree, id) { + if (ntree->type == NTREE_GEOMETRY) { + version_node_socket_name(ntree, GEO_NODE_ATTRIBUTE_PROXIMITY, "Location", "Position"); + } + } + FOREACH_NODETREE_END; + + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + /* Fix old scene with too many samples that were not being used. + * Now they are properly used and might produce a huge slowdown. + * So we clamp to what the old max actual was. */ + if (scene->eevee.volumetric_shadow_samples > 32) { + scene->eevee.volumetric_shadow_samples = 32; + } + } + } + /** * Versioning code until next subversion bump goes here. * @@ -1800,12 +1818,5 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) */ { /* Keep this block, even when empty. */ - - FOREACH_NODETREE_BEGIN (bmain, ntree, id) { - if (ntree->type == NTREE_GEOMETRY) { - version_node_socket_name(ntree, GEO_NODE_ATTRIBUTE_PROXIMITY, "Location", "Position"); - } - } - FOREACH_NODETREE_END; } } -- cgit v1.2.3