[llvm] [DirectX] adding support in obj2yaml and yaml2obj to root constants (PR #127840)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 21 10:21:43 PST 2025


================
@@ -288,6 +289,50 @@ Error DirectX::RootSignature::parse(StringRef Data) {
                             llvm::Twine(FValue));
   Flags = FValue;
 
+  Current = Begin + RootParametersOffset;
+  for (uint32_t It = 0; It < NumParameters; It++) {
+    dxbc::RootParameter NewParam;
+
+    dxbc::RootParameterType PTValue =
+        support::endian::read<dxbc::RootParameterType,
+                              llvm::endianness::little>(Current);
+    if (!dxbc::RootSignatureValidations::isValidParameterType(PTValue))
+      return validationFailed("unsupported parameter type value read: " +
+                              llvm::Twine((uint32_t)PTValue));
+
+    NewParam.ParameterType =
+        support::endian::read<dxbc::RootParameterType,
+                              llvm::endianness::little>(Current);
+    Current += sizeof(dxbc::RootParameterType);
+
+    dxbc::ShaderVisibilityFlag SVValue =
+        support::endian::read<dxbc::ShaderVisibilityFlag,
+                              llvm::endianness::little>(Current);
+
+    if (!dxbc::RootSignatureValidations::isValidShaderVisibility(SVValue))
+      return validationFailed("unsupported shader visility flag value read: " +
+                              llvm::Twine((uint32_t)SVValue));
+
+    NewParam.ShaderVisibility = SVValue;
----------------
joaosaffran wrote:

True, that make sense, did the refactoring.

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


More information about the llvm-commits mailing list