[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
================
@@ -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};
----------------
bogner wrote:
This will become moot after the next step (updating the YAML representation), but it would be good to make our assumptions clear here. A couple of asserts should do:
```c++
assert(dxbc::isValidParameterType(L.Header.Type && "invalid DXContainer YAML");
assert(dxbc::isValidShaderVisibility(L.Header.Visibility && "invalid DXContainer YAML");
dxbc::RootParameterType Type(L.Header.Type);
dxbc::ShaderVisibility Visibility(L.Header.Visibility);
```
https://github.com/llvm/llvm-project/pull/154249
More information about the llvm-commits
mailing list