SPIRV-Cross/reference/shaders/comp/inout-struct.invalid.comp

66 lines
1.3 KiB
Plaintext
Raw Normal View History

2016-03-02 17:09:16 +00:00
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
struct Foo
{
vec4 a;
vec4 b;
vec4 c;
vec4 d;
};
2017-01-21 09:07:38 +00:00
layout(binding = 1, std430) readonly buffer SSBO2
2016-03-02 17:09:16 +00:00
{
vec4 data[];
} indata;
2017-01-21 09:07:38 +00:00
layout(binding = 0, std430) writeonly buffer SSBO
2016-03-02 17:09:16 +00:00
{
vec4 data[];
} outdata;
2017-01-21 09:07:38 +00:00
layout(binding = 2, std430) readonly buffer SSBO3
2016-03-02 17:09:16 +00:00
{
Foo foos[];
} foobar;
void baz(inout Foo foo)
2016-03-02 17:09:16 +00:00
{
uint ident = gl_GlobalInvocationID.x;
foo.a = indata.data[(4u * ident) + 0u];
foo.b = indata.data[(4u * ident) + 1u];
foo.c = indata.data[(4u * ident) + 2u];
foo.d = indata.data[(4u * ident) + 3u];
2016-03-02 17:09:16 +00:00
}
void meow(inout Foo foo)
{
foo.a += vec4(10.0);
foo.b += vec4(20.0);
foo.c += vec4(30.0);
foo.d += vec4(40.0);
2016-03-02 17:09:16 +00:00
}
vec4 bar(Foo foo)
{
return ((foo.a + foo.b) + foo.c) + foo.d;
2016-03-02 17:09:16 +00:00
}
void main()
{
Foo param;
baz(param);
Foo foo = param;
Foo param_1 = foo;
meow(param_1);
foo = param_1;
Foo param_2 = foo;
2016-09-10 10:52:23 +00:00
Foo param_3;
param_3.a = foobar.foos[gl_GlobalInvocationID.x].a;
param_3.b = foobar.foos[gl_GlobalInvocationID.x].b;
param_3.c = foobar.foos[gl_GlobalInvocationID.x].c;
param_3.d = foobar.foos[gl_GlobalInvocationID.x].d;
outdata.data[gl_GlobalInvocationID.x] = bar(param_2) + bar(param_3);
2016-03-02 17:09:16 +00:00
}