Nodes: skip processing some unlinked outputs in usage inferencing
This is a partial fix for #146949. It speeds up drawing by about 15% for me. Pull Request: https://projects.blender.org/blender/blender/pulls/147612
This commit is contained in:
@@ -543,25 +543,30 @@ class SocketUsageInferencerImpl {
|
||||
const ComputeContext *dependent_socket_context)
|
||||
{
|
||||
/* Check if any of the dependent outputs are used. */
|
||||
SocketInContext next_unknown_output;
|
||||
SocketInContext next_unknown_socket;
|
||||
bool any_output_used = false;
|
||||
for (const bNodeSocket *dependent_socket_ptr : dependent_outputs) {
|
||||
const SocketInContext dependent_socket{dependent_socket_context, dependent_socket_ptr};
|
||||
const std::optional<bool> is_used = all_socket_usages_.lookup_try(dependent_socket);
|
||||
if (!is_used.has_value() && !next_unknown_output) {
|
||||
next_unknown_output = dependent_socket;
|
||||
continue;
|
||||
if (!is_used.has_value()) {
|
||||
if (dependent_socket_ptr->is_output() && !dependent_socket_ptr->is_directly_linked()) {
|
||||
continue;
|
||||
}
|
||||
if (!next_unknown_socket) {
|
||||
next_unknown_socket = dependent_socket;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (is_used.value_or(false)) {
|
||||
any_output_used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (next_unknown_output) {
|
||||
if (next_unknown_socket) {
|
||||
/* Create a task that checks if the next dependent socket is used. Intentionally only create
|
||||
* a task for the very next one and not for all, because that could potentially trigger a lot
|
||||
* of unnecessary evaluations. */
|
||||
this->push_usage_task(next_unknown_output);
|
||||
this->push_usage_task(next_unknown_socket);
|
||||
return;
|
||||
}
|
||||
if (!any_output_used) {
|
||||
|
||||
Reference in New Issue
Block a user