Closed
Description
HLSL initializer lists are... odd...
Basically HLSL flattens any structures or vector arguments to an InitListExpr, and flattens the shape of the target variable. As long as they then agree on how many elements need to be assigned, the assignment is valid.
The following are valid HLSL assignments:
struct A {
float X;
float Y;
};
struct B {
A Arr[2];
int Z;
};
A ah = {1.0, 2.0};
float2 F2 = {1.0, 2.0};
A aah = {F2};
B bah = { {1, 2}, {3, 4}, 5};
B bahh = {1,2,3,4,5};
B bahhh = {F2, 1,2,3};
B bahhhh = {{F2}, {F2}, 3};
B bahhhhh = {1,2,3,F2};
And more...
We want to deprecate this syntax in the future, however we believe that there is enough existing code that depends on this that we will need to have clang support it.
AC:
- clang supports DXC-style flattened initializer lists
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Closed