Respect --skip-validation in spirv-opt (#1887)

Previously a field in OptimizerOptions was set for --skip-validation,
but the OptimizerOptions was never used when calling optimizer.Run().
This commit is contained in:
Lei Zhang 2018-09-12 13:41:50 -04:00 committed by GitHub
parent 324be76b9c
commit 0f4c772ee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -591,12 +591,13 @@ OptStatus ParseFlags(int argc, const char** argv,
int main(int argc, const char** argv) {
const char* in_file = nullptr;
const char* out_file = nullptr;
bool skip_validator = false;
spv_target_env target_env = kDefaultEnvironment;
spvtools::ValidatorOptions validator_options;
spvtools::OptimizerOptions optimizer_options;
optimizer_options.set_validator_options(validator_options);
spvtools::Optimizer optimizer(target_env);
optimizer.SetMessageConsumer(spvtools::utils::CLIMessageConsumer);
@ -619,8 +620,8 @@ int main(int argc, const char** argv) {
// By using the same vector as input and output, we save time in the case
// that there was no change.
bool ok = optimizer.Run(binary.data(), binary.size(), &binary,
validator_options, skip_validator);
bool ok =
optimizer.Run(binary.data(), binary.size(), &binary, optimizer_options);
if (!WriteFile<uint32_t>(out_file, "wb", binary.data(), binary.size())) {
return 1;