diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-03-20 17:56:24 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-03-20 17:59:24 +0300 |
commit | 6777956005f59a1f52851a50d5498bb17c910c4e (patch) | |
tree | 4b2091c298808fd791b410a522bb2503f8c9b7dd | |
parent | db65a6e0fb1c1294ab4a6141293416c9d57fb108 (diff) |
Fix T68370, T74973: Cycles cryptomatte not working when other passes are enabled
Solution found by Blazej Floch.
-rw-r--r-- | intern/cycles/render/film.cpp | 7 | ||||
-rw-r--r-- | intern/cycles/util/util_algorithm.h | 1 |
2 files changed, 5 insertions, 3 deletions
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 |