Repository navigation
Add type annotations for missing HLSL object cases - #6227
Draft
Tex Riddell (tex3d) wants to merge 4 commits into
Draft
Tex Riddell (tex3d) wants to merge 4 commits into
Tex Riddell (tex3d) wants to merge 4 commits into
Conversation
- Node Object method return types - Type template arguments
| case clang::TemplateArgument::ArgKind::Type: { | ||
| auto argTy = arg.getAsType(); | ||
| unsigned arrayEltSize = 0; | ||
| AddTypeAnnotation(argTy, dxilTypeSys, arrayEltSize); |
Collaborator
There was a problem hiding this comment.
I'm curious why this hasn't come up before for other templated types.
Contributor
Author
There was a problem hiding this comment.
I think most of the time, the type gets added through another path, such as a local variable being assigned to the result of an operation which returns the templated type.
An incomplete type indicates an unused type, so it should not require a type annotation. The incomplete type case is hit due to new code annotating object method return types. If the return type is an incomplete type, the method must never be called, the type is never completed, and the type annotation cannot be created.
Remove the workaround for missing node record type annotation for NodeOutput retrieved from NodeOutputArray.
Contributor
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Otherwise cases where structs are materialized later will be missed, such as for the subscript operator. No need to iterate object methods now. In AddTypeAnnotation, we expect the annotation for RecordType to already have been created. Adjust `!IsHLSLStructuredBufferType(Ty) && IsHLSLResourceType(Ty)` case: - No annotation needed for resource object unless structured buffer type, all resource objects return 0 for CB size. - Previously, structured buffer case went through RecordType case in AddTypeAnnotation, but now it's created elsewhere, so that's unnecessary. Updated test sensitive to type annotation ordering, since now inner annotations will be added first now.
Tex Riddell (tex3d)
force-pushed
the
add-missing-type-annotations
branch
from
March 7, 2024 06:57
26f1b49 to
6cdb14e
Compare
This branch has not been deployed
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.
TODO: Add tests
Fixes: #5357