mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 15:00:57 +01:00
62 lines
2.0 KiB
Rust
62 lines
2.0 KiB
Rust
//! Module processing functionality.
|
|
|
|
mod interface;
|
|
mod typifier;
|
|
mod validator;
|
|
|
|
pub use interface::{Interface, Visitor};
|
|
pub use typifier::{check_constant_type, ResolveContext, ResolveError, Typifier};
|
|
pub use validator::{ValidationError, Validator};
|
|
|
|
impl From<super::StorageFormat> for super::ScalarKind {
|
|
fn from(format: super::StorageFormat) -> Self {
|
|
use super::{ScalarKind as Sk, StorageFormat as Sf};
|
|
match format {
|
|
Sf::R8Unorm => Sk::Float,
|
|
Sf::R8Snorm => Sk::Float,
|
|
Sf::R8Uint => Sk::Uint,
|
|
Sf::R8Sint => Sk::Sint,
|
|
Sf::R16Uint => Sk::Uint,
|
|
Sf::R16Sint => Sk::Sint,
|
|
Sf::R16Float => Sk::Float,
|
|
Sf::Rg8Unorm => Sk::Float,
|
|
Sf::Rg8Snorm => Sk::Float,
|
|
Sf::Rg8Uint => Sk::Uint,
|
|
Sf::Rg8Sint => Sk::Sint,
|
|
Sf::R32Uint => Sk::Uint,
|
|
Sf::R32Sint => Sk::Sint,
|
|
Sf::R32Float => Sk::Float,
|
|
Sf::Rg16Uint => Sk::Uint,
|
|
Sf::Rg16Sint => Sk::Sint,
|
|
Sf::Rg16Float => Sk::Float,
|
|
Sf::Rgba8Unorm => Sk::Float,
|
|
Sf::Rgba8Snorm => Sk::Float,
|
|
Sf::Rgba8Uint => Sk::Uint,
|
|
Sf::Rgba8Sint => Sk::Sint,
|
|
Sf::Rgb10a2Unorm => Sk::Float,
|
|
Sf::Rg11b10Float => Sk::Float,
|
|
Sf::Rg32Uint => Sk::Uint,
|
|
Sf::Rg32Sint => Sk::Sint,
|
|
Sf::Rg32Float => Sk::Float,
|
|
Sf::Rgba16Uint => Sk::Uint,
|
|
Sf::Rgba16Sint => Sk::Sint,
|
|
Sf::Rgba16Float => Sk::Float,
|
|
Sf::Rgba32Uint => Sk::Uint,
|
|
Sf::Rgba32Sint => Sk::Sint,
|
|
Sf::Rgba32Float => Sk::Float,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl crate::TypeInner {
|
|
pub fn scalar_kind(&self) -> Option<super::ScalarKind> {
|
|
match *self {
|
|
super::TypeInner::Scalar { kind, .. } | super::TypeInner::Vector { kind, .. } => {
|
|
Some(kind)
|
|
}
|
|
super::TypeInner::Matrix { .. } => Some(super::ScalarKind::Float),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|