spirv-struct-layout 0.1.2

Check that the layout of a rust struct matches the layout of a given type in SPIRV
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#version 450 core

layout(std430, binding = 0) buffer Uniforms {
  mat4 model_view;
  vec3 light_dir;
  vec4 position;
} buf;

layout(location = 0) out vec4 outColor;

void main() {
    vec4 p = buf.model_view * buf.position;
    float d = dot(p.xyz, buf.light_dir);
    if (d < 0.0) {
      d = -d;
    }
    outColor = vec4(vec3(d), 1.0);
}