diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2019-12-20 21:49:11 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2019-12-20 21:53:13 +0300 |
commit | 9a8f840c3174fa54cadfa1b475269149a3de2492 (patch) | |
tree | e14c823e28f23207d31e8c4d2cf8b7b819b7d7fd /intern | |
parent | a2d6dfc026e58446776b8e5fb37b54254e8c76a7 (diff) |
Fix T72471: Cycles AOV support breaks passes with divide_type
The problem is described in a comment in the change.
Short version: If a pass was used as a divide_type but also requested
explicitly (e.g. diffuse color), it was added to the passes list
twice because the names of the two requests didn't match.
Then, when searching for the pass to divide by, the wrong one (not
the one that the kernel was writing to) was picked.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/render/film.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp index 3cd7936ae45..bd274844b52 100644 --- a/intern/cycles/render/film.cpp +++ b/intern/cycles/render/film.cpp @@ -41,7 +41,34 @@ static bool compare_pass_order(const Pass &a, const Pass &b) void Pass::add(PassType type, vector<Pass> &passes, const char *name) { for (size_t i = 0; i < passes.size(); i++) { - if (passes[i].type == type && (name ? (passes[i].name == name) : passes[i].name.empty())) { + if (passes[i].type != type) { + continue; + } + + /* An empty name is used as a placeholder to signal that any pass of + * that type is fine (because the content always is the same). + * This is important to support divide_type: If the pass that has a + * divide_type is added first, a pass for divide_type with an empty + * name will be added. Then, if a matching pass with a name is later + * requested, the existing placeholder will be renamed to that. + * If the divide_type is explicitly allocated with a name first and + * then again as part of another pass, the second one will just be + * skipped because that type already exists. */ + + /* If no name is specified, any pass of the correct type will match. */ + if (name == NULL) { + return; + } + + /* If we already have a placeholder pass, rename that one. */ + if (passes[i].name.empty()) { + passes[i].name = name; + return; + } + + /* If neither existing nor requested pass have placeholder name, they + * must match. */ + if (name == passes[i].name) { return; } } |