wgsl_to_wgpu
wgsl_to_wgpu copied to clipboard
support wgpu vertex formats
These types should all be usable with vertex input structs for WGSL. The test cases in lib.rs for writing the vertex module should cover all of the supported types. https://docs.rs/wgpu/latest/wgpu/enum.VertexFormat.html
- [x] wgpu_types::VertexFormat::Uint8x2
- [x] wgpu_types::VertexFormat::Uint8x4
- [x] wgpu_types::VertexFormat::Sint8x2
- [x] wgpu_types::VertexFormat::Sint8x4
- [ ] wgpu_types::VertexFormat::Unorm8x2
- [ ] wgpu_types::VertexFormat::Unorm8x4
- [ ] wgpu_types::VertexFormat::Snorm8x2
- [ ] wgpu_types::VertexFormat::Snorm8x4
- [x] wgpu_types::VertexFormat::Uint16x2
- [x] wgpu_types::VertexFormat::Uint16x4
- [x] wgpu_types::VertexFormat::Sint16x2
- [x] wgpu_types::VertexFormat::Sint16x4
- [ ] wgpu_types::VertexFormat::Unorm16x2
- [ ] wgpu_types::VertexFormat::Unorm16x4
- [ ] wgpu_types::VertexFormat::Snorm16x2
- [ ] wgpu_types::VertexFormat::Snorm16x4
- [x] wgpu_types::VertexFormat::Float16
- [x] wgpu_types::VertexFormat::Float16x2
- [x] wgpu_types::VertexFormat::Float16x4
- [x] wgpu_types::VertexFormat::Float32
- [x] wgpu_types::VertexFormat::Float32x2
- [x] wgpu_types::VertexFormat::Float32x3
- [x] wgpu_types::VertexFormat::Float32x4
- [x] wgpu_types::VertexFormat::Uint32
- [x] wgpu_types::VertexFormat::Uint32x2
- [x] wgpu_types::VertexFormat::Uint32x3
- [x] wgpu_types::VertexFormat::Uint32x4
- [x] wgpu_types::VertexFormat::Sint32
- [x] wgpu_types::VertexFormat::Sint32x2
- [x] wgpu_types::VertexFormat::Sint32x3
- [x] wgpu_types::VertexFormat::Sint32x4
- [x] wgpu_types::VertexFormat::Float64
- [x] wgpu_types::VertexFormat::Float64x2
- [x] wgpu_types::VertexFormat::Float64x3
- [x] wgpu_types::VertexFormat::Float64x4
Signed and unsigned normalized types use floating point in WGSL like vec2<f32>. This makes it impossible to detect if data should use unorm, snorm, or float purely based on WGSL. It should be documented that users should define their own attribute array using the WGPU macro in those cases.
Half precision formats could be supported using u16 on the Rust side or optionally with the half crate.