Repository navigation
Improve handling of semantics through SROA - #1777
Merged
Tristan Labelle (tristanlabelle) merged 4 commits intoDec 19, 2018
Merged
Tristan Labelle (tristanlabelle) merged 4 commits into
Tristan Labelle (tristanlabelle) merged 4 commits into
Conversation
Tristan Labelle (tristanlabelle)
requested review from
Helena Kotas (hekota) and
Tex Riddell (tex3d)
December 14, 2018 23:46
| unsigned semGroupEnd = i + 1; | ||
| while (semGroupEnd < endArgIndex && | ||
| FlatAnnotationList[semGroupEnd].GetSemanticString() == ContinuedPseudoSemantic) { | ||
| FlatAnnotationList[semGroupEnd].SetSemanticString(baseSemName); |
Contributor
Author
There was a problem hiding this comment.
This line is where I fix the '*' back to the proper semantic name (only the base name, the rest of the function handles the indices)
| return V; | ||
| } | ||
|
|
||
| struct AnnotatedValue { |
Contributor
Author
There was a problem hiding this comment.
This supersedes the previous annotationMap in a cleaner way. It's helped me catch some bugs, too.
| // TODO: warning for override the semantic in EltAnnotation. | ||
| // It doesn't look like we can provide source location information from here | ||
| F->getContext().emitWarning( | ||
| Twine("semantic '") + eltSem + "' on field overridden by function or enclosing type"); |
Contributor
Author
There was a problem hiding this comment.
New warning.
|
✅ Build DirectXShaderCompiler 1.0.1114 completed (commit bfb1a02712 by @MrTrillian) |
Tristan Labelle (tristanlabelle)
deleted the
semantics-sroa-improvements
branch
December 19, 2018 18:16
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This mainly fixes a crash with this code:
The crash happened because of our strategy for handling this:
When expanding
Input, we would label every field with the original semantic, so we would end up with two parameters annotatedTEXCOORD0, we would then run a pass on all adjacentTEXCOORD0parameters and change them to properly number them. However, this couldn't detect the situation in my original snippet, where we have two 'TEXCOORD0' in a row that are not the expansion of a struct marked with that semantic. It incorrectly attempted to renumberbin a way that ended up crashing.The solution is to change the strategy: when expanding a struct marked with a semantic, only the first field is now emitted with that same semantic, and all subsequent ones get assigned a dummy semantic ''. Once the parameter expansion completes, we do a pass and renumber all '' semantics based on their preceding legit semantic. Since '*' is not a valid semantic, we can't get confused with other fields having the same semantic.
I also added a warning for this case:
Fixes #1771
Fixes #1774