doc: document naga reflect

This commit is contained in:
chyyran 2024-08-09 00:29:04 -04:00 committed by Ronny Chan
parent 3b9514ad38
commit 977975f4c7
4 changed files with 18 additions and 6 deletions

View file

@ -40,12 +40,9 @@
//! ``` //! ```
//! //!
//! ## What's with all the traits? //! ## What's with all the traits?
//! librashader-reflect is designed to be compiler-agnostic. In the future, we will allow usage of //! librashader-reflect is designed to be compiler-agnostic. [naga](https://docs.rs/naga/latest/naga/index.html),
//! [naga](https://docs.rs/naga/latest/naga/index.html), a pure-Rust shader compiler, when it has //! a pure-Rust shader compiler, as well as SPIRV-Cross via [SpirvCompilation](crate::front::SpirvCompilation)
//! matured enough to support [the features librashader needs](https://github.com/gfx-rs/naga/issues/1012). //! is supported.
//!
//! In the meanwhile, the only supported compilation type is [GlslangCompilation](crate::front::SpirvCompilation),
//! which does transpilation via [glslang](https://github.com/KhronosGroup/glslang) and [SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross).
#![feature(impl_trait_in_assoc_type)] #![feature(impl_trait_in_assoc_type)]
#![feature(let_chains)] #![feature(let_chains)]

View file

@ -1,5 +1,10 @@
#[doc(hidden)]
pub mod glsl; pub mod glsl;
#[doc(hidden)]
pub mod hlsl; pub mod hlsl;
#[doc(hidden)]
pub mod msl; pub mod msl;
use crate::error::{SemanticsErrorKind, ShaderReflectError}; use crate::error::{SemanticsErrorKind, ShaderReflectError};
@ -20,6 +25,8 @@ use spirv_cross::ErrorCode;
use crate::reflect::helper::{SemanticErrorBlame, TextureData, UboData}; use crate::reflect::helper::{SemanticErrorBlame, TextureData, UboData};
/// Reflect shaders under SPIRV-Cross semantics. /// Reflect shaders under SPIRV-Cross semantics.
///
/// SPIRV-Cross supports GLSL, HLSL, SPIR-V, and MSL targets.
#[derive(Debug)] #[derive(Debug)]
pub struct SpirvCross; pub struct SpirvCross;

View file

@ -12,6 +12,7 @@ pub mod presets;
mod helper; mod helper;
/// Reflection via naga.
#[cfg(feature = "naga")] #[cfg(feature = "naga")]
pub mod naga; pub mod naga;

View file

@ -1,5 +1,10 @@
#[doc(hidden)]
pub mod msl; pub mod msl;
#[doc(hidden)]
pub mod spirv; pub mod spirv;
#[doc(hidden)]
pub mod wgsl; pub mod wgsl;
use crate::error::{SemanticsErrorKind, ShaderReflectError}; use crate::error::{SemanticsErrorKind, ShaderReflectError};
@ -28,6 +33,8 @@ use crate::reflect::{align_uniform_size, ReflectShader, ShaderReflection};
/// ///
/// The Naga reflector will lower combined image samplers to split, /// The Naga reflector will lower combined image samplers to split,
/// with the same bind point on descriptor group 1. /// with the same bind point on descriptor group 1.
///
/// Naga supports WGSL, SPIR-V, and MSL targets.
#[derive(Debug)] #[derive(Debug)]
pub struct Naga; pub struct Naga;
#[derive(Debug)] #[derive(Debug)]