spirv_optimizer_options.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #ifndef SOURCE_SPIRV_OPTIMIZER_OPTIONS_H_
  15. #define SOURCE_SPIRV_OPTIMIZER_OPTIONS_H_
  16. #include "source/spirv_validator_options.h"
  17. #include "spirv-tools/libspirv.h"
  18. // Manages command line options passed to the SPIR-V Validator. New struct
  19. // members may be added for any new option.
  20. struct spv_optimizer_options_t {
  21. spv_optimizer_options_t()
  22. : run_validator_(true),
  23. val_options_(),
  24. max_id_bound_(kDefaultMaxIdBound),
  25. preserve_bindings_(false),
  26. preserve_spec_constants_(false) {}
  27. // When true the validator will be run before optimizations are run.
  28. bool run_validator_;
  29. // Options to pass to the validator if it is run.
  30. spv_validator_options_t val_options_;
  31. // The maximum value the id bound for a module can have. The Spir-V spec says
  32. // this value must be at least 0x3FFFFF, but implementations can allow for a
  33. // higher value.
  34. uint32_t max_id_bound_;
  35. // When true, all binding declarations within the module should be preserved.
  36. bool preserve_bindings_;
  37. // When true, all specialization constants within the module should be
  38. // preserved.
  39. bool preserve_spec_constants_;
  40. };
  41. #endif // SOURCE_SPIRV_OPTIMIZER_OPTIONS_H_