diff --git a/backends/vulkan/runtime/graph/ComputeGraph.cpp b/backends/vulkan/runtime/graph/ComputeGraph.cpp index e337f1b9791..74407cb00bc 100644 --- a/backends/vulkan/runtime/graph/ComputeGraph.cpp +++ b/backends/vulkan/runtime/graph/ComputeGraph.cpp @@ -242,26 +242,13 @@ utils::StorageType ComputeGraph::suggested_storage_type() { return utils::kTexture3D; } -bool ComputeGraph::was_value_updated(const ValueRef idx) const noexcept { - if (!is_valid_value_idx(idx)) { - return false; - } - - const size_t value_idx = static_cast(idx); - if (value_idx < value_update_generations_.size() && - value_update_generations_[value_idx] == current_update_generation_) { - return true; - } - - if (val_is_value_list(idx)) { - const auto& value_list = values_.at(idx).toConstValueList(); - for (const auto& nested_idx : value_list) { - if (was_value_updated(nested_idx)) { - return true; - } +bool ComputeGraph::was_value_list_updated(const ValueRef idx) const noexcept { + const auto& value_list = values_[static_cast(idx)].toConstValueList(); + for (const auto nested_idx : value_list) { + if (was_value_updated(nested_idx)) { + return true; } } - return false; } diff --git a/backends/vulkan/runtime/graph/ComputeGraph.h b/backends/vulkan/runtime/graph/ComputeGraph.h index 22cd3d9e692..eb01e3abf5e 100644 --- a/backends/vulkan/runtime/graph/ComputeGraph.h +++ b/backends/vulkan/runtime/graph/ComputeGraph.h @@ -712,6 +712,7 @@ class ComputeGraph final { private: void check_no_active_value_ptrs(); + bool was_value_list_updated(const ValueRef idx) const noexcept; public: /* @@ -1174,7 +1175,22 @@ class ComputeGraph final { // Check if a specific ValueRef (or ValueList) was updated, with recursive // handling - bool was_value_updated(const ValueRef idx) const noexcept; + inline bool was_value_updated(const ValueRef idx) const noexcept { + if (idx < 0) { + return false; + } + + const size_t value_idx = static_cast(idx); + if (value_idx >= values_.size()) { + return false; + } + if (value_idx < value_update_generations_.size() && + value_update_generations_[value_idx] == current_update_generation_) { + return true; + } + + return values_[value_idx].isValueList() && was_value_list_updated(idx); + } // Set the flag to indicate that re-encoding is required inline void set_requires_reencode() noexcept {