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

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 09:54:22 PDT 2025


================
@@ -275,11 +275,14 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
 
       for (DXContainerYAML::RootParameterLocationYaml &L :
            P.RootSignature->Parameters.Locations) {
-        dxbc::RTS0::v1::RootParameterHeader Header{L.Header.Type, L.Header.Visibility,
-                                         L.Header.Offset};
 
-        switch (L.Header.Type) {
-        case llvm::to_underlying(dxbc::RootParameterType::Constants32Bit): {
+        mcdxbc::RootParameterHeader Header{
+            static_cast<dxbc::RootParameterType>(L.Header.Type),
+            static_cast<dxbc::ShaderVisibility>(L.Header.Visibility),
+            L.Header.Offset};
----------------
joaosaffran wrote:

I've added those assert in some point. The problem I faced was: this asserts would make me remove 2 tests, those would be removed eventually since, the yaml representation makes them impossible, but in order to keep the NFC in this PR I opted to keep the invalid parameter handling. But I do agree, it is better to make those assumptions explicit.

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


More information about the llvm-commits mailing list