2024-09-15 01:55:14 -04:00
|
|
|
//! 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-11 18:01:00 -05:00
|
|
|
#![cfg(target_vendor = "apple")]
|
2024-09-15 01:55:14 -04:00
|
|
|
#![cfg_attr(not(feature = "stable"), feature(type_alias_impl_trait))]
|
2024-02-11 20:38:55 -05:00
|
|
|
|
2024-02-11 17:54:13 -05:00
|
|
|
mod buffer;
|
2024-02-10 20:59:01 -05:00
|
|
|
mod draw_quad;
|
2024-02-11 17:54:13 -05:00
|
|
|
mod filter_chain;
|
|
|
|
mod filter_pass;
|
2024-02-10 20:59:01 -05:00
|
|
|
mod graphics_pipeline;
|
2024-02-11 17:54:13 -05:00
|
|
|
mod luts;
|
2024-02-10 00:04:16 -05:00
|
|
|
mod samplers;
|
2024-02-11 17:54:13 -05:00
|
|
|
mod texture;
|
2024-02-11 20:38:55 -05:00
|
|
|
|
|
|
|
pub use filter_chain::FilterChainMetal;
|
2024-06-21 20:50:35 -04:00
|
|
|
use objc2_metal::MTLPixelFormat;
|
2024-02-11 20:38:55 -05:00
|
|
|
|
|
|
|
pub mod error;
|
|
|
|
pub mod options;
|
|
|
|
use librashader_runtime::impl_filter_chain_parameters;
|
|
|
|
impl_filter_chain_parameters!(FilterChainMetal);
|
2024-02-12 19:43:28 -05:00
|
|
|
|
2024-02-13 03:03:45 -05:00
|
|
|
pub use texture::MetalTextureRef;
|
2024-02-12 23:41:18 -05:00
|
|
|
|
2024-02-12 19:43:28 -05:00
|
|
|
fn select_optimal_pixel_format(format: MTLPixelFormat) -> MTLPixelFormat {
|
2024-06-21 20:50:35 -04:00
|
|
|
if format == MTLPixelFormat::RGBA8Unorm {
|
|
|
|
return MTLPixelFormat::BGRA8Unorm;
|
2024-02-12 19:43:28 -05:00
|
|
|
}
|
|
|
|
|
2024-06-21 20:50:35 -04:00
|
|
|
if format == MTLPixelFormat::RGBA8Unorm_sRGB {
|
|
|
|
return MTLPixelFormat::BGRA8Unorm_sRGB;
|
2024-02-12 19:43:28 -05:00
|
|
|
}
|
2024-09-09 03:00:26 -04:00
|
|
|
format
|
2024-02-12 19:43:28 -05:00
|
|
|
}
|