const_shader_layout 0.2.0

Compile-time checks for whether structs conform to WGSL's memory layout rules
Documentation

Compile-time checks for whether structs conform to WGSL's memory layout rules.

Build License Cargo Documentation

The core of this crate is the [shader_layout] macro and the [ShaderLayout] trait.

use const_shader_layout::shader_layout;
use glam::Vec3;

shader_layout! {
    pub struct MyUniform {
        a1: f32,
        a2: [f32; 2],
        a3: [f32; 1],
        a4: Vec3,
        a5: f32
    }
}

See https://github.com/beicause/const_shader_layout/tree/master/tests for what this supports and checks.

Note: Uniform address space layout constraints is not checked yet.