summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/3rdparty/spirv-cross/shaders/frag/constant-array.frag
blob: b862cb1dbf2ab8be5b13f3cd96382f8165174a0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#version 310 es
precision mediump float;
layout(location = 0) out vec4 FragColor;

layout(location = 0) flat in int index;

struct Foobar { float a; float b; };

vec4 resolve(Foobar f)
{
   return vec4(f.a + f.b);
}

void main()
{
   const vec4 foo[3] = vec4[](vec4(1.0), vec4(2.0), vec4(3.0));
   const vec4 foobars[2][2] = vec4[][](vec4[](vec4(1.0), vec4(2.0)), vec4[](vec4(8.0), vec4(10.0)));
   const Foobar foos[2] = Foobar[](Foobar(10.0, 40.0), Foobar(90.0, 70.0));

   FragColor = foo[index] + foobars[index][index + 1] + resolve(Foobar(10.0, 20.0)) + resolve(foos[index]);
}