spirv_validator_options.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #ifndef SOURCE_SPIRV_VALIDATOR_OPTIONS_H_
  15. #define SOURCE_SPIRV_VALIDATOR_OPTIONS_H_
  16. #include "spirv-tools/libspirv.h"
  17. // Return true if the command line option for the validator limit is valid (Also
  18. // returns the Enum for option in this case). Returns false otherwise.
  19. bool spvParseUniversalLimitsOptions(const char* s, spv_validator_limit* limit);
  20. // Default initialization of this structure is to the default Universal Limits
  21. // described in the SPIR-V Spec.
  22. struct validator_universal_limits_t {
  23. uint32_t max_struct_members{16383};
  24. uint32_t max_struct_depth{255};
  25. uint32_t max_local_variables{524287};
  26. uint32_t max_global_variables{65535};
  27. uint32_t max_switch_branches{16383};
  28. uint32_t max_function_args{255};
  29. uint32_t max_control_flow_nesting_depth{1023};
  30. uint32_t max_access_chain_indexes{255};
  31. uint32_t max_id_bound{0x3FFFFF};
  32. };
  33. // Manages command line options passed to the SPIR-V Validator. New struct
  34. // members may be added for any new option.
  35. struct spv_validator_options_t {
  36. spv_validator_options_t()
  37. : universal_limits_(),
  38. relax_struct_store(false),
  39. relax_logical_pointer(false),
  40. relax_block_layout(false),
  41. uniform_buffer_standard_layout(false),
  42. scalar_block_layout(false),
  43. skip_block_layout(false),
  44. before_hlsl_legalization(false) {}
  45. validator_universal_limits_t universal_limits_;
  46. bool relax_struct_store;
  47. bool relax_logical_pointer;
  48. bool relax_block_layout;
  49. bool uniform_buffer_standard_layout;
  50. bool scalar_block_layout;
  51. bool skip_block_layout;
  52. bool before_hlsl_legalization;
  53. };
  54. #endif // SOURCE_SPIRV_VALIDATOR_OPTIONS_H_