mach icon indicating copy to clipboard operation
mach copied to clipboard

examples/custom-renderer: Uniforms are declared differently in Renderer.zig and shader.wgsl

Open XI2vGMst opened this issue 1 year ago • 0 comments

In practice this doesn't make a difference, as the struct alignment of 16 which happens to be correct saves us here. This can be very confusing to newcomers, though, as it is unclear which is the correct option and why this decision was made.

https://github.com/hexops/mach/blob/main/examples/custom-renderer/shader.wgsl#L2-L5 https://github.com/hexops/mach/blob/main/examples/custom-renderer/Renderer.zig#L18-L21

Fix Idea

  • Change field names to be identical
  • Change field types to be identical
  • (Optional) Add align(16) for all fields in the Zig struct

XI2vGMst avatar Jan 11 '25 09:01 XI2vGMst