2016-09-27 16:57:35 +00:00
|
|
|
|
2016-10-13 18:26:18 +00:00
|
|
|
// array size from initializer
|
2016-09-29 16:27:57 +00:00
|
|
|
static float g_array [ ] = { 1, 2, 3, 4, 5 };
|
2016-09-27 16:57:35 +00:00
|
|
|
|
2016-10-13 18:26:18 +00:00
|
|
|
// Unused: array size from initializer
|
2016-09-29 16:27:57 +00:00
|
|
|
static float g_array_unused [ ] = { 1, 2, 3, 4, 5, 6, 7 };
|
2016-09-27 16:57:35 +00:00
|
|
|
|
2016-10-13 18:26:18 +00:00
|
|
|
// Test initializer sizing for arrayed structs
|
2016-09-29 16:27:57 +00:00
|
|
|
static struct mystruct {
|
2016-09-27 16:57:35 +00:00
|
|
|
int i;
|
|
|
|
float f;
|
|
|
|
} g_mystruct[] = {
|
|
|
|
{ 1, 2.0 },
|
|
|
|
{ 3, 4.0 },
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PS_OUTPUT { float4 color : SV_Target0; };
|
|
|
|
|
|
|
|
// INVALID: implicit size requires an initializer expression.
|
|
|
|
// uniform float bad[];
|
|
|
|
|
|
|
|
// INVALID: function parameters cannot be implicitly sized
|
|
|
|
// void BadFunction(int a[]) { }
|
|
|
|
|
|
|
|
void main(out PS_OUTPUT ps_output)
|
|
|
|
{
|
2016-10-13 18:26:18 +00:00
|
|
|
// local array sized from initializers
|
2016-09-27 16:57:35 +00:00
|
|
|
float l_array[] = { 1, 2, 3 };
|
2016-12-15 00:02:32 +00:00
|
|
|
int idx;
|
2016-09-27 16:57:35 +00:00
|
|
|
|
|
|
|
ps_output.color = g_array[0] + g_array[4] + l_array[1] + g_mystruct[0].f + g_array[idx];
|
|
|
|
}
|