diff options
author | David Neto <dneto@google.com> | 2018-11-19 09:27:24 -0500 |
---|---|---|
committer | dan sinclair <dj2@everburning.com> | 2018-11-19 09:27:24 -0500 |
commit | c20ab2e6d0df49dc53433d62c5932ab08976f0e6 (patch) | |
tree | e921c973600e043588b68618cc6be1ef66bca30a /samples | |
parent | 01c586239b4d1c7d3a19d23b2f022cd6ddddb846 (diff) | |
download | amber-c20ab2e6d0df49dc53433d62c5932ab08976f0e6.tar.gz |
amber tool: Add -e option to set graphics API engine (#65)
Diffstat (limited to 'samples')
-rw-r--r-- | samples/amber.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/samples/amber.cc b/samples/amber.cc index 9d76f5f..d5a5d94 100644 --- a/samples/amber.cc +++ b/samples/amber.cc @@ -32,6 +32,7 @@ struct Options { bool parse_only = false; bool show_help = false; bool show_version_info = false; + amber::EngineType engine = amber::EngineType::kVulkan; }; const char kUsage[] = R"(Usage: amber [options] SCRIPT @@ -41,6 +42,7 @@ const char kUsage[] = R"(Usage: amber [options] SCRIPT -i <filename> -- Write rendering to <filename> as a PPM image. -b <filename> -- Write contents of a UBO or SSBO to <filename>. -B <buffer> -- Index of buffer to write. Defaults buffer 0. + -e <engine> -- Specify graphics engine: vulkan, dawn. Default is vulkan. -V, --version -- Output version information for Amber and libraries. -h -- This help text. )"; @@ -77,6 +79,24 @@ bool ParseArgs(const std::vector<std::string>& args, Options* opts) { return false; } + } else if (arg == "-e") { + ++i; + if (i >= args.size()) { + std::cerr << "Missing value for -e argument." << std::endl; + return false; + } + const std::string& engine = args[i]; + if (engine == "vulkan") { + opts->engine = amber::EngineType::kVulkan; + } else if (engine == "dawn") { + opts->engine = amber::EngineType::kDawn; + } else { + std::cerr + << "Invalid value for -e argument. Must be one of: vulkan dawn" + << std::endl; + return false; + } + } else if (arg == "-h" || arg == "--help") { opts->show_help = true; } else if (arg == "-V" || arg == "--version") { @@ -156,6 +176,7 @@ int main(int argc, const char** argv) { amber::Amber vk; amber::Options amber_options; + amber_options.engine = options.engine; amber_options.parse_only = options.parse_only; amber::Result result = vk.Execute(data, amber_options); if (!result.IsSuccess()) { @@ -164,7 +185,7 @@ int main(int argc, const char** argv) { } if (!options.buffer_filename.empty()) { - // TOOD(dsinclair): Write buffer file + // TODO(dsinclair): Write buffer file assert(false); } |