spirv_optimizer_options.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #include <cassert>
  15. #include <cstring>
  16. #include "source/spirv_optimizer_options.h"
  17. SPIRV_TOOLS_EXPORT spv_optimizer_options spvOptimizerOptionsCreate(void) {
  18. return new spv_optimizer_options_t();
  19. }
  20. SPIRV_TOOLS_EXPORT void spvOptimizerOptionsDestroy(
  21. spv_optimizer_options options) {
  22. delete options;
  23. }
  24. SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetRunValidator(
  25. spv_optimizer_options options, bool val) {
  26. options->run_validator_ = val;
  27. }
  28. SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetValidatorOptions(
  29. spv_optimizer_options options, spv_validator_options val) {
  30. options->val_options_ = *val;
  31. }
  32. SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetMaxIdBound(
  33. spv_optimizer_options options, uint32_t val) {
  34. options->max_id_bound_ = val;
  35. }
  36. SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetPreserveBindings(
  37. spv_optimizer_options options, bool val) {
  38. options->preserve_bindings_ = val;
  39. }
  40. SPIRV_TOOLS_EXPORT void spvOptimizerOptionsSetPreserveSpecConstants(
  41. spv_optimizer_options options, bool val) {
  42. options->preserve_spec_constants_ = val;
  43. }