librashader/librashader-runtime-mtl/src/lib.rs

38 lines
980 B
Rust
Raw Normal View History

//! librashader Metal runtime
//!
//! This crate should not be used directly.
//! See [`librashader::runtime::mtl`](https://docs.rs/librashader/latest/aarch64-apple-darwin/librashader/runtime/mtl/index.html) instead.
2024-02-12 10:01:00 +11:00
#![cfg(target_vendor = "apple")]
#![cfg_attr(not(feature = "stable"), feature(type_alias_impl_trait))]
mod buffer;
mod draw_quad;
mod filter_chain;
mod filter_pass;
mod graphics_pipeline;
mod luts;
2024-02-10 16:04:16 +11:00
mod samplers;
mod texture;
pub use filter_chain::FilterChainMetal;
use objc2_metal::MTLPixelFormat;
pub mod error;
pub mod options;
use librashader_runtime::impl_filter_chain_parameters;
impl_filter_chain_parameters!(FilterChainMetal);
2024-02-13 19:03:45 +11:00
pub use texture::MetalTextureRef;
fn select_optimal_pixel_format(format: MTLPixelFormat) -> MTLPixelFormat {
if format == MTLPixelFormat::RGBA8Unorm {
return MTLPixelFormat::BGRA8Unorm;
}
if format == MTLPixelFormat::RGBA8Unorm_sRGB {
return MTLPixelFormat::BGRA8Unorm_sRGB;
}
format
}