#version 450 | |
#extension GL_EXT_scalar_block_layout : require | |
layout(local_size_x = 1) in; | |
// Foo will be marked packed_float3 because offset of bar is just 12 bytes after foo. | |
struct Foo | |
{ | |
vec3 a; | |
}; | |
// Bar will be marked as packed due to alignment of the struct itself cannot work without packed. | |
struct Bar | |
{ | |
vec3 a; | |
}; | |
layout(scalar, set = 0, binding = 0) buffer SSBOScalar | |
{ | |
Foo foo; | |
Bar bar; | |
} buffer_scalar; | |
void main() | |
{ | |
buffer_scalar.foo.a.x = 10.0; | |
buffer_scalar.bar.a.x = 20.0; | |
} |