Closed KoT3isGood closed 1 day ago
This is becuase the vec3
is being aligned to a multiple of 16 bytes, which is the next higher power of 2 from its size. If you want to align the vec3
with the same alignment as a scalar float
, you can use the GL_EXT_scalar_block_layout
extension and declare your block with layout(push_constant, scalar) uniform constants
, which will result in color
being assigned an offset of 20.
By default "Vulkan" GLSL uses std430 alignment rules for push constant buffers.
Each uint and float are 4 bytes
And so this push constant size is 32
Each vec3 is made from 3 floating points, so its size should be 12 bytes But when I replace r,g,b with vec3
Push constant size becomes 44 (according to Vulkan)