- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
[NFC] Refactoring DXContainerYaml Root Parameter representation #138318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 29 commits
0abacfc
              8b8c02a
              7ac9641
              c105458
              efe76aa
              a928e9d
              a38f10b
              9a7c359
              d6c2b55
              93e4cf2
              b45b1b6
              f804a23
              44bd13a
              ac51bf6
              97fb003
              93e04bd
              2f6d579
              76b1b75
              b2bfb02
              9ee2964
              2527580
              c3a46da
              df194b0
              0136cfc
              b589d10
              c7042b2
              70a9b7f
              f1dd0ce
              aabd424
              e8ab8f7
              bf5e7d3
              ea57253
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -75,26 +75,29 @@ DXContainerYAML::RootSignatureYamlDesc::create( | |
| return std::move(E); | ||
|  | ||
| auto Constants = *ConstantsOrErr; | ||
|  | ||
| NewP.Constants.Num32BitValues = Constants.Num32BitValues; | ||
| NewP.Constants.ShaderRegister = Constants.ShaderRegister; | ||
| NewP.Constants.RegisterSpace = Constants.RegisterSpace; | ||
| RootConstantsYaml ConstantYaml; | ||
| ConstantYaml.Num32BitValues = Constants.Num32BitValues; | ||
| ConstantYaml.ShaderRegister = Constants.ShaderRegister; | ||
| ConstantYaml.RegisterSpace = Constants.RegisterSpace; | ||
| NewP.Data = ConstantYaml; | ||
| } else if (auto *RDV = | ||
| dyn_cast<object::DirectX::RootDescriptorView>(&ParamView)) { | ||
| llvm::Expected<dxbc::RTS0::v2::RootDescriptor> DescriptorOrErr = | ||
| RDV->read(Version); | ||
| if (Error E = DescriptorOrErr.takeError()) | ||
| return std::move(E); | ||
| auto Descriptor = *DescriptorOrErr; | ||
| NewP.Descriptor.ShaderRegister = Descriptor.ShaderRegister; | ||
| NewP.Descriptor.RegisterSpace = Descriptor.RegisterSpace; | ||
| RootDescriptorYaml YamlDescriptor; | ||
| YamlDescriptor.ShaderRegister = Descriptor.ShaderRegister; | ||
| YamlDescriptor.RegisterSpace = Descriptor.RegisterSpace; | ||
| if (Version > 1) { | ||
| #define ROOT_DESCRIPTOR_FLAG(Num, Val) \ | ||
| NewP.Descriptor.Val = \ | ||
| YamlDescriptor.Val = \ | ||
| (Descriptor.Flags & \ | ||
| llvm::to_underlying(dxbc::RootDescriptorFlag::Val)) > 0; | ||
| #include "llvm/BinaryFormat/DXContainerConstants.def" | ||
| } | ||
| NewP.Data = YamlDescriptor; | ||
| } | ||
|  | ||
| RootSigDesc.Parameters.push_back(NewP); | ||
|  | @@ -316,14 +319,24 @@ void MappingTraits<llvm::DXContainerYAML::RootParameterYamlDesc>::mapping( | |
| IO.mapRequired("ShaderVisibility", P.Visibility); | ||
|  | ||
| switch (P.Type) { | ||
| case llvm::to_underlying(dxbc::RootParameterType::Constants32Bit): | ||
| IO.mapRequired("Constants", P.Constants); | ||
| break; | ||
| case llvm::to_underlying(dxbc::RootParameterType::Constants32Bit): { | ||
| DXContainerYAML::RootConstantsYaml Constants; | ||
| if (IO.outputting()) | ||
| Constants = std::get<DXContainerYAML::RootConstantsYaml>(P.Data); | ||
|          | ||
| IO.mapRequired("Constants", Constants); | ||
| if (!IO.outputting()) | ||
| P.Data = Constants; | ||
| } break; | ||
| case llvm::to_underlying(dxbc::RootParameterType::CBV): | ||
| case llvm::to_underlying(dxbc::RootParameterType::SRV): | ||
| case llvm::to_underlying(dxbc::RootParameterType::UAV): | ||
| IO.mapRequired("Descriptor", P.Descriptor); | ||
| break; | ||
| case llvm::to_underlying(dxbc::RootParameterType::UAV): { | ||
| DXContainerYAML::RootDescriptorYaml Descriptor; | ||
| if (IO.outputting()) | ||
| Descriptor = std::get<DXContainerYAML::RootDescriptorYaml>(P.Data); | ||
| IO.mapRequired("Descriptor", Descriptor); | ||
| if (!IO.outputting()) | ||
| P.Data = Descriptor; | ||
| } break; | ||
| } | ||
| } | ||
|  | ||
|  | ||
Uh oh!
There was an error while loading. Please reload this page.