SPIRVOptions.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. };
  31. struct SpirvCodeGenOptions {
  32. /// Disable legalization and optimization and emit raw SPIR-V
  33. bool codeGenHighLevel;
  34. bool debugInfoFile;
  35. bool debugInfoLine;
  36. bool debugInfoSource;
  37. bool debugInfoTool;
  38. bool defaultRowMajor;
  39. bool disableValidation;
  40. bool enable16BitTypes;
  41. bool enableReflect;
  42. bool invertY; // Additive inverse
  43. bool invertW; // Multiplicative inverse
  44. bool noWarnEmulatedFeatures;
  45. bool noWarnIgnoredFeatures;
  46. bool useDxLayout;
  47. bool useGlLayout;
  48. bool useScalarLayout;
  49. SpirvLayoutRule cBufferLayoutRule;
  50. SpirvLayoutRule sBufferLayoutRule;
  51. SpirvLayoutRule tBufferLayoutRule;
  52. llvm::StringRef stageIoOrder;
  53. llvm::StringRef targetEnv;
  54. llvm::SmallVector<int32_t, 4> bShift;
  55. llvm::SmallVector<int32_t, 4> sShift;
  56. llvm::SmallVector<int32_t, 4> tShift;
  57. llvm::SmallVector<int32_t, 4> uShift;
  58. llvm::SmallVector<llvm::StringRef, 4> allowedExtensions;
  59. llvm::SmallVector<llvm::StringRef, 4> optConfig;
  60. std::vector<std::string> bindRegister;
  61. // String representation of all command line options.
  62. std::string clOptions;
  63. };
  64. } // namespace spirv
  65. } // namespace clang
  66. #endif // ENABLE_SPIRV_CODEGEN
  67. #endif // LLVM_SPIRV_OPTIONS_H