Fix #34121: OSL + persistent images option was not freeing shader memory properly,
[blender.git] / intern / cycles / blender / blender_sync.cpp
index 7ad663b7e26d2881e23a6496dc7ed471cc2e9385..87c4efffe6c07027fe71f26f4824145264b0511f 100644 (file)
@@ -307,7 +307,10 @@ SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background)
        params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
        params.use_bvh_cache = (background)? RNA_boolean_get(&cscene, "use_cache"): false;
 
-       params.persistent_images = (background)? r.use_persistent_data(): false;
+       if(background && params.shadingsystem != SceneParams::OSL)
+               params.persistent_images = r.use_persistent_data();
+       else
+               params.persistent_images = false;
 
        return params;
 }