HLSL: allow trailing commas in initializer lists & scalar initialization

This commit is contained in:
steve-lunarg
2016-07-30 10:36:09 -06:00
parent b38f071605
commit fe5a3ff2f3
5 changed files with 199 additions and 5 deletions

View File

@@ -3,20 +3,29 @@ void Test1()
{
struct mystruct { float2 a; };
mystruct test1 = {
{ 1, 2, }, // test trailing commas
{ 1, 2, }, // test trailing commas in list
};
mystruct test2 = {
{ { 1, 2, } }, // test unneeded levels
float2(3, 4),
};
float test3 = { 1 } ; // test scalar initialization
// mystruct test3 = {
// { { 5, 6, } }, // TODO: test unneeded levels
// };
float test4 = { 7, } ; // test scalar initialization
struct mystruct2 { float a; float b; float c; };
mystruct2 test5 = { {8,}, {9,}, {10}, };
}
struct PS_OUTPUT { float4 color : SV_Target0; };
PS_OUTPUT main()
{
Test1();
PS_OUTPUT ps_output;
ps_output.color = 1.0;
return ps_output;