docs: update capi docs
This commit is contained in:
parent
b348e8591f
commit
4247e64336
8 changed files with 31 additions and 17 deletions
|
@ -48,7 +48,7 @@ linkage parameters are correct in order to successfully link with `librashader.l
|
|||
The [corrosion](https://github.com/corrosion-rs/) CMake package is highly recommended.
|
||||
|
||||
### Thread safety
|
||||
Except for the Metsl runtime, in general, it is **safe** to create a filter chain instance from a different thread, but drawing frames requires
|
||||
Except for the Metal runtime, in general, it is **safe** to create a filter chain instance from a different thread, but drawing frames requires
|
||||
**external synchronization** of the filter chain object.
|
||||
|
||||
Filter chains can be created from any thread, but requires external synchronization of the graphics device queue where applicable
|
||||
|
|
|
@ -463,7 +463,7 @@ typedef struct _filter_chain_mtl *libra_mtl_filter_chain_t;
|
|||
#endif
|
||||
|
||||
#if (defined(__APPLE__) && defined(LIBRA_RUNTIME_METAL) && defined(__OBJC__))
|
||||
/// Options for each Vulkan shader frame.
|
||||
/// Options for each Metal shader frame.
|
||||
typedef struct frame_mtl_opt_t {
|
||||
/// The librashader API version.
|
||||
LIBRASHADER_API_VERSION version;
|
||||
|
@ -1746,7 +1746,7 @@ libra_error_t libra_mtl_filter_chain_get_active_pass_count(
|
|||
#endif
|
||||
|
||||
#if (defined(__APPLE__) && defined(LIBRA_RUNTIME_METAL) && defined(__OBJC__))
|
||||
/// Free a Vulkan filter chain.
|
||||
/// Free a Metal filter chain.
|
||||
///
|
||||
/// The resulting value in `chain` then becomes null.
|
||||
/// ## Safety
|
||||
|
@ -1835,6 +1835,7 @@ libra_error_t libra_preset_ctx_set_param(libra_preset_ctx_t *context,
|
|||
/// - GLCore
|
||||
/// - Direct3D11
|
||||
/// - Direct3D12
|
||||
/// - Metal
|
||||
///
|
||||
/// This will also set the appropriate video driver extensions.
|
||||
///
|
||||
|
|
|
@ -52,5 +52,11 @@ icrate = { version = "0.1.0" , features = [ "Metal", "Metal_all" ], optional = t
|
|||
objc2 = { version = "0.5.0", features = ["apple"] , optional = true }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "aarch64-apple-darwin", "aarch64-apple-ios"]
|
||||
targets = [ "x86_64-pc-windows-msvc",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-apple-darwin",
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-apple-ios",
|
||||
"i686-pc-windows-msvc",
|
||||
"i686-unknown-linux-gnu", ]
|
||||
features = ["librashader/docsrs"]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! possible by linking against `librashader.h` as well as any static libraries used by `librashader`.
|
||||
//!
|
||||
//! ## Usage
|
||||
//! ⚠ Rust consumers use [librashader](https://docs.rs/librashader/) directly instead. ⚠
|
||||
//! ⚠ Rust consumers should use [librashader](https://docs.rs/librashader/) directly instead. ⚠
|
||||
//!
|
||||
//! The librashader C API is designed to be easy to use and safe. Most objects are only accessible behind an opaque pointer.
|
||||
//! Every allocated object can be freed with a corresponding `free` function **for that specific object type**.
|
||||
|
@ -54,11 +54,11 @@
|
|||
//!
|
||||
//! ## Thread safety
|
||||
//!
|
||||
//! In general, it is **safe** to create a filter chain instance from a different thread, but drawing filter passes must be
|
||||
//! synchronized externally. The exception to filter chain creation are in OpenGL, where creating the filter chain instance
|
||||
//! is safe **if and only if** the thread local OpenGL context is initialized to the same context as the drawing thread, and
|
||||
//! in Direct3D 11, where filter chain creation is unsafe if the `ID3D11Device` was created with
|
||||
//! `D3D11_CREATE_DEVICE_SINGLETHREADED`.
|
||||
//! Except for the metal runtime, it is in general, **safe** to create a filter chain instance from a different thread,
|
||||
//! but drawing filter passes must be synchronized externally. The exception to filter chain creation are in OpenGL,
|
||||
//! where creating the filter chain instance is safe **if and only if** the thread local OpenGL context is initialized
|
||||
//! to the same context as the drawing thread, and in Direct3D 11, where filter chain creation is unsafe
|
||||
//! if the `ID3D11Device` was created with `D3D11_CREATE_DEVICE_SINGLETHREADED`. Metal is entirely thread unsafe.
|
||||
//!
|
||||
//! You must ensure that only thread has access to a created filter pass **before** you call `*_frame`. `*_frame` may only be
|
||||
//! called from one thread at a time.
|
||||
|
|
|
@ -20,14 +20,17 @@ use objc2::runtime::ProtocolObject;
|
|||
|
||||
use crate::LIBRASHADER_API_VERSION;
|
||||
|
||||
/// An alias to a `id<MTLCommandQueue>` protocol object pointer.
|
||||
pub type PMTLCommandQueue = *const ProtocolObject<dyn MTLCommandQueue>;
|
||||
|
||||
/// An alias to a `id<MTLCommandBuffer>` protocol object pointer.
|
||||
pub type PMTLCommandBuffer = *const ProtocolObject<dyn MTLCommandBuffer>;
|
||||
|
||||
/// An alias to a `id<MTLTexture>` protocol object pointer.
|
||||
pub type PMTLTexture = *const ProtocolObject<dyn MTLTexture>;
|
||||
|
||||
|
||||
/// Options for each Vulkan shader frame.
|
||||
/// Options for each Metal shader frame.
|
||||
#[repr(C)]
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct frame_mtl_opt_t {
|
||||
|
@ -301,7 +304,7 @@ extern_fn! {
|
|||
}
|
||||
|
||||
extern_fn! {
|
||||
/// Free a Vulkan filter chain.
|
||||
/// Free a Metal filter chain.
|
||||
///
|
||||
/// The resulting value in `chain` then becomes null.
|
||||
/// ## Safety
|
||||
|
|
|
@ -3,8 +3,6 @@ use glslang::{CompilerOptions, ShaderInput};
|
|||
use librashader_preprocess::ShaderSource;
|
||||
|
||||
use crate::front::{ShaderInputCompiler, SpirvCompilation};
|
||||
#[cfg(feature = "serialize")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// glslang compiler
|
||||
pub struct Glslang;
|
||||
|
|
|
@ -74,6 +74,12 @@ full = ["runtime-all", "reflect-all", "preprocess", "presets"]
|
|||
docsrs = ["librashader-cache/docsrs", "objc2/unstable-docsrs"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "aarch64-apple-darwin", "aarch64-apple-ios"]
|
||||
targets = [ "x86_64-pc-windows-msvc",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-apple-darwin",
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-apple-ios",
|
||||
"i686-pc-windows-msvc",
|
||||
"i686-unknown-linux-gnu", ]
|
||||
features = ["docsrs"]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
|
|
|
@ -283,7 +283,7 @@ pub mod runtime {
|
|||
|
||||
#[cfg(all(target_vendor = "apple", feature = "runtime-metal"))]
|
||||
#[doc(cfg(all(target_vendor = "apple", feature = "runtime-metal")))]
|
||||
/// Shader runtime for Metal
|
||||
/// Shader runtime for Metal.
|
||||
pub mod mtl {
|
||||
pub use librashader_runtime_mtl::{
|
||||
error,
|
||||
|
@ -296,7 +296,7 @@ pub mod runtime {
|
|||
|
||||
#[cfg(feature = "runtime-wgpu")]
|
||||
#[doc(cfg(feature = "runtime-wgpu"))]
|
||||
/// Shader runtime for wgpu
|
||||
/// Shader runtime for wgpu.
|
||||
#[cfg_attr(all(feature = "runtime-wgpu", all(target_vendor = "apple", feature = "docsrs")),
|
||||
doc = "\n\nThe wgpu runtime is available on macOS and iOS, but technical reasons prevent them from rendering on docs.rs.
|
||||
\n\n This is because wgpu on macOS and iOS link to [metal-rs](https://github.com/gfx-rs/metal-rs), which can not build on docs.rs.
|
||||
|
|
Loading…
Add table
Reference in a new issue