SPIRVOptions.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //===------- SPIRVOptions.h -------------------------------------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file outlines the command-line options used by SPIR-V CodeGen.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_SPIRV_OPTIONS_H
  14. #define LLVM_SPIRV_OPTIONS_H
  15. #ifdef ENABLE_SPIRV_CODEGEN
  16. #include "llvm/ADT/ArrayRef.h"
  17. #include "llvm/ADT/StringRef.h"
  18. #include "llvm/Option/ArgList.h"
  19. namespace clang {
  20. namespace spirv {
  21. enum class SpirvLayoutRule {
  22. Void,
  23. GLSLStd140,
  24. GLSLStd430,
  25. RelaxedGLSLStd140, // std140 with relaxed vector layout
  26. RelaxedGLSLStd430, // std430 with relaxed vector layout
  27. FxcCTBuffer, // fxc.exe layout rule for cbuffer/tbuffer
  28. FxcSBuffer, // fxc.exe layout rule for structured buffers
  29. Scalar, // VK_EXT_scalar_block_layout
  30. Max, // This is an invalid layout rule
  31. };
  32. struct SpirvCodeGenOptions {
  33. /// Disable legalization and optimization and emit raw SPIR-V
  34. bool codeGenHighLevel;
  35. bool debugInfoFile;
  36. bool debugInfoLine;
  37. bool debugInfoSource;
  38. bool debugInfoTool;
  39. bool debugInfoRich;
  40. bool defaultRowMajor;
  41. bool disableValidation;
  42. bool enable16BitTypes;
  43. bool enableReflect;
  44. bool invertY; // Additive inverse
  45. bool invertW; // Multiplicative inverse
  46. bool noWarnEmulatedFeatures;
  47. bool noWarnIgnoredFeatures;
  48. bool useDxLayout;
  49. bool useGlLayout;
  50. bool useScalarLayout;
  51. bool flattenResourceArrays;
  52. bool autoShiftBindings;
  53. SpirvLayoutRule cBufferLayoutRule;
  54. SpirvLayoutRule sBufferLayoutRule;
  55. SpirvLayoutRule tBufferLayoutRule;
  56. SpirvLayoutRule ampPayloadLayoutRule;
  57. llvm::StringRef stageIoOrder;
  58. llvm::StringRef targetEnv;
  59. llvm::SmallVector<int32_t, 4> bShift;
  60. llvm::SmallVector<int32_t, 4> sShift;
  61. llvm::SmallVector<int32_t, 4> tShift;
  62. llvm::SmallVector<int32_t, 4> uShift;
  63. llvm::SmallVector<llvm::StringRef, 4> allowedExtensions;
  64. llvm::SmallVector<llvm::StringRef, 4> optConfig;
  65. std::vector<std::string> bindRegister;
  66. std::vector<std::string> bindGlobals;
  67. // String representation of all command line options.
  68. std::string clOptions;
  69. };
  70. } // namespace spirv
  71. } // namespace clang
  72. #endif // ENABLE_SPIRV_CODEGEN
  73. #endif // LLVM_SPIRV_OPTIONS_H