Commit: 68c65618d0b5218f2769e182c363d8d0959a0c15 Author: Sergey Sharybin Date: Thu Jun 10 19:49:34 2021 +0200 Branches: cycles-x https://developer.blender.org/rB68c65618d0b5218f2769e182c363d8d0959a0c15
Cleanup: Remove unused pass functions in Cycles X Additionally, the comparison function was wrong: was using same vector of passes to get the next indices. =================================================================== M intern/cycles/render/pass.cpp M intern/cycles/render/pass.h =================================================================== diff --git a/intern/cycles/render/pass.cpp b/intern/cycles/render/pass.cpp index c542ea7abae..1a0416479db 100644 --- a/intern/cycles/render/pass.cpp +++ b/intern/cycles/render/pass.cpp @@ -452,48 +452,6 @@ bool Pass::equals_exact(const vector<Pass> &A, const vector<Pass> &B) return true; } -/* Get first index which is greater than the given one which correspongs to a non-auto pass. - * If there are only runtime passes after the given index, -1 is returned. */ -static const int get_next_no_auto_pass_index(const vector<Pass> &passes, int index) -{ - ++index; - - while (index < passes.size()) { - if ((passes[index].flags & PASS_FLAG_AUTO) == 0) { - return index; - } - } - - return -1; -} - -bool Pass::equals_no_auto(const vector<Pass> &A, const vector<Pass> &B) -{ - int index_a = -1, index_b = -1; - - while (true) { - index_a = get_next_no_auto_pass_index(A, index_a); - index_b = get_next_no_auto_pass_index(A, index_b); - - if (index_a == -1 && index_b == -1) { - break; - } - - if (index_a == -1 || index_b == -1) { - return false; - } - - const Pass &pass_a = A[index_a]; - const Pass &pass_b = B[index_b]; - - if (pass_a.type != pass_b.type || pass_a.name != pass_b.name) { - return false; - } - } - - return true; -} - bool Pass::contains(const vector<Pass> &passes, PassType type) { for (size_t i = 0; i < passes.size(); i++) @@ -503,31 +461,6 @@ bool Pass::contains(const vector<Pass> &passes, PassType type) return false; } -void Pass::remove_auto(vector<Pass> &passes, PassType type) -{ - const size_t num_passes = passes.size(); - - size_t i = 0; - while (i < num_passes) { - if (passes[i].type == type) { - break; - } - ++i; - } - - if (i >= num_passes) { - /* Pass does not exist. */ - return; - } - - if ((passes[i].flags & PASS_FLAG_AUTO) == 0) { - /* Pass is not automatically created, can not remove. */ - return; - } - - passes.erase(passes.begin() + i); -} - void Pass::remove_all_auto(vector<Pass> &passes) { vector<Pass> new_passes; @@ -563,20 +496,6 @@ const Pass *Pass::find(const vector<Pass> &passes, PassType type) return nullptr; } -int Pass::get_offset(const vector<Pass> &passes, PassType type) -{ - int pass_offset = 0; - - for (const Pass &pass : passes) { - if (pass.type == type) { - return pass_offset; - } - pass_offset += pass.components; - } - - return PASS_UNUSED; -} - int Pass::get_offset(const vector<Pass> &passes, const Pass &pass) { int pass_offset = 0; diff --git a/intern/cycles/render/pass.h b/intern/cycles/render/pass.h index 4c784ee4d0c..be0f53ac14a 100644 --- a/intern/cycles/render/pass.h +++ b/intern/cycles/render/pass.h @@ -76,14 +76,8 @@ class Pass : public Node { /* Check whether two sets of passes are matching exactly. */ static bool equals_exact(const vector<Pass> &A, const vector<Pass> &B); - /* Check whether two sets of passes define same set of non-auto passes. */ - static bool equals_no_auto(const vector<Pass> &A, const vector<Pass> &B); - static bool contains(const vector<Pass> &passes, PassType type); - /* Remove given pass type if it was automatically created. */ - static void remove_auto(vector<Pass> &passes, PassType type); - /* Remove all passes which were automatically created. */ static void remove_all_auto(vector<Pass> &passes); @@ -92,7 +86,6 @@ class Pass : public Node { static const Pass *find(const vector<Pass> &passes, PassType type); /* Returns PASS_UNUSED if there is no corresponding pass. */ - static int get_offset(const vector<Pass> &passes, PassType type); static int get_offset(const vector<Pass> &passes, const Pass &pass); }; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs