#![forbid(missing_docs)]
#![cfg_attr(feature = "docsrs", feature(doc_cfg))]
pub use librashader_common::map::FastHashMap;
pub use librashader_common::map::ShortString;
#[cfg(feature = "presets")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "presets")))]
pub mod presets {
use librashader_preprocess::{PreprocessError, ShaderParameter, ShaderSource};
pub use librashader_presets::*;
pub use librashader_pack::*;
pub fn get_parameter_meta(
preset: &ShaderPreset,
) -> Result<impl Iterator<Item = ShaderParameter>, PreprocessError> {
let iters: Result<Vec<Vec<ShaderParameter>>, PreprocessError> = preset
.passes
.iter()
.map(|s| {
ShaderSource::load(&s.path, preset.features)
.map(|s| s.parameters.into_iter().map(|(_, v)| v).collect())
})
.collect();
let iters = iters?;
Ok(iters.into_iter().flatten())
}
}
#[cfg(feature = "preprocess")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "preprocess")))]
pub mod preprocess {
pub use librashader_preprocess::*;
}
#[cfg(feature = "reflect")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "reflect")))]
pub mod reflect {
pub mod targets {
pub use librashader_reflect::back::targets::DXIL;
pub use librashader_reflect::back::targets::GLSL;
pub use librashader_reflect::back::targets::HLSL;
pub use librashader_reflect::back::targets::MSL;
pub use librashader_reflect::back::targets::SPIRV;
pub use librashader_reflect::back::targets::WGSL;
}
pub use librashader_reflect::error::*;
pub use librashader_reflect::reflect::{semantics, ReflectShader, ShaderReflection};
pub use librashader_reflect::back::{
targets::OutputTarget, CompileReflectShader, CompileShader, CompilerBackend,
FromCompilation, ShaderCompilerOutput,
};
pub use librashader_reflect::front::{ShaderReflectObject, SpirvCompilation};
#[cfg(feature = "reflect-cross")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "reflect-cross")))]
pub mod cross {
pub use librashader_reflect::reflect::cross::SpirvCross;
pub use librashader_reflect::back::glsl::GlslVersion;
pub use librashader_reflect::back::hlsl::HlslShaderModel;
pub use librashader_reflect::back::msl::MslVersion;
pub use librashader_reflect::back::glsl::CrossGlslContext;
pub use librashader_reflect::back::hlsl::CrossHlslContext;
pub use librashader_reflect::back::msl::CrossMslContext;
pub use librashader_reflect::reflect::cross::CompiledProgram;
}
#[cfg(all(target_os = "windows", feature = "reflect-dxil"))]
#[cfg_attr(
feature = "docsrs",
doc(cfg(all(target_os = "windows", feature = "reflect-dxil")))
)]
pub mod dxil {
pub use librashader_reflect::back::dxil::ShaderModel;
pub use librashader_reflect::back::dxil::DxilObject;
}
#[cfg(feature = "reflect-naga")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "reflect-naga")))]
pub mod naga {
pub use librashader_reflect::back::wgsl::NagaWgslContext;
pub use librashader_reflect::reflect::naga::Naga;
pub use librashader_reflect::reflect::naga::NagaLoweringOptions;
}
pub use librashader_reflect::reflect::semantics::BindingMeta;
pub use librashader_reflect::reflect::presets::{CompilePresetTarget, ShaderPassArtifact};
pub use librashader_reflect::front::ShaderInputCompiler;
#[doc(hidden)]
#[cfg(feature = "internal")]
pub mod helper {
pub use librashader_runtime::image;
}
}
#[cfg(feature = "runtime")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "runtime")))]
pub mod runtime {
pub use librashader_common::{Size, Viewport};
pub use librashader_runtime::parameters::FilterChainParameters;
pub use librashader_runtime::parameters::RuntimeParameters;
#[cfg(feature = "runtime-gl")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "runtime-gl")))]
pub mod gl {
pub use librashader_runtime_gl::{
error,
options::{FilterChainOptionsGL as FilterChainOptions, FrameOptionsGL as FrameOptions},
FilterChainGL as FilterChain, GLImage,
};
}
#[cfg(all(target_os = "windows", feature = "runtime-d3d11"))]
#[cfg_attr(
feature = "docsrs",
doc(cfg(all(target_os = "windows", feature = "runtime-d3d11")))
)]
pub mod d3d11 {
pub use librashader_runtime_d3d11::{
error,
options::{
FilterChainOptionsD3D11 as FilterChainOptions, FrameOptionsD3D11 as FrameOptions,
},
FilterChainD3D11 as FilterChain,
};
}
#[cfg(all(target_os = "windows", feature = "runtime-d3d12"))]
#[cfg_attr(
feature = "docsrs",
doc(cfg(all(target_os = "windows", feature = "runtime-d3d12")))
)]
pub mod d3d12 {
pub use librashader_runtime_d3d12::{
error,
options::{
FilterChainOptionsD3D12 as FilterChainOptions, FrameOptionsD3D12 as FrameOptions,
},
D3D12InputImage, D3D12OutputView, FilterChainD3D12 as FilterChain,
};
}
#[cfg(all(target_os = "windows", feature = "runtime-d3d9"))]
#[cfg_attr(
feature = "docsrs",
doc(cfg(all(target_os = "windows", feature = "runtime-d3d9")))
)]
pub mod d3d9 {
pub use librashader_runtime_d3d9::{
error,
options::{
FilterChainOptionsD3D9 as FilterChainOptions, FrameOptionsD3D9 as FrameOptions,
},
FilterChainD3D9 as FilterChain,
};
}
#[cfg(feature = "runtime-vk")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "runtime-vk")))]
pub mod vk {
pub use librashader_runtime_vk::{
error,
options::{
FilterChainOptionsVulkan as FilterChainOptions, FrameOptionsVulkan as FrameOptions,
},
FilterChainVulkan as FilterChain, VulkanImage, VulkanInstance, VulkanObjects,
};
}
#[cfg(all(target_vendor = "apple", feature = "runtime-metal"))]
#[cfg_attr(
feature = "docsrs",
doc(cfg(all(target_vendor = "apple", feature = "runtime-metal")))
)]
pub mod mtl {
pub use librashader_runtime_mtl::{
error,
options::{
FilterChainOptionsMetal as FilterChainOptions, FrameOptionsMetal as FrameOptions,
},
FilterChainMetal as FilterChain, MetalTextureRef,
};
}
#[cfg(feature = "runtime-wgpu")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "runtime-wgpu")))]
pub mod wgpu {
pub use librashader_runtime_wgpu::{
error,
options::{
FilterChainOptionsWgpu as FilterChainOptions, FrameOptionsWgpu as FrameOptions,
},
FilterChainWgpu as FilterChain, WgpuOutputView,
};
}
}
pub use librashader_common::{FilterMode, ImageFormat, WrapMode};