diff options
author | dan sinclair <dj2@everburning.com> | 2019-02-07 15:26:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-07 15:26:45 -0500 |
commit | de7c1aa073f241093e730f6f44e034a73cb58d02 (patch) | |
tree | 3aecd33992cbd793dff8664bc3b783ff4c89e49a /samples | |
parent | 43c8b2d2e187c7c81ac47d63314ee019191c5cd6 (diff) | |
download | amber-de7c1aa073f241093e730f6f44e034a73cb58d02.tar.gz |
Allow setting SPIR-V target environment. (#273)
This CL adds an option to the amber sample application to set the SPIR-V
target environment. The environment name matches the names accepted by
the other spirv-tools applications.
The environment is set into the script and used by the shader compiler.
Diffstat (limited to 'samples')
-rw-r--r-- | samples/amber.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/samples/amber.cc b/samples/amber.cc index 4de61f0..b0deacc 100644 --- a/samples/amber.cc +++ b/samples/amber.cc @@ -41,6 +41,7 @@ struct Options { bool show_help = false; bool show_version_info = false; amber::EngineType engine = amber::kEngineTypeVulkan; + std::string spv_env; }; const char kUsage[] = R"(Usage: amber [options] SCRIPT [SCRIPTS...] @@ -49,6 +50,7 @@ const char kUsage[] = R"(Usage: amber [options] SCRIPT [SCRIPTS...] -p -- Parse input files only; Don't execute. -s -- Print summary of pass/failure. -d -- Disable Vulkan/Dawn validation layer. + -t <spirv_env> -- The target SPIR-V environment. Defaults to SPV_ENV_UNIVERSAL_1_0. -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. @@ -107,6 +109,13 @@ bool ParseArgs(const std::vector<std::string>& args, Options* opts) { << std::endl; return false; } + } else if (arg == "-t") { + ++i; + if (i >= args.size()) { + std::cerr << "Missing value for -t argument." << std::endl; + return false; + } + opts->spv_env = args[i]; } else if (arg == "-h" || arg == "--help") { opts->show_help = true; @@ -232,6 +241,7 @@ int main(int argc, const char** argv) { amber::Options amber_options; amber_options.engine = options.engine; + amber_options.spv_env = options.spv_env; std::set<std::string> required_features; std::set<std::string> required_extensions; |