[llvm] [DXIL] Add support for root signature flag element in DXContainer (PR #123147)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 11:39:01 PST 2025


================
@@ -550,18 +548,10 @@ static_assert(sizeof(ProgramSignatureElement) == 32,
 
 struct RootSignatureValidations {
 
-  static Expected<uint32_t> validateRootFlag(uint32_t Flags) {
-    if ((Flags & ~0x80000fff) != 0)
-      return llvm::make_error<BinaryStreamError>("Invalid Root Signature flag");
-    return Flags;
-  }
-
-  static Expected<uint32_t> validateVersion(uint32_t Version) {
-    if (Version == 1 || Version == 2)
-      return Version;
+  static bool validateRootFlag(uint32_t Flags) { return (Flags & ~0xfff) != 0; }
 
-    return llvm::make_error<BinaryStreamError>(
-        "Invalid Root Signature Version");
+  static bool validateVersion(uint32_t Version) {
----------------
bogner wrote:

It might be better to rename these to `isValidRootFlag` and `isValidVersion` and invert the conditions. A verb like "validate" doesn't make it clear that these just return a simple bool, and the "isX" naming makes it clear what the true and false results mean at a glance.

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


More information about the llvm-commits mailing list