SPIRVOptions.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. /// Use NonSemantic.Vulkan.DebugInfo.100 debug info instead of
  41. /// OpenCL.DebugInfo.100
  42. bool debugInfoVulkan;
  43. bool defaultRowMajor;
  44. bool disableValidation;
  45. bool enable16BitTypes;
  46. bool finiteMathOnly;
  47. bool enableReflect;
  48. bool invertY; // Additive inverse
  49. bool invertW; // Multiplicative inverse
  50. bool noWarnEmulatedFeatures;
  51. bool noWarnIgnoredFeatures;
  52. bool preserveBindings;
  53. bool preserveInterface;
  54. bool useDxLayout;
  55. bool useGlLayout;
  56. bool useLegacyBufferMatrixOrder;
  57. bool useScalarLayout;
  58. bool flattenResourceArrays;
  59. bool reduceLoadSize;
  60. bool autoShiftBindings;
  61. bool supportNonzeroBaseInstance;
  62. bool fixFuncCallArguments;
  63. /// Maximum length in words for the OpString literal containing the shader
  64. /// source for DebugSource and DebugSourceContinued. If the source code length
  65. /// is larger than this number, we will use DebugSourceContinued instructions
  66. /// for follow-up source code after the first DebugSource instruction. Note
  67. /// that this number must be less than or equal to 0xFFFDu because of the
  68. /// limitation of a single SPIR-V instruction size (0xFFFF) - 2 operand words
  69. /// for OpString. Currently a smaller value is only used to test
  70. /// DebugSourceContinued generation.
  71. uint32_t debugSourceLen;
  72. SpirvLayoutRule cBufferLayoutRule;
  73. SpirvLayoutRule sBufferLayoutRule;
  74. SpirvLayoutRule tBufferLayoutRule;
  75. SpirvLayoutRule ampPayloadLayoutRule;
  76. llvm::StringRef stageIoOrder;
  77. llvm::StringRef targetEnv;
  78. llvm::SmallVector<int32_t, 4> bShift;
  79. llvm::SmallVector<int32_t, 4> sShift;
  80. llvm::SmallVector<int32_t, 4> tShift;
  81. llvm::SmallVector<int32_t, 4> uShift;
  82. llvm::SmallVector<llvm::StringRef, 4> allowedExtensions;
  83. llvm::SmallVector<llvm::StringRef, 4> optConfig;
  84. std::vector<std::string> bindRegister;
  85. std::vector<std::string> bindGlobals;
  86. std::string entrypointName;
  87. bool signaturePacking; ///< Whether signature packing is enabled or not
  88. bool printAll; // Dump SPIR-V module before each pass and after the last one.
  89. // String representation of all command line options and input file.
  90. std::string clOptions;
  91. std::string inputFile;
  92. };
  93. } // namespace spirv
  94. } // namespace clang
  95. #endif // ENABLE_SPIRV_CODEGEN
  96. #endif // LLVM_SPIRV_OPTIONS_H