Add analyzers for shader types being less accessible than internal #631
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.
Description
As part of the work to centralize the generation logic (so that it becomes reasonable to add more complicated logic as well, such as support for primary constructor, support for fields that are not publicly visible, etc.), all constant buffer marshalling logic will be shared across the D2D1 and D3D12 generator, and specifically it will also go into a new
ConstantBufferMarshaller
generated type, which will reference the shader type and the constant buffer. For this to work (as well as for the ability to interact with all fields as well), the shader types must have at least internal accessibility, or the generated code would be invalid.This PR adds a new analyzer to emit an error when that is not the case (for both the D3D12 and D2D1 generators). Additionally, it disable the generator if the annotated type is not accessible. As precedent, the COM interop generator does exactly the same.