-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[DirectX] adding support in obj2yaml and yaml2obj to root constants #127840
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
Merged
Changes from 1 commit
Commits
Show all changes
130 commits
Select commit
Hold shift + click to select a range
526b34a
adding rootsignature to obj2yaml
e84a8e1
adding test
f25fd64
removing old test
16552f0
remove useless includes
a6eb4c0
addressing comments
7d080b3
updating test
504527b
removing useless header
2425672
fix formating
08c17bb
renaming test
395a536
addressing pr comments
f93dff9
adding str to ROOT_ELEMENT_FLAG
1c1edb8
formating
5bef775
refactoring to follow llvm standards
628545a
addressing comments
c5c2ab6
clean up
b9db72c
remove version
f4af043
fix pr
496b922
adding dxil-dis test
422578f
adding compatibility test
b1423eb
addressing test concerns
b6262b6
clean up
16d0e8e
addressing comments
0a9e468
adding fail test
8295031
adding comment
c8e1e38
adding few more tests
434b862
format
2bfc5ad
cleanup
479422d
adding metadata extraction
f61ee77
moving root signature to it's own pass
499d879
formating
c4af535
removing useless imports
819fa0d
fixing pr changes
d347a87
adding some asserts
d8824ed
format
25c0384
fixing assert
5eb0ad2
cleaning
559427d
clean up
8ca5b2a
addressing comments
d52cd2c
removing version
5930dcb
fix test
fc72988
addressing PR Comments
2d1ee0d
fix test
92a85fe
filtering root signatures not associated with entry function
979ee91
separating parsing and validation
d089674
improve error handling
980e7d9
clean up
04667f3
clean up
8ec40aa
formating
b0ac6be
addressing comments and fix tests
6a36503
formating
f7d2c12
addressing pr comments
d6c98ed
addressing PR comments
36746f5
addressing pr comments
b5208e8
removing copies from root signature use in dx container globals
1fd6568
adding more tests
cde4634
maybe fix test?
4410e7b
try fix format
cbdb114
removing test
667ee17
adding llvm unreachable and testing test
d0dae8b
stopping compilation if root signature error were emitted
b1b28f8
making sure Error tests fail
0efd8cc
adding root constants
11256d8
refactoring root signature analysis to return a map instead
3c5046e
addressing pr comments
5d4505c
clean up
3117530
addressing pr comments
0af845c
implementing find interface for RootSignatureAnalysisWrapper
bf49a3a
adding test for null function
78826a5
fix root signature test error
4e689e9
fix other functions are checked
b0d0180
adding missing continue
3c6894f
adding few more tests
08f6ddc
adding yaml2obj support
b232967
adding support for obj2yaml and initial tests
1026a8e
multiple parameters support and more testing
00175bf
clean up
9ed2adc
fixing formating
e8252ba
reapply rebase fix
4de5c29
clean up
fe13b61
addressing pr comments
767b7d0
first working version
8434dc2
formating
d391727
moving the offset logic to it's own class
68c7513
refactoring to remove use of map and string
23069ab
addressing comments
d14471b
using buffer_ostream
216341c
remove getsize
85f012c
clean up
1e2bcf5
clean up
0e277d9
clean up
5cd0044
clean up
7a7c34d
addressing pr comments
d3fafab
clean up
15d1a8c
Merge branch 'refactor/improve-offset-calculation' into users/joaosaf…
7485640
clean up
17abc82
moving initializer arround
4b177e2
addressing pr comments
ec1dd87
addressing changes
eb9d7d3
Merge branch 'main' into users/joaosaffran/127840
f2a4f04
fix test
7c4236c
refactoring to change representations in binary format
2894f96
addressing pr comments
7b5e9d8
addressing comments and clean up
f0e6a46
moving RootSignatureValidations to out of BinaryFormat
4fe30df
addressing most pr comments
cbc334a
adding root parameter view
31bcd73
clean up
30098e1
addressing pr comments
1bf6408
wip: implementing comments
d1b32f3
removing old code
3b9bf27
address errors
89632a4
removing validations from obj2yaml
67da709
ac
3991c5d
address comments
cfc6bfb
clean up
82a31fa
removing param_header_begin and param_header_end
e6865a7
Revert "clean up"
021976d
Reapply "clean up"
102ff4b
removing unnecessary parameters
39d4b08
addressing pr comments
7343d95
adding more tests
6986945
adding more tests and addressing comments
c0ac522
adding tests and changing parameter type
8511fa9
address comments
330369a
changing back enums to enum class
d747bcc
addressing PR comments and adding more tests
6cef567
adding tests and fixing code
246d5d3
addressing comments
bb6c0cf
clean up
7885eed
addressing nits
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
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 |
---|---|---|
|
@@ -40,6 +40,8 @@ DXContainerYAML::RootSignatureYamlDesc::create( | |
RootSigDesc.Version = Data.getVersion(); | ||
RootSigDesc.NumStaticSamplers = Data.getNumStaticSamplers(); | ||
RootSigDesc.StaticSamplersOffset = Data.getStaticSamplersOffset(); | ||
RootSigDesc.NumRootParameters = Data.getNumRootParameters(); | ||
RootSigDesc.RootParametersOffset = Data.getRootParametersOffset(); | ||
|
||
uint32_t Flags = Data.getFlags(); | ||
for (const auto &PH : Data.param_headers()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one too |
||
|
@@ -51,13 +53,13 @@ DXContainerYAML::RootSignatureYamlDesc::create( | |
return createStringError(std::errc::invalid_argument, | ||
"Invalid value for parameter type"); | ||
|
||
NewP.Type = (dxbc::RootParameterType)PH.ParameterType; | ||
NewP.Type = PH.ParameterType; | ||
|
||
if (!dxbc::isValidShaderVisibility(PH.ShaderVisibility)) | ||
return createStringError(std::errc::invalid_argument, | ||
"Invalid value for shader visibility"); | ||
|
||
NewP.Visibility = (dxbc::ShaderVisibility)PH.ShaderVisibility; | ||
NewP.Visibility = PH.ShaderVisibility; | ||
|
||
llvm::Expected<object::DirectX::RootParameterView> ParamViewOrErr = | ||
Data.getParameter(PH); | ||
|
@@ -257,6 +259,8 @@ void MappingTraits<DXContainerYAML::Signature>::mapping( | |
void MappingTraits<DXContainerYAML::RootSignatureYamlDesc>::mapping( | ||
IO &IO, DXContainerYAML::RootSignatureYamlDesc &S) { | ||
IO.mapRequired("Version", S.Version); | ||
IO.mapRequired("NumRootParameters", S.NumRootParameters); | ||
IO.mapRequired("RootParametersOffset", S.RootParametersOffset); | ||
IO.mapRequired("NumStaticSamplers", S.NumStaticSamplers); | ||
IO.mapRequired("StaticSamplersOffset", S.StaticSamplersOffset); | ||
IO.mapRequired("Parameters", S.Parameters); | ||
|
@@ -385,18 +389,6 @@ void ScalarEnumerationTraits<dxbc::SigComponentType>::enumeration( | |
IO.enumCase(Value, E.Name.str().c_str(), E.Value); | ||
} | ||
|
||
void ScalarEnumerationTraits<dxbc::RootParameterType>::enumeration( | ||
IO &IO, dxbc::RootParameterType &Value) { | ||
for (const auto &E : dxbc::getRootParameterTypes()) | ||
IO.enumCase(Value, E.Name.str().c_str(), E.Value); | ||
} | ||
|
||
void ScalarEnumerationTraits<dxbc::ShaderVisibility>::enumeration( | ||
IO &IO, dxbc::ShaderVisibility &Value) { | ||
for (const auto &E : dxbc::getShaderVisibility()) | ||
IO.enumCase(Value, E.Name.str().c_str(), E.Value); | ||
} | ||
|
||
} // namespace yaml | ||
|
||
void DXContainerYAML::PSVInfo::mapInfoForVersion(yaml::IO &IO) { | ||
|
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
29 changes: 29 additions & 0 deletions
29
llvm/test/ObjectYAML/DXContainer/RootSignature-InvalidType.yaml
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# RUN: yaml2obj %s -o %t | ||
# RUN: not obj2yaml 2>&1 %t | FileCheck %s -DFILE=%t | ||
|
||
# CHECK: Error reading file: [[FILE]]: Invalid value for parameter type | ||
|
||
|
||
--- !dxcontainer | ||
Header: | ||
Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, | ||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] | ||
Version: | ||
Major: 1 | ||
Minor: 0 | ||
PartCount: 1 | ||
PartOffsets: [ 60 ] | ||
Parts: | ||
- Name: RTS0 | ||
Size: 80 | ||
RootSignature: | ||
Version: 2 | ||
NumRootParameters: 2 | ||
RootParametersOffset: 24 | ||
NumStaticSamplers: 0 | ||
StaticSamplersOffset: 64 | ||
Parameters: | ||
- ParameterType: 255 # INVALID | ||
ShaderVisibility: 2 # Hull | ||
AllowInputAssemblerInputLayout: true | ||
DenyGeometryShaderRootAccess: true |
33 changes: 33 additions & 0 deletions
33
llvm/test/ObjectYAML/DXContainer/RootSignature-InvalidVisibility.yaml
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# RUN: yaml2obj %s -o %t | ||
# RUN: not obj2yaml 2>&1 %t | FileCheck %s -DFILE=%t | ||
|
||
# CHECK: Error reading file: [[FILE]]: Invalid value for shader visibility | ||
|
||
|
||
--- !dxcontainer | ||
Header: | ||
Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, | ||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] | ||
Version: | ||
Major: 1 | ||
Minor: 0 | ||
PartCount: 1 | ||
PartOffsets: [ 60 ] | ||
Parts: | ||
- Name: RTS0 | ||
Size: 80 | ||
RootSignature: | ||
Version: 2 | ||
NumRootParameters: 2 | ||
RootParametersOffset: 24 | ||
NumStaticSamplers: 0 | ||
StaticSamplersOffset: 64 | ||
Parameters: | ||
- ParameterType: 1 # Constants32Bit | ||
ShaderVisibility: 255 # INVALID | ||
Constants: | ||
Num32BitValues: 21 | ||
ShaderRegister: 22 | ||
RegisterSpace: 23 | ||
AllowInputAssemblerInputLayout: true | ||
DenyGeometryShaderRootAccess: true |
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
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.
Uh oh!
There was an error while loading. Please reload this page.