[SemaHLSL] Validate system semantic index
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
As noted in the [semantics proposal](https://github.com/llvm/wg-hlsl/blob/main/proposals/0031-semantics.md#parser), near bottom of parser section.
We should perform a semantic validation that the system semantic is indexable.
For example, you may not index `SV_POSITION` but no error is generated when compiling with clang: https://godbolt.org/z/oP5ozE4x3.
We should perform a semantic validation that a semantic is using a valid type, for example a double is not allowed: https://godbolt.org/z/hGnT4nvr8.
We need to also add sema validation for semantics that are not available on a ps/vs shader. This corresponds to each type marked as NA for [vertex](https://github.com/inbelic/wg-hlsl/blob/main/proposals/0040-semantics-overview.md#vertex-shader) and [pixel](https://github.com/inbelic/wg-hlsl/blob/main/proposals/0040-semantics-overview.md#pixel-shader) shaders
AC:
- [ ] Update `SemaHLSL` to perform the check on indexibility and overlap analysis
- [ ] Update `SemaHLSL` with a mechanism to ensure a semantic is not being used in the incorrect shader type
Contributor guide
Assessment
This issue has not been assessed yet.