aboutsummaryrefslogtreecommitdiff
path: root/samples/amber.cc
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2019-09-04 09:53:32 -0400
committerGitHub <noreply@github.com>2019-09-04 09:53:32 -0400
commit6e16cab40484dd0cf488ae63fc41f882068712e9 (patch)
tree9dc17ca482a3ceae2a03d666f4cb944847c0efe1 /samples/amber.cc
parent64b636272a989e48b691e1d66dc52286922272de (diff)
downloadamber-6e16cab40484dd0cf488ae63fc41f882068712e9.tar.gz
Allow recipe to change fence timeout. (#624)
This CL adds an API to the recipe class to set the fence timeout for a given script. The default fence timeout is also bumped from 100ms to 1000ms.
Diffstat (limited to 'samples/amber.cc')
-rw-r--r--samples/amber.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/samples/amber.cc b/samples/amber.cc
index b327bab..cefc58f 100644
--- a/samples/amber.cc
+++ b/samples/amber.cc
@@ -47,6 +47,7 @@ struct Options {
std::vector<amber::BufferInfo> buffer_to_dump;
uint32_t engine_major = 1;
uint32_t engine_minor = 0;
+ int32_t fence_timeout = -1;
bool parse_only = false;
bool pipeline_create_only = false;
bool disable_validation_layer = false;
@@ -68,6 +69,7 @@ const char kUsage[] = R"(Usage: amber [options] SCRIPT [SCRIPTS...]
-ps -- Parse input files, create pipelines; Don't execute.
-q -- Disable summary output.
-d -- Disable validation layers.
+ -f <value> -- Sets the fence timeout value to |value|
-t <spirv_env> -- The target SPIR-V environment e.g., spv1.3, vulkan1.1.
If a SPIR-V environment, assume the lowest version of Vulkan that
requires support of that version of SPIR-V.
@@ -143,6 +145,20 @@ bool ParseArgs(const std::vector<std::string>& args, Options* opts) {
<< std::endl;
return false;
}
+ } else if (arg == "-f") {
+ ++i;
+ if (i >= args.size()) {
+ std::cerr << "Missing value for -f argument." << std::endl;
+ return false;
+ }
+
+ int32_t val = std::stoi(std::string(args[i]));
+ if (val < 0) {
+ std::cerr << "Fence timeout must be non-negative" << std::endl;
+ return false;
+ }
+ opts->fence_timeout = val;
+
} else if (arg == "-t") {
++i;
if (i >= args.size()) {
@@ -337,6 +353,9 @@ int main(int argc, const char** argv) {
continue;
}
+ if (options.fence_timeout > -1)
+ recipe->SetFenceTimeout(static_cast<uint32_t>(options.fence_timeout));
+
recipe_data.emplace_back();
recipe_data.back().file = file;
recipe_data.back().recipe = std::move(recipe);