lowenware / dotrix

A 3D engine with ECS and Vulkan renderer for Rust developers
https://dotrix.rs
MIT License
292 stars 11 forks source link

Light example fails #128

Closed QuantumEntangledAndy closed 2 years ago

QuantumEntangledAndy commented 2 years ago

I can not run the lights example code

Your recent commit of Fix Material Uniform alignment, gives me issues of

Buffer is bound with size 32 where the shader expects 48 in group[1] compact index 1

I believe that this is because you have defined it as

struct Material {
    albedo: vec4<f32>;
    has_texture: u32;
    reserve: vec3<u32>;
};
[[group(1), binding(1)]]
var<uniform> u_material: Material;

However I believe it should be

struct Material {
    albedo: vec4<f32>;
    has_texture: u32;
};
[[group(1), binding(1)]]
var<uniform> u_material: Material;

From my experience you do not add padding to the wgsl size directly only in the data we pass to it. If you add the padding to make it 32bytes then the binding will expect 48 if you then add padding up to 48 it will expect it's size to be 64

voxelias commented 2 years ago

This was fixed by #129