2
0

SPIRVOptions.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. bool supportNonzeroBaseInstance;
  54. SpirvLayoutRule cBufferLayoutRule;
  55. SpirvLayoutRule sBufferLayoutRule;
  56. SpirvLayoutRule tBufferLayoutRule;
  57. SpirvLayoutRule ampPayloadLayoutRule;
  58. llvm::StringRef stageIoOrder;
  59. llvm::StringRef targetEnv;
  60. llvm::SmallVector<int32_t, 4> bShift;
  61. llvm::SmallVector<int32_t, 4> sShift;
  62. llvm::SmallVector<int32_t, 4> tShift;
  63. llvm::SmallVector<int32_t, 4> uShift;
  64. llvm::SmallVector<llvm::StringRef, 4> allowedExtensions;
  65. llvm::SmallVector<llvm::StringRef, 4> optConfig;
  66. std::vector<std::string> bindRegister;
  67. std::vector<std::string> bindGlobals;
  68. // String representation of all command line options.
  69. std::string clOptions;
  70. };
  71. } // namespace spirv
  72. } // namespace clang
  73. #endif // ENABLE_SPIRV_CODEGEN
  74. #endif // LLVM_SPIRV_OPTIONS_H