HLSL: Fix #805: Support cast of scalars to structures.
Somewhat complex due to recognizing a general scalar, but not replicating it for each member to avoid side effects.
This commit is contained in:
37
Test/hlsl.scalarCast.vert
Executable file
37
Test/hlsl.scalarCast.vert
Executable file
@@ -0,0 +1,37 @@
|
||||
struct VertexOut {
|
||||
float4 position : SV_Position;
|
||||
float2 texCoord : TEXCOORD;
|
||||
};
|
||||
VertexOut r0() {
|
||||
const float f = 2.0;
|
||||
return (VertexOut)f;
|
||||
}
|
||||
VertexOut r1() {
|
||||
const float f = 2.0;
|
||||
return (VertexOut)(f + 1.0);
|
||||
}
|
||||
VertexOut r2() {
|
||||
const float f = 2.0;
|
||||
return (VertexOut)(sin(f));
|
||||
}
|
||||
VertexOut r3() {
|
||||
float f = 2.0;
|
||||
return (VertexOut)f;
|
||||
}
|
||||
VertexOut r4() {
|
||||
float f = 2.0;
|
||||
return (VertexOut)(f + 1.0);
|
||||
}
|
||||
VertexOut r5() {
|
||||
float f = 2.0;
|
||||
return (VertexOut)(sin(f));
|
||||
}
|
||||
VertexOut main() {
|
||||
VertexOut v0 = r0();
|
||||
VertexOut v1 = r1();
|
||||
VertexOut v2 = r2();
|
||||
VertexOut v3 = r3();
|
||||
VertexOut v4 = r4();
|
||||
VertexOut v5 = r5();
|
||||
return (VertexOut)1;
|
||||
}
|
||||
Reference in New Issue
Block a user