[llvm] [NFC] Refactoring DXContainerYaml Root Parameter representation (PR #138318)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 22 15:23:26 PDT 2025
================
@@ -316,14 +319,22 @@ 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);
----------------
joaosaffran wrote:
`DXContainerYaml` handles both serialization and deserialization of yaml files. `IO.outputting()` is a way for me to know which one is happening. Since parameter data is using a variant, the yaml serialization doesn't have a native way of handling that. Therefore, this is a custom logic to read and write the correct parameters data to and from YAML. I think this is still a NFC, since I am just keeping the existing functionality.
https://github.com/llvm/llvm-project/pull/138318
More information about the llvm-commits
mailing list