|
17 | 17 | #include "llvm/Support/SwapByteOrder.h" |
18 | 18 | #include "llvm/TargetParser/Triple.h" |
19 | 19 |
|
| 20 | +#include <cstdint> |
20 | 21 | #include <stdint.h> |
21 | 22 |
|
22 | 23 | namespace llvm { |
@@ -63,44 +64,6 @@ struct ShaderHash { |
63 | 64 | void swapBytes() { sys::swapByteOrder(Flags); } |
64 | 65 | }; |
65 | 66 |
|
66 | | -#define ROOT_PARAMETER(RootParameter) RootParameter, |
67 | | -enum class RootParameterType { |
68 | | -#include "DXContainerConstants.def" |
69 | | -}; |
70 | | - |
71 | | -#define SHADER_VISIBILITY(ShaderVisibility) ShaderVisibility, |
72 | | -enum class ShaderVisibilityFlag { |
73 | | -#include "DXContainerConstants.def" |
74 | | -}; |
75 | | - |
76 | | -struct RootConstants { |
77 | | - uint32_t ShaderRegister; |
78 | | - uint32_t RegisterSpace; |
79 | | - uint32_t Num32BitValues; |
80 | | -}; |
81 | | - |
82 | | -struct RootParameter { |
83 | | - RootParameterType ParameterType; |
84 | | - union { |
85 | | - RootConstants Constants; |
86 | | - }; |
87 | | - ShaderVisibilityFlag ShaderVisibility; |
88 | | -}; |
89 | | - |
90 | | -struct RootSignatureDesc { |
91 | | - uint32_t Size; |
92 | | - uint32_t Version; |
93 | | - uint32_t Flags; |
94 | | - uint32_t NumParameters; |
95 | | - RootParameter *Parameters; |
96 | | - |
97 | | - void swapBytes() { |
98 | | - sys::swapByteOrder(Size); |
99 | | - sys::swapByteOrder(Version); |
100 | | - sys::swapByteOrder(Flags); |
101 | | - } |
102 | | -}; |
103 | | - |
104 | 67 | struct ContainerVersion { |
105 | 68 | uint16_t Major; |
106 | 69 | uint16_t Minor; |
@@ -195,6 +158,50 @@ enum class RootElementFlag : uint32_t { |
195 | 158 | #include "DXContainerConstants.def" |
196 | 159 | }; |
197 | 160 |
|
| 161 | +#define ROOT_PARAMETER(Val, Enum) Enum = Val, |
| 162 | +enum class RootParameterType : uint8_t { |
| 163 | +#include "DXContainerConstants.def" |
| 164 | +}; |
| 165 | + |
| 166 | +#define SHADER_VISIBILITY(Val, Enum) Enum = Val, |
| 167 | +enum class ShaderVisibilityFlag : uint8_t { |
| 168 | +#include "DXContainerConstants.def" |
| 169 | +}; |
| 170 | + |
| 171 | +struct RootConstants { |
| 172 | + uint32_t ShaderRegister; |
| 173 | + uint32_t RegisterSpace; |
| 174 | + uint32_t Num32BitValues; |
| 175 | + |
| 176 | + void swapBytes() { |
| 177 | + sys::swapByteOrder(ShaderRegister); |
| 178 | + sys::swapByteOrder(RegisterSpace); |
| 179 | + sys::swapByteOrder(Num32BitValues); |
| 180 | + } |
| 181 | +}; |
| 182 | + |
| 183 | +struct RootParameter { |
| 184 | + RootParameterType ParameterType; |
| 185 | + union { |
| 186 | + RootConstants Constants; |
| 187 | + }; |
| 188 | + ShaderVisibilityFlag ShaderVisibility; |
| 189 | + |
| 190 | + void swapBytes() { |
| 191 | + switch (ParameterType) { |
| 192 | + |
| 193 | + case RootParameterType::Constants32Bit: |
| 194 | + Constants.swapBytes(); |
| 195 | + break; |
| 196 | + case RootParameterType::DescriptorTable: |
| 197 | + case RootParameterType::CBV: |
| 198 | + case RootParameterType::SRV: |
| 199 | + case RootParameterType::UAV: |
| 200 | + break; |
| 201 | + } |
| 202 | + } |
| 203 | +}; |
| 204 | + |
198 | 205 | PartType parsePartType(StringRef S); |
199 | 206 |
|
200 | 207 | struct VertexPSVInfo { |
@@ -536,6 +543,8 @@ enum class SigComponentType : uint32_t { |
536 | 543 | }; |
537 | 544 |
|
538 | 545 | ArrayRef<EnumEntry<SigComponentType>> getSigComponentTypes(); |
| 546 | +ArrayRef<EnumEntry<RootParameterType>> getRootParameterTypes(); |
| 547 | +ArrayRef<EnumEntry<ShaderVisibilityFlag>> getShaderVisibilityFlags(); |
539 | 548 |
|
540 | 549 | struct ProgramSignatureHeader { |
541 | 550 | uint32_t ParamCount; |
|
0 commit comments