HLSL: Fix issue #658: Don't adopt initializer constness from declaration.

This also makes it match how GLSL handles the same thing.
This commit is contained in:
John Kessenich
2017-01-05 10:28:26 -07:00
parent bf9a2f30c9
commit 085b833490
4 changed files with 417 additions and 69 deletions

View File

@@ -18,6 +18,25 @@ void Test1()
struct mystruct2 { float a; float b; float c; };
mystruct2 test5 = { {8,}, {9,}, {10}, };
const mystruct2 constTest5 = { {8,}, {9,}, {10}, };
constTest5.c;
const float step = 1.f;
float n = 0;
const float3 a[8] = {
normalize(float3(1, 1, 1)) * (n += step),
normalize(float3(-1, -1, -1)) * (n += step),
normalize(float3(-1, -1, 1)) * (n += step),
normalize(float3(-1, 1, -1)) * (n += step),
normalize(float3(-1, 1, 1)) * (n += step),
normalize(float3(1, -1, -1)) * (n += step),
normalize(float3(1, -1, 1)) * (n += step),
normalize(float3(1, 1, -1)) * (n += step) };
const struct one { float3 a; } oneNonConst = { normalize(float3(-1, 1, 1)) * (n += step) };
const struct two { float3 a;
float3 b; } twoNonConst = { normalize(float3(-1, 1, 1)) * (n += step),
normalize(float3(-1, 1, 1)) * (n += step) };
}
struct PS_OUTPUT { float4 color : SV_Target0; };