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

Open
opened 2025-01-11 09:48:54 +00:00 by XI2vGMst · 0 comments
XI2vGMst commented 2025-01-11 09:48:54 +00:00 (Migrated from github.com)

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
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
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#1335
No description provided.