Handle possibility of bad types in varying input/output signature. #161
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.
Fixes #160
If the front-end runs into a type it doesn't understand in the parameter list of an entry point, it will create an
ErrorType
for that parameter, but then the parameter binding/layout rules will fail to create aTypeLayout
for the prameter (and returnNULL
).There were some places where the code was expecting that operation to succeed unconditionally, and so would crash when there was a bad type.
The specific case in the bug report was when the return type of a shader entry point was bad:
Note that the specific case in the buf report only manifests in "rewriter" mode (when the Slang compiler isn't allowed to issue error messages from the front-end), but the same basic thing would happen if the varying parameter/output had used a type that is invalid for varying input/output:
I'm not 100% happy with just adding more
NULL
checks for this, because there is no easy way to tell if they are exhaustive.A better solution in the longer term might be to construct a kind of
ErrorTypeLayout
to represent cases where we wanted a type layout, but none could be constructed.