|
15 | 15 | #ifndef LLVM_OBJECT_DXCONTAINER_H |
16 | 16 | #define LLVM_OBJECT_DXCONTAINER_H |
17 | 17 |
|
| 18 | +#include "llvm/ADT/STLForwardCompat.h" |
18 | 19 | #include "llvm/ADT/SmallVector.h" |
19 | 20 | #include "llvm/ADT/StringRef.h" |
20 | 21 | #include "llvm/BinaryFormat/DXContainer.h" |
@@ -149,6 +150,36 @@ struct RootConstantView : RootParameterView { |
149 | 150 | } |
150 | 151 | }; |
151 | 152 |
|
| 153 | +struct RootDescriptorView_V1_0 : RootParameterView { |
| 154 | + static bool classof(const RootParameterView *V) { |
| 155 | + return (V->Header.ParameterType == |
| 156 | + llvm::to_underlying(dxbc::RootParameterType::CBV) || |
| 157 | + V->Header.ParameterType == |
| 158 | + llvm::to_underlying(dxbc::RootParameterType::SRV) || |
| 159 | + V->Header.ParameterType == |
| 160 | + llvm::to_underlying(dxbc::RootParameterType::UAV)); |
| 161 | + } |
| 162 | + |
| 163 | + llvm::Expected<dxbc::RootDescriptor_V1_0> read() { |
| 164 | + return readParameter<dxbc::RootDescriptor_V1_0>(); |
| 165 | + } |
| 166 | +}; |
| 167 | + |
| 168 | +struct RootDescriptorView_V1_1 : RootParameterView { |
| 169 | + static bool classof(const RootParameterView *V) { |
| 170 | + return (V->Header.ParameterType == |
| 171 | + llvm::to_underlying(dxbc::RootParameterType::CBV) || |
| 172 | + V->Header.ParameterType == |
| 173 | + llvm::to_underlying(dxbc::RootParameterType::SRV) || |
| 174 | + V->Header.ParameterType == |
| 175 | + llvm::to_underlying(dxbc::RootParameterType::UAV)); |
| 176 | + } |
| 177 | + |
| 178 | + llvm::Expected<dxbc::RootDescriptor_V1_1> read() { |
| 179 | + return readParameter<dxbc::RootDescriptor_V1_1>(); |
| 180 | + } |
| 181 | +}; |
| 182 | + |
152 | 183 | static Error parseFailed(const Twine &Msg) { |
153 | 184 | return make_error<GenericBinaryError>(Msg.str(), object_error::parse_failed); |
154 | 185 | } |
@@ -192,6 +223,14 @@ class RootSignature { |
192 | 223 | case dxbc::RootParameterType::Constants32Bit: |
193 | 224 | DataSize = sizeof(dxbc::RootConstants); |
194 | 225 | break; |
| 226 | + case dxbc::RootParameterType::CBV: |
| 227 | + case dxbc::RootParameterType::SRV: |
| 228 | + case dxbc::RootParameterType::UAV: |
| 229 | + if (Version == 1) |
| 230 | + DataSize = sizeof(dxbc::RootDescriptor_V1_0); |
| 231 | + else |
| 232 | + DataSize = sizeof(dxbc::RootDescriptor_V1_1); |
| 233 | + break; |
195 | 234 | } |
196 | 235 | size_t EndOfSectionByte = getNumStaticSamplers() == 0 |
197 | 236 | ? PartData.size() |
|
0 commit comments