diff --git a/README.md b/README.md index 84fec28..c1683a9 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ librashader provides both a Rust API under the `librashader` crate, and a C API. The librashader C API is best used by linking statically with `librashader_ld`, which implements a loader that dynamically loads the librashader (`librashader.so` or `rashader.dll`) implementation in the search path. +Note that the Rust crate requires nightly Rust to build. + ## Compatibility librashader implements the entire RetroArch shader pipeline and is highly compatible with existing shaders, diff --git a/librashader-preprocess/src/include.rs b/librashader-preprocess/src/include.rs index 5e04d12..2b59a40 100644 --- a/librashader-preprocess/src/include.rs +++ b/librashader-preprocess/src/include.rs @@ -53,8 +53,8 @@ fn preprocess( let file_name = file_name.file_name().and_then(|f| f.to_str()).unwrap_or(""); for (line_no, line) in lines.enumerate() { - if line.starts_with("#include ") { - let include_file = line["#include ".len()..].trim().trim_matches('"'); + if let Some(include_file) = line.strip_prefix("#include ") { + let include_file = include_file.trim().trim_matches('"'); if include_file.is_empty() { return Err(PreprocessError::UnexpectedEol(line_no)); } diff --git a/librashader-preprocess/src/pragma.rs b/librashader-preprocess/src/pragma.rs index 322a4c5..4ee34dc 100644 --- a/librashader-preprocess/src/pragma.rs +++ b/librashader-preprocess/src/pragma.rs @@ -87,12 +87,12 @@ pub(crate) fn parse_pragma_meta(source: impl AsRef) -> Result Result Option { - self.common.config.parameters.get::(parameter.as_ref()).map(|f| *f) + self.common.config.parameters.get::(parameter.as_ref()).copied() } fn set_parameter(&mut self, parameter: &str, new_value: f32) -> Option { diff --git a/librashader-runtime-d3d11/src/texture.rs b/librashader-runtime-d3d11/src/texture.rs index 5ce604a..d515a69 100644 --- a/librashader-runtime-d3d11/src/texture.rs +++ b/librashader-runtime-d3d11/src/texture.rs @@ -40,7 +40,10 @@ impl Texture { #[derive(Debug, Clone)] pub(crate) struct LutTexture { + // The handle to the Texture2D must be kept alive. + #[allow(dead_code)] pub handle: ID3D11Texture2D, + #[allow(dead_code)] pub desc: D3D11_TEXTURE2D_DESC, pub image: Texture, } diff --git a/librashader-runtime-d3d11/src/util.rs b/librashader-runtime-d3d11/src/util.rs index 43bf411..e767fa4 100644 --- a/librashader-runtime-d3d11/src/util.rs +++ b/librashader-runtime-d3d11/src/util.rs @@ -118,8 +118,7 @@ pub fn d3d_compile_shader(source: &[u8], entry: &[u8], version: &[u8]) -> error: if cfg!(feature = "debug-shader") { D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION } else { - D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION - + 0 }, 0, &mut blob, diff --git a/librashader-runtime-gl/Cargo.toml b/librashader-runtime-gl/Cargo.toml index b9dd0d2..a08c322 100644 --- a/librashader-runtime-gl/Cargo.toml +++ b/librashader-runtime-gl/Cargo.toml @@ -15,7 +15,7 @@ description = "RetroArch shaders for all." librashader-common = { path = "../librashader-common", features = ["opengl"], version = "0.1.0-alpha.1" } librashader-presets = { path = "../librashader-presets", version = "0.1.0-alpha.1" } librashader-preprocess = { path = "../librashader-preprocess", version = "0.1.0-alpha.1" } -librashader-reflect = { path = "../librashader-reflect", version = "0.1.0-alpha.1" } +librashader-reflect = { path = "../librashader-reflect", version = "0.1.0-alpha.1", features = ["standalone"] } librashader-runtime = { path = "../librashader-runtime" , version = "0.1.0-alpha.1" } spirv_cross = "0.23.1" rustc-hash = "1.1.0" diff --git a/librashader-runtime-gl/src/filter_chain/filter_impl.rs b/librashader-runtime-gl/src/filter_chain/filter_impl.rs index b94c632..2b2c7f7 100644 --- a/librashader-runtime-gl/src/filter_chain/filter_impl.rs +++ b/librashader-runtime-gl/src/filter_chain/filter_impl.rs @@ -517,7 +517,7 @@ impl FilterChainImpl { // try to hint the optimizer assert_eq!(last.len(), 1); - for pass in last { + if let Some(pass) = last.iter_mut().next() { source.filter = pass.config.filter; source.mip_filter = pass.config.filter; diff --git a/librashader-runtime-gl/src/filter_chain/parameters.rs b/librashader-runtime-gl/src/filter_chain/parameters.rs index 738feb7..67790c3 100644 --- a/librashader-runtime-gl/src/filter_chain/parameters.rs +++ b/librashader-runtime-gl/src/filter_chain/parameters.rs @@ -59,7 +59,7 @@ impl FilterChainParameters for FilterChainImpl { } fn get_parameter(&self, parameter: &str) -> Option { - self.common.config.parameters.get::(parameter.as_ref()).map(|f| *f) + self.common.config.parameters.get::(parameter.as_ref()).copied() } fn set_parameter(&mut self, parameter: &str, new_value: f32) -> Option {