Skip to content

Commit

Permalink
merian-nodes: Graph: catch compilation failed in describe_*
Browse files Browse the repository at this point in the history
  • Loading branch information
LDAP committed Nov 20, 2024
1 parent 080077f commit 4a2d92a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 6 additions & 2 deletions include/merian-nodes/graph/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,9 @@ class Graph : public std::enable_shared_from_this<Graph<ITERATIONS_IN_FLIGHT>> {
try {
data.input_connectors = node->describe_inputs();
} catch (const graph_errors::node_error& e) {
data.errors.push_back(e.what());
data.errors.emplace_back(fmt::format("node error: ", e.what()));
} catch (const ShaderCompiler::compilation_failed& e) {
data.errors.emplace_back(fmt::format("compilation failed: ", e.what()));
}
for (const InputConnectorHandle& input : data.input_connectors) {
if (data.input_connector_for_name.contains(input->name)) {
Expand Down Expand Up @@ -1470,7 +1472,9 @@ class Graph : public std::enable_shared_from_this<Graph<ITERATIONS_IN_FLIGHT>> {
register_event_listener_for_connect(event_pattern, listener);
}));
} catch (const graph_errors::node_error& e) {
data.errors.emplace_back(e.what());
data.errors.emplace_back(fmt::format("node error: ", e.what()));
} catch (const ShaderCompiler::compilation_failed& e) {
data.errors.emplace_back(fmt::format("compilation failed: ", e.what()));
}

for (const auto& output : data.output_connectors) {
Expand Down
8 changes: 4 additions & 4 deletions include/merian-nodes/graph/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Node : public std::enable_shared_from_this<Node> {
//
// Note that input and output names must be unique.
//
// If you throw a node_error here the graph will disable the node for this connect attempt and
// If you throw node_error or compilation_failed the graph will disable the node for this connect attempt and
// set the error state for this node. Your inputs will then be invisible.
[[nodiscard]]
virtual std::vector<InputConnectorHandle> describe_inputs() {
Expand All @@ -50,8 +50,8 @@ class Node : public std::enable_shared_from_this<Node> {
//
// Note that input and output names must be unique.
//
// If you throw a node_error here the graph will disable the node for this connect attempt and
// set the error state for this node.
// If you throw node_error or compilation_failed the graph will disable the node for this
// connect attempt and set the error state for this node.
[[nodiscard]]
virtual std::vector<OutputConnectorHandle>
describe_outputs([[maybe_unused]] const NodeIOLayout& io_layout) {
Expand All @@ -68,7 +68,7 @@ class Node : public std::enable_shared_from_this<Node> {
// It contains all input and output connectors for which get_descriptor_info() method does not
// return std::nullopt. The order is guaranteed to be all inputs in the order of
// describe_inputs() then outputs in the order of describe_outputs().
//
//
// Here also delayed inputs can be accessed from io_layout.
[[nodiscard]]
virtual NodeStatusFlags
Expand Down
2 changes: 1 addition & 1 deletion src/merian-nodes/graph/node_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#include "merian-nodes/nodes/image_write/image_write.hpp"
#include "merian-nodes/nodes/mean/mean.hpp"
#include "merian-nodes/nodes/median_approx/median.hpp"
#include "merian-nodes/nodes/shadertoy/shadertoy.hpp"
#include "merian-nodes/nodes/svgf/svgf.hpp"
#include "merian-nodes/nodes/taa/taa.hpp"
#include "merian-nodes/nodes/tonemap/tonemap.hpp"
#include "merian-nodes/nodes/vkdt_filmcurv/vkdt_filmcurv.hpp"
#include "merian-nodes/nodes/shadertoy/shadertoy.hpp"

namespace merian_nodes {

Expand Down

0 comments on commit 4a2d92a

Please sign in to comment.