Skip to content

Commit

Permalink
merian-nodes: image write: provide input extent in format prop
Browse files Browse the repository at this point in the history
  • Loading branch information
LDAP committed Dec 17, 2024
1 parent 4bf3a0e commit a962bdb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions include/merian-nodes/nodes/image_write/image_write.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ImageWrite : public Node {
private:
template <typename T>
void get_format_args(const T& consumer,
const vk::Extent3D& input_extent,
const vk::Extent3D& output_extent,
const uint64_t run_iteration,
const std::chrono::nanoseconds& graph_time_since_record,
Expand All @@ -56,6 +57,8 @@ class ImageWrite : public Node {
consumer(fmt::arg("graph_time", to_seconds(graph_time)));
consumer(fmt::arg("graph_time_since_record", to_seconds(graph_time_since_record)));
consumer(fmt::arg("system_time_since_record", to_seconds(system_time_since_record)));
consumer(fmt::arg("input_width", input_extent.width));
consumer(fmt::arg("input_height", input_extent.height));
consumer(fmt::arg("output_width", output_extent.width));
consumer(fmt::arg("output_height", output_extent.height));
consumer(fmt::arg("random", rand()));
Expand Down
13 changes: 7 additions & 6 deletions src/merian-nodes/nodes/image_write/image_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ void ImageWrite::process(GraphRun& run,
const ImageHandle src = io[con_src];
vk::Extent3D scaled = max(multiply(src->get_extent(), scale), {1, 1, 1});
fmt::dynamic_format_arg_store<fmt::format_context> arg_store;
get_format_args([&](const auto& arg) { arg_store.push_back(arg); }, scaled, run.get_iteration(),
graph_time_since_record, graph_time, system_time_since_record);
get_format_args([&](const auto& arg) { arg_store.push_back(arg); }, src->get_extent(), scaled,
run.get_iteration(), graph_time_since_record, graph_time,
system_time_since_record);
std::filesystem::path path;
try {
if (filename_format.empty()) {
Expand Down Expand Up @@ -322,11 +323,11 @@ ImageWrite::NodeStatusFlags ImageWrite::properties([[maybe_unused]] Properties&
std::ignore = config.config_text("filename", filename_format, false,
"Provide a format string for the path.");
std::vector<std::string> variables;
get_format_args([&](const auto& arg) { variables.push_back(arg.name); }, {1920, 1080, 1}, 1,
1000ns, 1000ns, 1000ns);
get_format_args([&](const auto& arg) { variables.push_back(arg.name); }, {1920, 1080, 1},
{1920, 1080, 1}, 1, 1000ns, 1000ns, 1000ns);
fmt::dynamic_format_arg_store<fmt::format_context> arg_store;
get_format_args([&](const auto& arg) { arg_store.push_back(arg); }, {1920, 1080, 1}, 1, 1000ns,
1000ns, 1000ns);
get_format_args([&](const auto& arg) { arg_store.push_back(arg); }, {1920, 1080, 1},
{1920, 1080, 1}, 1, 1000ns, 1000ns, 1000ns);

std::filesystem::path abs_path;
try {
Expand Down

0 comments on commit a962bdb

Please sign in to comment.