Fix T68370, T74973: Cycles cryptomatte not working when other passes are enabled

Solution found by Blazej Floch.
This commit is contained in:
Brecht Van Lommel 2020-03-20 15:56:24 +01:00
parent db65a6e0fb
commit 6777956005
Notes: blender-bot 2023-02-14 07:25:46 +01:00
Referenced by issue #75200, GPU Crash out of Render.
Referenced by issue #74973, Linux: Cryptomattes empty/buggy based on enabled render passes
Referenced by issue #68370, Cryptomatte buffers broken with more than 16 enabled passes (Linux only?)
2 changed files with 5 additions and 3 deletions

View File

@ -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);

View File

@ -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