Skip to content

Commit

Permalink
fix some metal compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Vecvec committed Jan 23, 2024
1 parent 6bc94f4 commit eb4396f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions wgpu-hal/src/metal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,20 @@ struct MultiStageData<T> {
vs: T,
fs: T,
cs: T,
rgs: T,
rc_hit_s: T,
ra_hit_s: T,
r_miss_s: T,
}

const NAGA_STAGES: MultiStageData<naga::ShaderStage> = MultiStageData {
vs: naga::ShaderStage::Vertex,
fs: naga::ShaderStage::Fragment,
cs: naga::ShaderStage::Compute,
rgs: naga::ShaderStage::RayGeneration,
rc_hit_s: naga::ShaderStage::ClosestHit,
ra_hit_s: naga::ShaderStage::AnyHit,
r_miss_s: naga::ShaderStage::Miss,
};

impl<T> ops::Index<naga::ShaderStage> for MultiStageData<T> {
Expand All @@ -533,6 +541,10 @@ impl<T> ops::Index<naga::ShaderStage> for MultiStageData<T> {
naga::ShaderStage::Vertex => &self.vs,
naga::ShaderStage::Fragment => &self.fs,
naga::ShaderStage::Compute => &self.cs,
naga::ShaderStage::RayGeneration => &self.rgs,
naga::ShaderStage::ClosestHit => &self.rc_hit_s,
naga::ShaderStage::AnyHit => &self.ra_hit_s,
naga::ShaderStage::Miss => &self.r_miss_s,
}
}
}
Expand All @@ -543,13 +555,21 @@ impl<T> MultiStageData<T> {
vs: fun(&self.vs),
fs: fun(&self.fs),
cs: fun(&self.cs),
rgs: fun(&self.rgs),
rc_hit_s: fun(&self.rc_hit_s),
ra_hit_s: fun(&self.ra_hit_s),
r_miss_s: fun(&self.r_miss_s),
}
}
fn map<Y>(self, fun: impl Fn(T) -> Y) -> MultiStageData<Y> {
MultiStageData {
vs: fun(self.vs),
fs: fun(self.fs),
cs: fun(self.cs),
rgs: fun(self.rgs),
rc_hit_s: fun(self.rc_hit_s),
ra_hit_s: fun(self.ra_hit_s),
r_miss_s: fun(self.r_miss_s),
}
}
fn iter<'a>(&'a self) -> impl Iterator<Item = &'a T> {
Expand Down

0 comments on commit eb4396f

Please sign in to comment.