forked from microsoft/DirectXShaderCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSPIRVOptions.h
More file actions
129 lines (115 loc) · 4.15 KB
/
SPIRVOptions.h
File metadata and controls
129 lines (115 loc) · 4.15 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
//===------- 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 {
bool disableHLSLIntrinsics;
/// Disable legalization and optimization and emit raw SPIR-V
bool codeGenHighLevel;
bool debugInfoFile;
bool debugInfoLine;
bool debugInfoSource;
bool debugInfoTool;
bool debugInfoRich;
/// Use NonSemantic.Vulkan.DebugInfo.100 debug info instead of
/// OpenCL.DebugInfo.100
bool debugInfoVulkan;
bool defaultRowMajor;
bool disableValidation;
bool enable16BitTypes;
bool finiteMathOnly;
bool enableReflect;
bool invertY; // Additive inverse
bool invertW; // Multiplicative inverse
bool noWarnEmulatedFeatures;
bool noWarnIgnoredFeatures;
bool preserveBindings;
bool preserveInterface;
bool useDxLayout;
bool useGlLayout;
bool useLegacyBufferMatrixOrder;
bool useScalarLayout;
bool flattenResourceArrays;
bool reduceLoadSize;
bool autoShiftBindings;
bool supportNonzeroBaseInstance;
bool supportNonzeroBaseVertex;
bool fixFuncCallArguments;
bool enableMaximalReconvergence;
bool useVulkanMemoryModel;
bool useUnknownImageFormat;
bool IEEEStrict;
/// 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;
SpirvLayoutRule cBufferLayoutRule;
SpirvLayoutRule sBufferLayoutRule;
SpirvLayoutRule tBufferLayoutRule;
SpirvLayoutRule ampPayloadLayoutRule;
llvm::StringRef stageIoOrder;
llvm::StringRef targetEnv;
uint32_t maxId;
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; ///< Whether signature packing is enabled or not
bool printAll; // 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