xref: /freebsd/contrib/llvm-project/llvm/include/llvm/Support/DXILABI.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===-- DXILABI.h - ABI Sensitive Values for DXIL ---------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains definitions of various constants and enums that are
10 // required to remain stable as per the DXIL format's requirements.
11 //
12 // Documentation for DXIL can be found in
13 // https://github.com/Microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_SUPPORT_DXILABI_H
18 #define LLVM_SUPPORT_DXILABI_H
19 
20 #include "llvm/ADT/StringSwitch.h"
21 
22 namespace llvm {
23 namespace dxil {
24 
25 enum class ParameterKind : uint8_t {
26   Invalid = 0,
27   Void,
28   Half,
29   Float,
30   Double,
31   I1,
32   I8,
33   I16,
34   I32,
35   I64,
36   Overload,
37   CBufferRet,
38   ResourceRet,
39   DXILHandle,
40 };
41 
42 enum class ResourceClass : uint8_t {
43   SRV = 0,
44   UAV,
45   CBuffer,
46   Sampler,
47 };
48 
49 /// The kind of resource for an SRV or UAV resource. Sometimes referred to as
50 /// "Shape" in the DXIL docs.
51 enum class ResourceKind : uint32_t {
52   Invalid = 0,
53   Texture1D,
54   Texture2D,
55   Texture2DMS,
56   Texture3D,
57   TextureCube,
58   Texture1DArray,
59   Texture2DArray,
60   Texture2DMSArray,
61   TextureCubeArray,
62   TypedBuffer,
63   RawBuffer,
64   StructuredBuffer,
65   CBuffer,
66   Sampler,
67   TBuffer,
68   RTAccelerationStructure,
69   FeedbackTexture2D,
70   FeedbackTexture2DArray,
71   NumEntries,
72 };
73 
74 /// The element type of an SRV or UAV resource.
75 enum class ElementType : uint32_t {
76   Invalid = 0,
77   I1,
78   I16,
79   U16,
80   I32,
81   U32,
82   I64,
83   U64,
84   F16,
85   F32,
86   F64,
87   SNormF16,
88   UNormF16,
89   SNormF32,
90   UNormF32,
91   SNormF64,
92   UNormF64,
93   PackedS8x32,
94   PackedU8x32,
95 };
96 
97 /// Metadata tags for extra resource properties.
98 enum class ExtPropTags : uint32_t {
99   ElementType = 0,
100   StructuredBufferStride = 1,
101   SamplerFeedbackKind = 2,
102   Atomic64Use = 3,
103 };
104 
105 enum class SamplerType : uint32_t {
106   Default = 0,
107   Comparison = 1,
108   Mono = 2, // Note: Seems to be unused.
109 };
110 
111 enum class SamplerFeedbackType : uint32_t {
112   MinMip = 0,
113   MipRegionUsed = 1,
114 };
115 
116 } // namespace dxil
117 } // namespace llvm
118 
119 #endif // LLVM_SUPPORT_DXILABI_H
120