[llvm] [Draft] Remove to_underlying from root parameter header (PR #154249)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 09:05:55 PDT 2025


================
@@ -19,13 +19,19 @@ namespace llvm {
 class raw_ostream;
 namespace mcdxbc {
 
+struct RootParameterHeader {
+  dxbc::RootParameterType ParameterType;
+  dxbc::ShaderVisibility ShaderVisibility;
+  uint32_t ParameterOffset;
+};
+
 struct RootParameterInfo {
-  dxbc::RTS0::v1::RootParameterHeader Header;
+  RootParameterHeader Header;
   size_t Location;
 
   RootParameterInfo() = default;
 
-  RootParameterInfo(dxbc::RTS0::v1::RootParameterHeader Header, size_t Location)
+  RootParameterInfo(RootParameterHeader Header, size_t Location)
       : Header(Header), Location(Location) {}
 };
----------------
bogner wrote:

At this point I think it might simplify things to just have the Info object and forgo the local header type completely, as in
```c++
struct RootParameterInfo {
  dxbc::RootParameterType Type;
  dxbc::ShaderVisibility Visibility;
  uint32_t Offset;
  size_t Location;

  RootParameterInfo(dxbc::RootParameterType Type,
                    dxbc::ShaderVisibility Visibility, uint32_t Offset,
                    size_t Location)
      : Type(Type), Visibility(Visibility), Offset(Offset), Location(Location) {
  }
};
```

then the `addParameter` functions below can just take Type/Visibility/Offset parameters directly instead of a Header object.

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


More information about the llvm-commits mailing list