1 // Copyright (c) 2018 Google LLC
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
15 #ifndef SOURCE_SPIRV_OPTIMIZER_OPTIONS_H_
16 #define SOURCE_SPIRV_OPTIMIZER_OPTIONS_H_
18 #include "source/spirv_validator_options.h"
19 #include "spirv-tools/libspirv.h"
21 // Manages command line options passed to the SPIR-V Validator. New struct
22 // members may be added for any new option.
23 struct spv_optimizer_options_t
{
24 spv_optimizer_options_t()
25 : run_validator_(true),
27 max_id_bound_(kDefaultMaxIdBound
),
28 preserve_bindings_(false),
29 preserve_spec_constants_(false) {}
31 // When true the validator will be run before optimizations are run.
34 // Options to pass to the validator if it is run.
35 spv_validator_options_t val_options_
;
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
40 uint32_t max_id_bound_
;
42 // When true, all binding declarations within the module should be preserved.
43 bool preserve_bindings_
;
45 // When true, all specialization constants within the module should be
47 bool preserve_spec_constants_
;
49 #endif // SOURCE_SPIRV_OPTIMIZER_OPTIONS_H_