File: hlsl.array.implicit-size.frag

package info (click to toggle)
glslang 16.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 50,520 kB
  • sloc: cpp: 88,987; yacc: 4,227; sh: 603; python: 305; ansic: 94; javascript: 74; makefile: 17
file content (32 lines) | stat: -rw-r--r-- 783 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

// array size from initializer
static float g_array [ ] = { 1, 2, 3, 4, 5 };

// Unused: array size from initializer
static float g_array_unused [ ] = { 1, 2, 3, 4, 5, 6, 7 };

// Test initializer sizing for arrayed structs
static struct mystruct {
    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)
{
    // local array sized from initializers
    float l_array[] = { 1, 2, 3 };
    int idx;

    ps_output.color = g_array[0] + g_array[4] + l_array[1] + g_mystruct[0].f + g_array[idx];
}