[llvm] [NFC] Refactoring DXContainerYaml Root Parameter representation (PR #138318)

Finn Plummer via llvm-commits llvm-commits at lists.llvm.org
Thu May 22 17:27:17 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);
----------------
inbelic wrote:

I see. Should we also assign `P.Data = Constants` when we are not outputting then? Otherwise, it seems we would overwrite it with garbage.

https://github.com/llvm/llvm-project/pull/138318


More information about the llvm-commits mailing list