[Bf-blender-cvs] [6777956005f] master: Fix T68370, T74973: Cycles cryptomatte not working when other passes are enabled
Brecht Van Lommel
noreply at git.blender.org
Fri Mar 20 16:16:08 CET 2020
Commit: 6777956005f59a1f52851a50d5498bb17c910c4e
Author: Brecht Van Lommel
Date: Fri Mar 20 15:56:24 2020 +0100
Branches: master
https://developer.blender.org/rB6777956005f59a1f52851a50d5498bb17c910c4e
Fix T68370, T74973: Cycles cryptomatte not working when other passes are enabled
Solution found by Blazej Floch.
===================================================================
M intern/cycles/render/film.cpp
M intern/cycles/util/util_algorithm.h
===================================================================
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp
index d1e2ef66c2c..baf02901123 100644
--- a/intern/cycles/render/film.cpp
+++ b/intern/cycles/render/film.cpp
@@ -203,9 +203,10 @@ void Pass::add(PassType type, vector<Pass> &passes, const char *name)
passes.push_back(pass);
- /* order from by components, to ensure alignment so passes with size 4
- * come first and then passes with size 1 */
- sort(&passes[0], &passes[0] + passes.size(), compare_pass_order);
+ /* Order from by components, to ensure alignment so passes with size 4
+ * come first and then passes with size 1. Note this must use stable sort
+ * so cryptomatte passes remain in the right order. */
+ stable_sort(&passes[0], &passes[0] + passes.size(), compare_pass_order);
if (pass.divide_type != PASS_NONE)
Pass::add(pass.divide_type, passes);
diff --git a/intern/cycles/util/util_algorithm.h b/intern/cycles/util/util_algorithm.h
index 62093039625..63abd4e92a3 100644
--- a/intern/cycles/util/util_algorithm.h
+++ b/intern/cycles/util/util_algorithm.h
@@ -25,6 +25,7 @@ using std::max;
using std::min;
using std::remove;
using std::sort;
+using std::stable_sort;
using std::swap;
CCL_NAMESPACE_END
More information about the Bf-blender-cvs
mailing list