Refactor reducer options (#2709)

Avoids polluting the global namespace with a constant, and moves constructor to .cpp file as is done for spirv-reduce's options.
This commit is contained in:
Alastair Donaldson 2019-07-04 11:11:42 +01:00 committed by GitHub
parent a6bfc26e5f
commit 5a93e07392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -17,6 +17,14 @@
#include "source/spirv_reducer_options.h"
namespace {
// The default maximum number of steps the reducer will take before giving up.
const uint32_t kDefaultStepLimit = 250;
} // namespace
spv_reducer_options_t::spv_reducer_options_t()
: step_limit(kDefaultStepLimit), fail_on_validation_error(false) {}
SPIRV_TOOLS_EXPORT spv_reducer_options spvReducerOptionsCreate() {
return new spv_reducer_options_t();
}

View File

@ -20,14 +20,10 @@
#include <string>
#include <utility>
// The default maximum number of steps for the reducer to run before giving up.
const uint32_t kDefaultStepLimit = 250;
// Manages command line options passed to the SPIR-V Reducer. New struct
// members may be added for any new option.
struct spv_reducer_options_t {
spv_reducer_options_t()
: step_limit(kDefaultStepLimit), fail_on_validation_error(false) {}
spv_reducer_options_t();
// See spvReducerOptionsSetStepLimit.
uint32_t step_limit;