mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[spv-out] Replace map_dim with a From implementation.
This commit is contained in:
committed by
Dzmitry Malyshau
parent
b35e40ec59
commit
995a7752a9
@@ -919,3 +919,15 @@ impl From<crate::StorageFormat> for spirv::ImageFormat {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::ImageDimension> for spirv::Dim {
|
||||
fn from(dim: crate::ImageDimension) -> Self {
|
||||
use crate::ImageDimension as Id;
|
||||
match dim {
|
||||
Id::D1 => Self::Dim1D,
|
||||
Id::D2 => Self::Dim2D,
|
||||
Id::D3 => Self::Dim3D,
|
||||
Id::Cube => Self::DimCube,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,15 +153,6 @@ impl Function {
|
||||
}
|
||||
}
|
||||
|
||||
fn map_dim(dim: crate::ImageDimension) -> spirv::Dim {
|
||||
match dim {
|
||||
crate::ImageDimension::D1 => spirv::Dim::Dim1D,
|
||||
crate::ImageDimension::D2 => spirv::Dim::Dim2D,
|
||||
crate::ImageDimension::D3 => spirv::Dim::Dim3D,
|
||||
crate::ImageDimension::Cube => spirv::Dim::DimCube,
|
||||
}
|
||||
}
|
||||
|
||||
/// Characteristics of a SPIR-V `OpTypeImage` type.
|
||||
///
|
||||
/// SPIR-V requires non-composite types to be unique, including images. Since we
|
||||
@@ -198,7 +189,7 @@ impl LocalImageType {
|
||||
flags
|
||||
};
|
||||
|
||||
let dim = map_dim(dim);
|
||||
let dim = spirv::Dim::from(dim);
|
||||
|
||||
match class {
|
||||
crate::ImageClass::Sampled { kind, multi } => LocalImageType {
|
||||
|
||||
Reference in New Issue
Block a user