microsoft / microsoft/hlsl-specs
Spec does not mention the ability to elementwise convert an aggregate to a scalar
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 222
- Forks
- 57
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 5
Description
Which document does this relate to?
Elementwise conversions
Describe the issue you see with the spec
The spec states that a prvalue A can be elementwise converted to a prvalue of an aggregate B.
However, it does not mention that it is possible to elementwise convert prvalue A to a prvalue of a scalar (a non-aggregate type).
Additional context
https://hlsl.godbolt.org/z/qGoTPMshK
Given the following HLSL:
void fn() {
int A[4] = {1, 2, 3, 4};
int I = (int)A;
}
In the Clang AST, an elementwise conversion is used to convert the aggregate type (int[4]) into a scalar (int).
`-VarDecl <col:5, col:18> col:9 I 'int' cinit
`-CStyleCastExpr <col:13, col:18> 'int' <HLSLElementwiseCast>
`-ImplicitCastExpr <col:18> 'int[4]' <HLSLArrayRValue> part_of_explicit_cast
`-DeclRefExpr <col:18> 'int[4]' lvalue Var 0x1c037468 'A' 'int[4]'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with specs/language/conversions.tex at the Elementwise conversions section referenced in the issue, then compare its wording with the HLSL example and Clang AST output. Update the specification to state how an aggregate prvalue can be elementwise converted to a scalar prvalue, and verify that the documented rule covers the shown int[4] to int conversion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- tex
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100