| 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 <cstdint> |
| 21 | |
| 22 | namespace llvm { |
| 23 | namespace dxil { |
| 24 | |
| 25 | enum class ResourceClass : uint8_t { |
| 26 | SRV = 0, |
| 27 | UAV, |
| 28 | CBuffer, |
| 29 | Sampler, |
| 30 | }; |
| 31 | |
| 32 | /// The kind of resource for an SRV or UAV resource. Sometimes referred to as |
| 33 | /// "Shape" in the DXIL docs. |
| 34 | enum class ResourceKind : uint32_t { |
| 35 | Invalid = 0, |
| 36 | Texture1D, |
| 37 | Texture2D, |
| 38 | Texture2DMS, |
| 39 | Texture3D, |
| 40 | TextureCube, |
| 41 | Texture1DArray, |
| 42 | Texture2DArray, |
| 43 | Texture2DMSArray, |
| 44 | TextureCubeArray, |
| 45 | TypedBuffer, |
| 46 | RawBuffer, |
| 47 | StructuredBuffer, |
| 48 | CBuffer, |
| 49 | Sampler, |
| 50 | TBuffer, |
| 51 | RTAccelerationStructure, |
| 52 | FeedbackTexture2D, |
| 53 | FeedbackTexture2DArray, |
| 54 | NumEntries, |
| 55 | }; |
| 56 | |
| 57 | /// The element type of an SRV or UAV resource. |
| 58 | enum class ElementType : uint32_t { |
| 59 | Invalid = 0, |
| 60 | I1, |
| 61 | I16, |
| 62 | U16, |
| 63 | I32, |
| 64 | U32, |
| 65 | I64, |
| 66 | U64, |
| 67 | F16, |
| 68 | F32, |
| 69 | F64, |
| 70 | SNormF16, |
| 71 | UNormF16, |
| 72 | SNormF32, |
| 73 | UNormF32, |
| 74 | SNormF64, |
| 75 | UNormF64, |
| 76 | PackedS8x32, |
| 77 | PackedU8x32, |
| 78 | }; |
| 79 | |
| 80 | /// Metadata tags for extra resource properties. |
| 81 | enum class ExtPropTags : uint32_t { |
| 82 | ElementType = 0, |
| 83 | StructuredBufferStride = 1, |
| 84 | SamplerFeedbackKind = 2, |
| 85 | Atomic64Use = 3, |
| 86 | }; |
| 87 | |
| 88 | enum class SamplerType : uint32_t { |
| 89 | Default = 0, |
| 90 | Comparison = 1, |
| 91 | Mono = 2, // Note: Seems to be unused. |
| 92 | }; |
| 93 | |
| 94 | enum class SamplerFeedbackType : uint32_t { |
| 95 | MinMip = 0, |
| 96 | MipRegionUsed = 1, |
| 97 | }; |
| 98 | |
| 99 | const unsigned MinWaveSize = 4; |
| 100 | const unsigned MaxWaveSize = 128; |
| 101 | |
| 102 | } // namespace dxil |
| 103 | } // namespace llvm |
| 104 | |
| 105 | #endif // LLVM_SUPPORT_DXILABI_H |
| 106 | |