1// Copyright (c) 2018 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef SOURCE_SPIRV_OPTIMIZER_OPTIONS_H_
16#define SOURCE_SPIRV_OPTIMIZER_OPTIONS_H_
17
18#include "source/spirv_validator_options.h"
19#include "spirv-tools/libspirv.h"
20
21// Manages command line options passed to the SPIR-V Validator. New struct
22// members may be added for any new option.
23struct spv_optimizer_options_t {
24 spv_optimizer_options_t()
25 : run_validator_(true),
26 val_options_(),
27 max_id_bound_(kDefaultMaxIdBound),
28 preserve_bindings_(false),
29 preserve_spec_constants_(false) {}
30
31 // When true the validator will be run before optimizations are run.
32 bool run_validator_;
33
34 // Options to pass to the validator if it is run.
35 spv_validator_options_t val_options_;
36
37 // The maximum value the id bound for a module can have. The Spir-V spec says
38 // this value must be at least 0x3FFFFF, but implementations can allow for a
39 // higher value.
40 uint32_t max_id_bound_;
41
42 // When true, all binding declarations within the module should be preserved.
43 bool preserve_bindings_;
44
45 // When true, all specialization constants within the module should be
46 // preserved.
47 bool preserve_spec_constants_;
48};
49#endif // SOURCE_SPIRV_OPTIMIZER_OPTIONS_H_
50