Browse Source

minor improvements

master
Alison Watson 11 months ago
parent
commit
ebfdb3833b
  1. 15
      fw/data/shader.rs
  2. 2
      fw/hal/evt.rs

15
fw/data/shader.rs

@ -1,7 +1,5 @@
//! SPIR-V shaders.
use ash::vk;
bitflags::bitflags! {
/// A flag set of shader stages.
pub struct ShaderStage: u8 {
@ -22,7 +20,7 @@ pub struct Module {
/// The error type which is returned from reading a shader program.
#[derive(thiserror::Error, Debug)]
pub enum Err {
#[error("{}", err.emit_to_string(&src))]
#[error("{}", err.emit_to_string(src))]
Parse { err: naga::front::wgsl::ParseError, src: String },
#[error(transparent)]
Validate(#[from] naga::valid::ValidationError),
@ -51,14 +49,15 @@ impl Module {
let modu = naga::front::wgsl::parse_str(source)
.map_err(|err| Err::Parse { err, src: source.to_owned() })?;
let mut stag = ShaderStage::empty();
for entry in &modu.entry_points {
stag |= match entry.stage {
let stag = modu
.entry_points
.iter()
.map(|entry| match entry.stage {
| naga::ShaderStage::Vertex => ShaderStage::VERTEX,
| naga::ShaderStage::Fragment => ShaderStage::FRAGMENT,
| naga::ShaderStage::Compute => ShaderStage::COMPUTE,
};
}
})
.collect();
let mut vali = naga::valid::Validator::new(
naga::valid::ValidationFlags::all(),

2
fw/hal/evt.rs

@ -11,7 +11,7 @@ pub struct EventIterator<'a> {
}
impl<'a> EventIterator<'a> {
pub fn new(_hal: &'a ctx::Context) -> Self {
pub const fn new(_hal: &'a ctx::Context) -> Self {
Self { hal: PhantomData }
}
}

Loading…
Cancel
Save