-
Notifications
You must be signed in to change notification settings - Fork 852
Expand file tree
/
Copy pathSPIRVOptions.h
More file actions
131 lines (117 loc) · 4.54 KB
/
SPIRVOptions.h
File metadata and controls
131 lines (117 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//===------- SPIRVOptions.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file outlines the command-line options used by SPIR-V CodeGen.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SPIRV_OPTIONS_H
#define LLVM_SPIRV_OPTIONS_H
#ifdef ENABLE_SPIRV_CODEGEN
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Option/ArgList.h"
#include <optional>
namespace clang {
namespace spirv {
enum class SpirvLayoutRule {
Void,
GLSLStd140,
GLSLStd430,
RelaxedGLSLStd140, // std140 with relaxed vector layout
RelaxedGLSLStd430, // std430 with relaxed vector layout
FxcCTBuffer, // fxc.exe layout rule for cbuffer/tbuffer
FxcSBuffer, // fxc.exe layout rule for structured buffers
Scalar, // VK_EXT_scalar_block_layout
Max, // This is an invalid layout rule
};
struct SpirvCodeGenOptions {
/// Disable legalization and optimization and emit raw SPIR-V
bool codeGenHighLevel = false;
bool debugInfoFile = false;
bool debugInfoLine = false;
bool debugInfoSource = false;
bool debugInfoTool = false;
bool debugInfoRich = false;
/// Use NonSemantic.Vulkan.DebugInfo.100 debug info instead of
/// OpenCL.DebugInfo.100
bool debugInfoVulkan = false;
bool defaultRowMajor = false;
bool disableValidation = false;
bool enable16BitTypes = false;
bool finiteMathOnly = false;
bool enableReflect = false;
bool invertY = false; // Additive inverse
bool invertW = false; // Multiplicative inverse
bool noWarnEmulatedFeatures = false;
bool noWarnIgnoredFeatures = false;
bool preserveBindings = false;
bool preserveInterface = false;
bool o1ExperimentalFastCompile = false;
bool useDxLayout = false;
bool useGlLayout = false;
bool useLegacyBufferMatrixOrder = false;
bool useScalarLayout = false;
bool flattenResourceArrays = false;
bool reduceLoadSize = false;
bool autoShiftBindings = false;
bool supportNonzeroBaseInstance = false;
bool supportNonzeroBaseVertex = false;
bool fixFuncCallArguments = false;
bool enableMaximalReconvergence = false;
bool useVulkanMemoryModel = false;
bool useUnknownImageFormat = false;
bool IEEEStrict = false;
/// Maximum length in words for the OpString literal containing the shader
/// source for DebugSource and DebugSourceContinued. If the source code length
/// is larger than this number, we will use DebugSourceContinued instructions
/// for follow-up source code after the first DebugSource instruction. Note
/// that this number must be less than or equal to 0xFFFDu because of the
/// limitation of a single SPIR-V instruction size (0xFFFF) - 2 operand words
/// for OpString. Currently a smaller value is only used to test
/// DebugSourceContinued generation.
uint32_t debugSourceLen = 0;
SpirvLayoutRule cBufferLayoutRule = SpirvLayoutRule::Void;
SpirvLayoutRule sBufferLayoutRule = SpirvLayoutRule::Void;
SpirvLayoutRule tBufferLayoutRule = SpirvLayoutRule::Void;
SpirvLayoutRule ampPayloadLayoutRule = SpirvLayoutRule::Void;
llvm::StringRef stageIoOrder;
llvm::StringRef targetEnv;
uint32_t maxId = 0;
llvm::SmallVector<int32_t, 4> bShift;
llvm::SmallVector<int32_t, 4> sShift;
llvm::SmallVector<int32_t, 4> tShift;
llvm::SmallVector<int32_t, 4> uShift;
llvm::SmallVector<llvm::StringRef, 4> allowedExtensions;
llvm::SmallVector<llvm::StringRef, 4> optConfig;
std::vector<std::string> bindRegister;
std::vector<std::string> bindGlobals;
std::string entrypointName;
std::string floatDenormalMode; // OPT_denorm
// User-defined bindings/set numbers for resource/sampler/counter heaps.
struct BindingInfo {
size_t binding;
size_t set;
};
std::optional<BindingInfo> resourceHeapBinding;
std::optional<BindingInfo> samplerHeapBinding;
std::optional<BindingInfo> counterHeapBinding;
bool signaturePacking =
false; ///< Whether signature packing is enabled or not
bool printAll =
false; // Dump SPIR-V module before each pass and after the last one.
// String representation of all command line options and input file.
std::string clOptions;
std::string inputFile;
// String representation of original source
std::string origSource;
};
} // namespace spirv
} // namespace clang
#endif // ENABLE_SPIRV_CODEGEN
#endif // LLVM_SPIRV_OPTIONS_H