I have this structure
#[repr(C)]
#[derive(Debug, Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
struct ProjUniform {
view_proj: [[f32; 3]; 3],
}
impl ProjUniform {
fn new() -> Self {
Self {
view_proj: [[0.0, 0.0, 0.0],
[1.0, 1.0, 0.5],
[0.0, 0.0, 1.0],
]
}
}
}
I pass to gpu like this:
let proj_uniform = ProjUniform::new();
let proj_buffer = device.create_buffer_init(
&wgpu::util::BufferInitDescriptor {
label: Some("Proj Buffer"),
contents: bytemuck::cast_slice(&[proj_uniform]),
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST
});
Now I've debugged this, and I don't get the correct mat3 structure in the shader. it is off and twisted. How do I debug this thing?
This is shader code:
[[block]]
struct ProjectUniform {
view_proj: mat3x3<f32>;
};
[[group(1), binding(0)]]
var<uniform> project: ProjectUniform;