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