Inline a few things

This commit is contained in:
SeanOMik 2024-03-08 11:07:02 -05:00
parent cf3f70dbb9
commit 88cda91657
Signed by: SeanOMik
GPG Key ID: FEC9E2FC15235964
2 changed files with 7 additions and 0 deletions

View File

@ -307,6 +307,7 @@ impl RenderTexture {
} }
/// Convert [`lyra_resource::WrappingMode`] to [`wgpu::AddressMode`] /// Convert [`lyra_resource::WrappingMode`] to [`wgpu::AddressMode`]
#[inline(always)]
fn res_wrap_to_wgpu(wmode: WrappingMode) -> wgpu::AddressMode { fn res_wrap_to_wgpu(wmode: WrappingMode) -> wgpu::AddressMode {
match wmode { match wmode {
WrappingMode::ClampToEdge => wgpu::AddressMode::ClampToEdge, WrappingMode::ClampToEdge => wgpu::AddressMode::ClampToEdge,
@ -316,6 +317,7 @@ fn res_wrap_to_wgpu(wmode: WrappingMode) -> wgpu::AddressMode {
} }
/// Convert [`lyra_resource::FilterMode`] to [`wgpu::FilterMode`] /// Convert [`lyra_resource::FilterMode`] to [`wgpu::FilterMode`]
#[inline(always)]
fn res_filter_to_wgpu(fmode: FilterMode) -> wgpu::FilterMode { fn res_filter_to_wgpu(fmode: FilterMode) -> wgpu::FilterMode {
match fmode { match fmode {
FilterMode::Nearest => wgpu::FilterMode::Nearest, FilterMode::Nearest => wgpu::FilterMode::Nearest,

View File

@ -319,6 +319,7 @@ impl Material {
} }
impl From<gltf::texture::MagFilter> for FilterMode { impl From<gltf::texture::MagFilter> for FilterMode {
#[inline(always)]
fn from(value: gltf::texture::MagFilter) -> Self { fn from(value: gltf::texture::MagFilter) -> Self {
match value { match value {
gltf::texture::MagFilter::Nearest => Self::Nearest, gltf::texture::MagFilter::Nearest => Self::Nearest,
@ -329,6 +330,7 @@ impl From<gltf::texture::MagFilter> for FilterMode {
impl FilterMode { impl FilterMode {
/// Get the MinFilter mode and the mipmap filter mode from gltf MinFilter /// Get the MinFilter mode and the mipmap filter mode from gltf MinFilter
#[inline(always)]
pub fn from_min_filter(minf: MinFilter) -> FilterMode { pub fn from_min_filter(minf: MinFilter) -> FilterMode {
match minf { match minf {
MinFilter::Nearest => FilterMode::Nearest, MinFilter::Nearest => FilterMode::Nearest,
@ -340,6 +342,7 @@ impl FilterMode {
} }
} }
#[inline(always)]
pub fn from_mag_filter(magf: MagFilter) -> FilterMode { pub fn from_mag_filter(magf: MagFilter) -> FilterMode {
match magf { match magf {
MagFilter::Nearest => FilterMode::Nearest, MagFilter::Nearest => FilterMode::Nearest,
@ -347,6 +350,7 @@ impl FilterMode {
} }
} }
#[inline(always)]
pub fn mipmap_filter(minf: MinFilter) -> Option<FilterMode> { pub fn mipmap_filter(minf: MinFilter) -> Option<FilterMode> {
match minf { match minf {
MinFilter::Nearest => None, MinFilter::Nearest => None,
@ -360,6 +364,7 @@ impl FilterMode {
} }
impl From<gltf::texture::WrappingMode> for WrappingMode { impl From<gltf::texture::WrappingMode> for WrappingMode {
#[inline(always)]
fn from(value: gltf::texture::WrappingMode) -> Self { fn from(value: gltf::texture::WrappingMode) -> Self {
match value { match value {
gltf::texture::WrappingMode::ClampToEdge => Self::ClampToEdge, gltf::texture::WrappingMode::ClampToEdge => Self::ClampToEdge,