Steven Perron | 75c1bf2 | 2018-09-10 11:49:41 -0400 | [diff] [blame] | 1 | // Copyright (c) 2017 Google Inc. |
| 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 | #include <cassert> |
| 16 | #include <cstring> |
| 17 | |
| 18 | #include "source/spirv_optimizer_options.h" |
| 19 | |
James Jones | 398f37a | 2018-11-06 08:12:26 -0800 | [diff] [blame] | 20 | SPIRV_TOOLS_EXPORT spv_optimizer_options spvOptimizerOptionsCreate(void) { |
Steven Perron | 75c1bf2 | 2018-09-10 11:49:41 -0400 | [diff] [blame] | 21 | return new spv_optimizer_options_t(); |
| 22 | } |
| 23 | |
| 24 | SPIRV_TOOLS_EXPORT void spvOptimizerOptionsDestroy( |
| 25 | spv_optimizer_options options) { |
| 26 | delete options; |
| 27 | } |
| 28 | |
| 29 | SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetRunValidator( |
| 30 | spv_optimizer_options options, bool val) { |
| 31 | options->run_validator_ = val; |
| 32 | } |
| 33 | |
| 34 | SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetValidatorOptions( |
| 35 | spv_optimizer_options options, spv_validator_options val) { |
| 36 | options->val_options_ = *val; |
| 37 | } |
| 38 | SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetMaxIdBound( |
| 39 | spv_optimizer_options options, uint32_t val) { |
| 40 | options->max_id_bound_ = val; |
| 41 | } |
Thomas Roughton | cd153db | 2019-07-11 06:12:19 +1200 | [diff] [blame] | 42 | |
| 43 | SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetPreserveBindings( |
| 44 | spv_optimizer_options options, bool val) { |
| 45 | options->preserve_bindings_ = val; |
| 46 | } |
| 47 | |
| 48 | SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetPreserveSpecConstants( |
| 49 | spv_optimizer_options options, bool val) { |
| 50 | options->preserve_spec_constants_ = val; |
| 51 | } |