| 1 |
#version 450 |
| 2 |
#extension GL_EXT_scalar_block_layout : require |
| 3 |
layout(local_size_x = 1) in; |
| 4 |
|
| 5 |
// Foo will be marked packed_float3 because offset of bar is just 12 bytes after foo. |
| 6 |
struct Foo |
| 7 |
{ |
| 8 |
vec3 a; |
| 9 |
}; |
| 10 |
|
| 11 |
// Bar will be marked as packed due to alignment of the struct itself cannot work without packed. |
| 12 |
struct Bar |
| 13 |
{ |
| 14 |
vec3 a; |
| 15 |
}; |
| 16 |
|
| 17 |
layout(scalar, set = 0, binding = 0) buffer SSBOScalar |
| 18 |
{ |
| 19 |
Foo foo; |
| 20 |
Bar bar; |
| 21 |
} buffer_scalar; |
| 22 |
|
| 23 |
void main() |
| 24 |
{ |
| 25 |
buffer_scalar.foo.a.x = 10.0; |
| 26 |
buffer_scalar.bar.a.x = 20.0; |
| 27 |
} |