-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[DirectX] Refactor RootSignature Backend to remove to_underlying
from Root Parameter Header
#154249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
joaosaffran
merged 13 commits into
llvm:main
from
joaosaffran:refactoring/add_enum_rs_internal
Aug 25, 2025
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
31ec5e5
making parameter type and shader visibility use enums
joaosaffran 1690a9c
clean up
joaosaffran f6f2e61
removing root parameter header from MC
joaosaffran 6539364
clean up
joaosaffran 1d29111
fix whitespace in test
joaosaffran 8eb82fd
adding missing import
joaosaffran d38c00d
remove unused
joaosaffran 3b25b34
save a copy
joaosaffran 567a3d4
remove default constructor
joaosaffran fb248da
rename visibility
joaosaffran dc436d5
remove cstdint
joaosaffran 8353fe0
remove Loc
joaosaffran 3a30581
addressing comments from bogner
joaosaffran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -35,20 +35,20 @@ size_t RootSignatureDesc::getSize() const { | |||||
StaticSamplers.size() * sizeof(dxbc::RTS0::v1::StaticSampler); | ||||||
|
||||||
for (const RootParameterInfo &I : ParametersContainer) { | ||||||
switch (I.Header.ParameterType) { | ||||||
case llvm::to_underlying(dxbc::RootParameterType::Constants32Bit): | ||||||
switch (I.Type) { | ||||||
case dxbc::RootParameterType::Constants32Bit: | ||||||
Size += sizeof(dxbc::RTS0::v1::RootConstants); | ||||||
break; | ||||||
case llvm::to_underlying(dxbc::RootParameterType::CBV): | ||||||
case llvm::to_underlying(dxbc::RootParameterType::SRV): | ||||||
case llvm::to_underlying(dxbc::RootParameterType::UAV): | ||||||
case dxbc::RootParameterType::CBV: | ||||||
case dxbc::RootParameterType::SRV: | ||||||
case dxbc::RootParameterType::UAV: | ||||||
if (Version == 1) | ||||||
Size += sizeof(dxbc::RTS0::v1::RootDescriptor); | ||||||
else | ||||||
Size += sizeof(dxbc::RTS0::v2::RootDescriptor); | ||||||
|
||||||
break; | ||||||
case llvm::to_underlying(dxbc::RootParameterType::DescriptorTable): | ||||||
case dxbc::RootParameterType::DescriptorTable: | ||||||
const DescriptorTable &Table = | ||||||
ParametersContainer.getDescriptorTable(I.Location); | ||||||
|
||||||
|
@@ -84,23 +84,21 @@ void RootSignatureDesc::write(raw_ostream &OS) const { | |||||
support::endian::write(BOS, Flags, llvm::endianness::little); | ||||||
|
||||||
SmallVector<uint32_t> ParamsOffsets; | ||||||
for (const RootParameterInfo &P : ParametersContainer) { | ||||||
support::endian::write(BOS, P.Header.ParameterType, | ||||||
llvm::endianness::little); | ||||||
support::endian::write(BOS, P.Header.ShaderVisibility, | ||||||
llvm::endianness::little); | ||||||
for (const RootParameterInfo &I : ParametersContainer) { | ||||||
support::endian::write(BOS, I.Type, llvm::endianness::little); | ||||||
support::endian::write(BOS, I.Visibility, llvm::endianness::little); | ||||||
|
||||||
ParamsOffsets.push_back(writePlaceholder(BOS)); | ||||||
} | ||||||
|
||||||
assert(NumParameters == ParamsOffsets.size()); | ||||||
for (size_t I = 0; I < NumParameters; ++I) { | ||||||
rewriteOffsetToCurrentByte(BOS, ParamsOffsets[I]); | ||||||
const auto &[Type, Loc] = ParametersContainer.getTypeAndLocForParameter(I); | ||||||
switch (Type) { | ||||||
case llvm::to_underlying(dxbc::RootParameterType::Constants32Bit): { | ||||||
const auto Info = ParametersContainer.getInfo(I); | ||||||
|
const auto Info = ParametersContainer.getInfo(I); | |
const RootParameterInfo &Info = ParametersContainer.getInfo(I); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, this pr is meant to remove any dependency from
MC
ontoObject/DXContainer.h
?Shouldn't that mean that some include is removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It not from
Object/DXContainer.h
, it is from some values defined insideBinaryFormat/DXContainer.h
mainly theRTS0
namespace