SPIRVOptions.h 2.1 KB

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