wgsl_bindgen 0.22.1

Type safe Rust bindings workflow for wgsl shaders in wgpu
Documentation
---
source: wgsl_bindgen/src/generate/entry.rs
---
#[derive(Debug)]
pub struct VertexEntry<const N: usize> {
  pub entry_point: &'static str,
  pub buffers: [wgpu::VertexBufferLayout<'static>; N],
  pub constants: Vec<(&'static str, f64)>,
}
pub fn vertex_state<'a, const N: usize>(
  module: &'a wgpu::ShaderModule,
  entry: &'a VertexEntry<N>,
) -> wgpu::VertexState<'a> {
  wgpu::VertexState {
    module,
    entry_point: Some(entry.entry_point),
    buffers: &entry.buffers,
    compilation_options: wgpu::PipelineCompilationOptions {
      constants: &entry.constants,
      ..Default::default()
    },
  }
}
pub fn vs_main_entry() -> VertexEntry<0> {
  VertexEntry {
    entry_point: ENTRY_VS_MAIN,
    buffers: [],
    constants: Default::default(),
  }
}