Fix: Wrong reference count for shader operation

The reference count computation for shader operation outputs is wrong,
because it considers internal links as references to the result, which
is not the case.

This patch fixes that by only consider external links.
This commit is contained in:
Omar Emara
2023-06-22 13:57:31 +03:00
parent 2ff522c23f
commit d6cd3db13b

View File

@@ -85,7 +85,12 @@ void ShaderOperation::compute_results_reference_counts(const Schedule &schedule)
{
for (const auto item : output_sockets_to_output_identifiers_map_.items()) {
const int reference_count = number_of_inputs_linked_to_output_conditioned(
item.key, [&](DInputSocket input) { return schedule.contains(input.node()); });
item.key, [&](DInputSocket input) {
/* We only consider inputs that are not part of the shader operations, because inputs
* that are part of the shader operations are internal and do not deal with the result
* directly. */
return schedule.contains(input.node()) && !compile_unit_.contains(input.node());
});
get_result(item.value).set_initial_reference_count(reference_count);
}