rt: add stable feature to build ShaderPassArtifacts via Box<dyn CompileReflectShader>

This commit is contained in:
chyyran 2024-09-15 01:55:14 -04:00 committed by Ronny Chan
parent e0a5c90103
commit 2f988d5b1d
23 changed files with 93 additions and 10 deletions

View file

@ -26,6 +26,7 @@ runtime-vulkan = ["ash", "librashader/runtime-vk"]
runtime-metal = ["__cbindgen_internal_objc", "librashader/runtime-metal"] runtime-metal = ["__cbindgen_internal_objc", "librashader/runtime-metal"]
reflect-unstable = [] reflect-unstable = []
stable = ["librashader/stable"]
__cbindgen_internal = ["runtime-all"] __cbindgen_internal = ["runtime-all"]

View file

@ -26,6 +26,7 @@ array-concat = "0.5.2"
[features] [features]
debug-shader = [] debug-shader = []
stable = ["librashader-reflect/stable"]
[target.'cfg(windows)'.dependencies.windows] [target.'cfg(windows)'.dependencies.windows]
workspace = true workspace = true

View file

@ -73,9 +73,16 @@ pub(crate) struct FilterCommon {
mod compile { mod compile {
use super::*; use super::*;
#[cfg(not(feature = "stable"))]
pub type ShaderPassMeta = pub type ShaderPassMeta =
ShaderPassArtifact<impl CompileReflectShader<HLSL, SpirvCompilation, SpirvCross> + Send>; ShaderPassArtifact<impl CompileReflectShader<HLSL, SpirvCompilation, SpirvCross> + Send>;
#[cfg(feature = "stable")]
pub type ShaderPassMeta = ShaderPassArtifact<
Box<dyn CompileReflectShader<HLSL, SpirvCompilation, SpirvCross> + Send>,
>;
pub fn compile_passes( pub fn compile_passes(
shaders: Vec<ShaderPassConfig>, shaders: Vec<ShaderPassConfig>,
textures: &[TextureConfig], textures: &[TextureConfig],

View file

@ -33,6 +33,9 @@ gpu-allocator = { version = "0.27.0", features = ["d3d12"], default-features = f
parking_lot = "0.12.3" parking_lot = "0.12.3"
d3d12-descriptor-heap = "0.1.0" d3d12-descriptor-heap = "0.1.0"
[features]
stable = ["librashader-reflect/stable"]
[target.'cfg(windows)'.dependencies.windows] [target.'cfg(windows)'.dependencies.windows]
workspace = true workspace = true
features = [ features = [

View file

@ -169,9 +169,16 @@ impl Drop for FrameResiduals {
mod compile { mod compile {
use super::*; use super::*;
#[cfg(not(feature = "stable"))]
pub type DxilShaderPassMeta = pub type DxilShaderPassMeta =
ShaderPassArtifact<impl CompileReflectShader<DXIL, SpirvCompilation, SpirvCross> + Send>; ShaderPassArtifact<impl CompileReflectShader<DXIL, SpirvCompilation, SpirvCross> + Send>;
#[cfg(feature = "stable")]
pub type DxilShaderPassMeta = ShaderPassArtifact<
Box<dyn CompileReflectShader<DXIL, SpirvCompilation, SpirvCross> + Send>,
>;
pub fn compile_passes_dxil( pub fn compile_passes_dxil(
shaders: Vec<ShaderPassConfig>, shaders: Vec<ShaderPassConfig>,
textures: &[TextureConfig], textures: &[TextureConfig],
@ -192,9 +199,15 @@ mod compile {
Ok((passes, semantics)) Ok((passes, semantics))
} }
#[cfg(not(feature = "stable"))]
pub type HlslShaderPassMeta = pub type HlslShaderPassMeta =
ShaderPassArtifact<impl CompileReflectShader<HLSL, SpirvCompilation, SpirvCross> + Send>; ShaderPassArtifact<impl CompileReflectShader<HLSL, SpirvCompilation, SpirvCross> + Send>;
#[cfg(feature = "stable")]
pub type HlslShaderPassMeta = ShaderPassArtifact<
Box<dyn CompileReflectShader<HLSL, SpirvCompilation, SpirvCross> + Send>,
>;
pub fn compile_passes_hlsl( pub fn compile_passes_hlsl(
shaders: Vec<ShaderPassConfig>, shaders: Vec<ShaderPassConfig>,
textures: &[TextureConfig], textures: &[TextureConfig],

View file

@ -1,6 +1,6 @@
#![cfg(target_os = "windows")] #![cfg(target_os = "windows")]
#![deny(unsafe_op_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)]
#![feature(type_alias_impl_trait)] #![cfg_attr(not(feature = "stable"), feature(type_alias_impl_trait))]
mod buffer; mod buffer;
mod descriptor_heap; mod descriptor_heap;

View file

@ -26,6 +26,9 @@ num-traits = "0.2.18"
windows-core = "0.58.0" windows-core = "0.58.0"
[features]
stable = ["librashader-reflect/stable"]
[target.'cfg(windows)'.dependencies.windows] [target.'cfg(windows)'.dependencies.windows]
workspace = true workspace = true
features = [ features = [

View file

@ -60,9 +60,16 @@ pub struct FilterChainD3D9 {
mod compile { mod compile {
use super::*; use super::*;
#[cfg(not(feature = "stable"))]
pub type ShaderPassMeta = pub type ShaderPassMeta =
ShaderPassArtifact<impl CompileReflectShader<HLSL, SpirvCompilation, SpirvCross> + Send>; ShaderPassArtifact<impl CompileReflectShader<HLSL, SpirvCompilation, SpirvCross> + Send>;
#[cfg(feature = "stable")]
pub type ShaderPassMeta = ShaderPassArtifact<
Box<dyn CompileReflectShader<HLSL, SpirvCompilation, SpirvCross> + Send>,
>;
pub fn compile_passes( pub fn compile_passes(
shaders: Vec<ShaderPassConfig>, shaders: Vec<ShaderPassConfig>,
textures: &[TextureConfig], textures: &[TextureConfig],

View file

@ -1,5 +1,6 @@
#![cfg(target_os = "windows")] #![cfg(target_os = "windows")]
#![feature(type_alias_impl_trait)] #![cfg_attr(not(feature = "stable"), feature(type_alias_impl_trait))]
mod binding; mod binding;
mod d3dx; mod d3dx;
mod draw_quad; mod draw_quad;

View file

@ -27,6 +27,9 @@ rayon = "1.6.1"
sptr = "0.3" sptr = "0.3"
[features]
stable = ["librashader-reflect/stable"]
[dev-dependencies] [dev-dependencies]
glfw = "0.47.0" glfw = "0.47.0"

View file

@ -89,9 +89,16 @@ impl<T: GLInterface> FilterChainImpl<T> {
mod compile { mod compile {
use super::*; use super::*;
#[cfg(not(feature = "stable"))]
pub type ShaderPassMeta = pub type ShaderPassMeta =
ShaderPassArtifact<impl CompileReflectShader<GLSL, SpirvCompilation, SpirvCross>>; ShaderPassArtifact<impl CompileReflectShader<GLSL, SpirvCompilation, SpirvCross>>;
#[cfg(feature = "stable")]
pub type ShaderPassMeta = ShaderPassArtifact<
Box<dyn CompileReflectShader<GLSL, SpirvCompilation, SpirvCross> + Send>,
>;
pub fn compile_passes( pub fn compile_passes(
shaders: Vec<ShaderPassConfig>, shaders: Vec<ShaderPassConfig>,
textures: &[TextureConfig], textures: &[TextureConfig],

View file

@ -3,7 +3,7 @@
//! This crate should not be used directly. //! This crate should not be used directly.
//! See [`librashader::runtime::gl`](https://docs.rs/librashader/latest/librashader/runtime/gl/index.html) instead. //! See [`librashader::runtime::gl`](https://docs.rs/librashader/latest/librashader/runtime/gl/index.html) instead.
#![deny(unsafe_op_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)]
#![feature(type_alias_impl_trait)] #![cfg_attr(not(feature = "stable"), feature(type_alias_impl_trait))]
mod binding; mod binding;
mod filter_chain; mod filter_chain;

View file

@ -39,7 +39,7 @@ objc2-metal = { workspace = true, features = ["all"] }
objc2 = { workspace = true, features = ["apple"] } objc2 = { workspace = true, features = ["apple"] }
[features] [features]
# run_test = ["icrate/AppKit", "i "icrate/Foundation_all", "icrate/MetalKit", "icrate/MetalKit_all"] stable = ["librashader-reflect/stable"]
[target.'cfg(target_vendor="apple")'.dev-dependencies] [target.'cfg(target_vendor="apple")'.dev-dependencies]
objc2-metal-kit = { version = "0.2", features = ["all"]} objc2-metal-kit = { version = "0.2", features = ["all"]}

View file

@ -41,9 +41,15 @@ use std::path::Path;
mod compile { mod compile {
use super::*; use super::*;
#[cfg(not(feature = "stable"))]
pub type ShaderPassMeta = pub type ShaderPassMeta =
ShaderPassArtifact<impl CompileReflectShader<MSL, SpirvCompilation, SpirvCross> + Send>; ShaderPassArtifact<impl CompileReflectShader<MSL, SpirvCompilation, SpirvCross> + Send>;
#[cfg(feature = "stable")]
pub type ShaderPassMeta =
ShaderPassArtifact<Box<dyn CompileReflectShader<MSL, SpirvCompilation, SpirvCross> + Send>>;
pub fn compile_passes( pub fn compile_passes(
shaders: Vec<ShaderPassConfig>, shaders: Vec<ShaderPassConfig>,
textures: &[TextureConfig], textures: &[TextureConfig],

View file

@ -1,5 +1,10 @@
//! 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.
#![cfg(target_vendor = "apple")] #![cfg(target_vendor = "apple")]
#![feature(type_alias_impl_trait)] #![cfg_attr(not(feature = "stable"), feature(type_alias_impl_trait))]
mod buffer; mod buffer;
mod draw_quad; mod draw_quad;

View file

@ -30,6 +30,9 @@ array-concat = "0.5.2"
ash = { workspace = true, features = ["debug"] } ash = { workspace = true, features = ["debug"] }
[features]
stable = ["librashader-reflect/stable"]
[dev-dependencies] [dev-dependencies]
num = "0.4.0" num = "0.4.0"
glfw = "0.49.0" glfw = "0.49.0"

View file

@ -206,9 +206,16 @@ impl Drop for FrameResiduals {
mod compile { mod compile {
use super::*; use super::*;
#[cfg(not(feature = "stable"))]
pub type ShaderPassMeta = pub type ShaderPassMeta =
ShaderPassArtifact<impl CompileReflectShader<SPIRV, SpirvCompilation, SpirvCross> + Send>; ShaderPassArtifact<impl CompileReflectShader<SPIRV, SpirvCompilation, SpirvCross> + Send>;
#[cfg(feature = "stable")]
pub type ShaderPassMeta = ShaderPassArtifact<
Box<dyn CompileReflectShader<SPIRV, SpirvCompilation, SpirvCross> + Send>,
>;
pub fn compile_passes( pub fn compile_passes(
shaders: Vec<ShaderPassConfig>, shaders: Vec<ShaderPassConfig>,
textures: &[TextureConfig], textures: &[TextureConfig],

View file

@ -3,7 +3,7 @@
//! This crate should not be used directly. //! This crate should not be used directly.
//! See [`librashader::runtime::vk`](https://docs.rs/librashader/latest/librashader/runtime/vk/index.html) instead. //! See [`librashader::runtime::vk`](https://docs.rs/librashader/latest/librashader/runtime/vk/index.html) instead.
#![deny(unsafe_op_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)]
#![feature(type_alias_impl_trait)] #![cfg_attr(not(feature = "stable"), feature(type_alias_impl_trait))]
mod draw_quad; mod draw_quad;
mod filter_chain; mod filter_chain;

View file

@ -33,6 +33,8 @@ wgpu_dx12 = ["wgpu/dx12"]
wgpu_metal = ["wgpu/metal"] wgpu_metal = ["wgpu/metal"]
wgpu_webgpu = ["wgpu/webgpu"] wgpu_webgpu = ["wgpu/webgpu"]
stable = ["librashader-reflect/stable"]
[target.'cfg(not(target_arch="wasm32"))'.dependencies] [target.'cfg(not(target_arch="wasm32"))'.dependencies]
rayon = "1.8.1" rayon = "1.8.1"

View file

@ -40,9 +40,15 @@ use crate::texture::{InputImage, OwnedImage};
mod compile { mod compile {
use super::*; use super::*;
#[cfg(not(feature = "stable"))]
pub type ShaderPassMeta = pub type ShaderPassMeta =
ShaderPassArtifact<impl CompileReflectShader<WGSL, SpirvCompilation, Naga> + Send>; ShaderPassArtifact<impl CompileReflectShader<WGSL, SpirvCompilation, Naga> + Send>;
#[cfg(feature = "stable")]
pub type ShaderPassMeta =
ShaderPassArtifact<Box<dyn CompileReflectShader<WGSL, SpirvCompilation, Naga> + Send>>;
pub fn compile_passes( pub fn compile_passes(
shaders: Vec<ShaderPassConfig>, shaders: Vec<ShaderPassConfig>,
textures: &[TextureConfig], textures: &[TextureConfig],

View file

@ -3,7 +3,7 @@
//! This crate should not be used directly. //! This crate should not be used directly.
//! See [`librashader::runtime::wgpu`](https://docs.rs/librashader/latest/librashader/runtime/wgpu/index.html) instead. //! See [`librashader::runtime::wgpu`](https://docs.rs/librashader/latest/librashader/runtime/wgpu/index.html) instead.
#![deny(unsafe_op_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)]
#![feature(type_alias_impl_trait)] #![cfg_attr(not(feature = "stable"), feature(type_alias_impl_trait))]
mod buffer; mod buffer;
mod draw_quad; mod draw_quad;

View file

@ -47,7 +47,15 @@ runtime = []
reflect = [] reflect = []
preprocess = [] preprocess = []
presets = [] presets = []
stable = [ "librashader-reflect/stable",
"librashader-runtime-d3d9?/stable",
"librashader-runtime-d3d11?/stable",
"librashader-runtime-d3d12?/stable",
"librashader-runtime-gl?/stable",
"librashader-runtime-vk?/stable",
"librashader-runtime-mtl?/stable",
"librashader-runtime-wgpu?/stable"
]
# runtimes # runtimes
runtime-gl = [ "runtime", "reflect-cross", "librashader-common/opengl", "librashader-runtime-gl" ] runtime-gl = [ "runtime", "reflect-cross", "librashader-common/opengl", "librashader-runtime-gl" ]