glsl: add helper for calculating offsets for struct members