style: fix warnings

This commit is contained in:
chyyran 2024-08-09 00:55:58 -04:00 committed by Ronny Chan
parent 977975f4c7
commit ac66b1b6f6
17 changed files with 88 additions and 85 deletions

102
Cargo.lock generated
View file

@ -45,7 +45,7 @@ dependencies = [
"getrandom",
"once_cell",
"version_check",
"zerocopy 0.7.35",
"zerocopy",
]
[[package]]
@ -482,9 +482,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.1.7"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc"
checksum = "504bdec147f2cc13c8b57ed9401fd8a147cc66b67ad5cb241394244f2c947549"
dependencies = [
"jobserver",
"libc",
@ -1002,9 +1002,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "flate2"
version = "1.0.30"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920"
dependencies = [
"crc32fast",
"miniz_oxide",
@ -2061,6 +2061,7 @@ dependencies = [
"indexmap 2.3.0",
"log",
"petgraph",
"pp-rs",
"rustc-hash 1.1.0",
"spirv",
"termcolor",
@ -2518,12 +2519,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
[[package]]
name = "ppv-lite86"
version = "0.2.18"
name = "pp-rs"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dee4364d9f3b902ef14fab8a1ddffb783a1cb6b4bba3bfc1fa3922732c7de97f"
checksum = "bb458bb7f6e250e6eb79d5026badc10a3ebb8f9a15d1fff0f13d17c71f4d6dee"
dependencies = [
"zerocopy 0.6.6",
"unicode-xid",
]
[[package]]
name = "ppv-lite86"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
dependencies = [
"zerocopy",
]
[[package]]
@ -2705,9 +2715,9 @@ dependencies = [
[[package]]
name = "ravif"
version = "0.11.9"
version = "0.11.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5797d09f9bd33604689e87e8380df4951d4912f01b63f71205e2abd4ae25e6b6"
checksum = "a8f0bfd976333248de2078d350bfdf182ff96e168a24d23d2436cef320dd4bdd"
dependencies = [
"avif-serialize",
"imgref",
@ -2810,9 +2820,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.10.5"
version = "1.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
dependencies = [
"aho-corasick",
"memchr",
@ -2845,9 +2855,9 @@ checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
[[package]]
name = "rgb"
version = "0.8.45"
version = "0.8.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade4539f42266ded9e755c605bdddf546242b2c961b03b06a7375260788a0523"
checksum = "0f86ae463694029097b846d8f99fd5536740602ae00022c0c50c5600720b2f71"
dependencies = [
"bytemuck",
]
@ -2956,18 +2966,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.204"
version = "1.0.205"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.204"
version = "1.0.205"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1"
dependencies = [
"proc-macro2",
"quote",
@ -3193,14 +3203,15 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]]
name = "tempfile"
version = "3.10.1"
version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64"
dependencies = [
"cfg-if",
"fastrand",
"once_cell",
"rustix",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@ -3361,9 +3372,9 @@ checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
[[package]]
name = "ttf-parser"
version = "0.24.0"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8686b91785aff82828ed725225925b33b4fde44c4bb15876e5f7c832724c420a"
checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a"
[[package]]
name = "typenum"
@ -3783,11 +3794,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.8"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@ -3906,6 +3917,15 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
@ -4218,9 +4238,9 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"
[[package]]
name = "xml-rs"
version = "0.8.20"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193"
checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601"
[[package]]
name = "yaml-rust"
@ -4231,34 +4251,14 @@ dependencies = [
"linked-hash-map",
]
[[package]]
name = "zerocopy"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6"
dependencies = [
"byteorder",
"zerocopy-derive 0.6.6",
]
[[package]]
name = "zerocopy"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"zerocopy-derive 0.7.35",
]
[[package]]
name = "zerocopy-derive"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.72",
"byteorder",
"zerocopy-derive",
]
[[package]]

View file

@ -25,6 +25,8 @@ runtime-d3d9 = ["windows", "librashader/runtime-d3d9", "windows/Win32_Graphics_D
runtime-vulkan = ["ash", "librashader/runtime-vk"]
runtime-metal = ["__cbindgen_internal_objc", "librashader/runtime-metal"]
reflect-unstable = []
__cbindgen_internal = ["runtime-all"]
# make runtime-metal depend on this, so its automatically implied.

View file

@ -75,7 +75,7 @@ pub mod error;
mod ffi;
pub mod presets;
#[cfg(feature = "reflect")]
#[cfg(feature = "reflect-unstable")]
#[doc(hidden)]
pub mod reflect;

View file

@ -3,9 +3,7 @@ use crate::ctypes::{
};
use crate::error::{assert_non_null, assert_some_ptr, LibrashaderError};
use crate::ffi::extern_fn;
use librashader::runtime::d3d11::{
FilterChain, FilterChainOptions, FrameOptions,
};
use librashader::runtime::d3d11::{FilterChain, FilterChainOptions, FrameOptions};
use std::ffi::c_char;
use std::ffi::CStr;
use std::mem::{ManuallyDrop, MaybeUninit};
@ -17,7 +15,7 @@ use windows::Win32::Graphics::Direct3D11::{
};
use crate::LIBRASHADER_API_VERSION;
use librashader::runtime::{FilterChainParameters, Size, Viewport};
use librashader::runtime::{FilterChainParameters, Viewport};
/// Direct3D 11 parameters for the source image.
#[repr(C)]

View file

@ -326,6 +326,10 @@ impl WildcardContext {
}
}
/// Convert the context into a string hashmap.
///
/// This is a one way conversion, and will normalize rotation context items
/// into `VID-FINAL-ROT`.
pub fn to_hashmap(mut self) -> FastHashMap<String, String> {
let mut map = FastHashMap::default();
let last_user_rot = self

View file

@ -23,7 +23,7 @@ use crate::extract_if::MakeExtractIf;
#[derive(Debug)]
pub enum Value {
ShaderCount(i32),
FeedbackPass(i32),
FeedbackPass(#[allow(unused)] i32),
Shader(i32, PathBuf),
ScaleX(i32, ScaleFactor),
ScaleY(i32, ScaleFactor),

View file

@ -46,3 +46,5 @@ cross = [ "spirv_cross", "spirv_cross/glsl", "spirv_cross/hlsl", "spirv_cross/ms
naga = [ "rspirv", "spirv", "naga/spv-in", "naga/spv-out", "naga/wgsl-out", "naga/msl-out" ]
serialize = [ "serde" ]
msl = [ "spirv_cross/msl", "naga/msl-out" ]
unstable-naga-in = ["naga/glsl-in"]

View file

@ -6,7 +6,7 @@ use thiserror::Error;
#[derive(Error, Debug)]
pub enum ShaderCompileError {
/// Compile error from naga.
#[cfg(feature = "unstable-naga")]
#[cfg(feature = "unstable-naga-in")]
#[error("shader")]
NagaCompileError(Vec<naga::front::glsl::Error>),
@ -131,7 +131,7 @@ pub enum ShaderReflectError {
NagaReflectError(#[from] naga::WithSpan<naga::valid::ValidationError>),
}
#[cfg(feature = "unstable-naga")]
#[cfg(feature = "unstable-naga-in")]
impl From<Vec<naga::front::glsl::Error>> for ShaderCompileError {
fn from(err: Vec<naga::front::glsl::Error>) -> Self {
ShaderCompileError::NagaCompileError(err)

View file

@ -24,6 +24,9 @@ bytemuck = "1.12.3"
rayon = "1.6.1"
array-concat = "0.5.2"
[features]
debug-shader = []
[target.'cfg(windows)'.dependencies.windows]
workspace = true
features = [

View file

@ -1,7 +1,7 @@
use crate::error::Result;
use crate::framebuffer::OwnedImage;
use librashader_common::{FilterMode, WrapMode};
use windows::Win32::Graphics::Direct3D11::{ID3D11ShaderResourceView};
use windows::Win32::Graphics::Direct3D11::ID3D11ShaderResourceView;
#[derive(Debug, Clone)]
pub struct InputTexture {

View file

@ -594,7 +594,10 @@ pub mod d3d11_hello_triangle {
}
unsafe {
resources.swapchain.Present(0, DXGI_PRESENT::default()).ok()?;
resources
.swapchain
.Present(0, DXGI_PRESENT::default())
.ok()?;
}
resources.frame_count += 1;
Ok(())

View file

@ -21,7 +21,6 @@ use windows::Win32::Graphics::Direct3D12::{
D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX,
};
use windows::Win32::Graphics::Dxgi::Common::*;
use librashader_common::Size;
/// wtf retroarch?
const DXGI_FORMAT_EX_A4R4G4B4_UNORM: DXGI_FORMAT = DXGI_FORMAT(1000);
@ -388,18 +387,3 @@ unsafe fn memcpy_subresource(
}
}
}
pub(crate) trait GetSize {
fn size(&self) -> Size<u32>;
}
impl GetSize for ID3D12Resource {
fn size(&self) -> Size<u32> {
let desc = unsafe {
self.GetDesc()
};
Size::new(desc.Width as u32, desc.Height)
}
}

View file

@ -529,7 +529,9 @@ pub mod d3d12_hello_triangle {
unsafe { resources.command_queue.ExecuteCommandLists(&[command_list]) };
// Present the frame.
unsafe { resources.swap_chain.Present(1, DXGI_PRESENT::default()) }.ok().unwrap();
unsafe { resources.swap_chain.Present(1, DXGI_PRESENT::default()) }
.ok()
.unwrap();
wait_for_previous_frame(resources);
self.framecount += 1;

View file

@ -98,15 +98,17 @@ impl ContextOffset<D3D9UniformBinder, ConstantRegister, IDirect3DDevice9> for Co
pub(crate) type D3D9UniformStorage =
UniformStorage<D3D9UniformBinder, ConstantRegister, Box<[u8]>, Box<[u8]>, IDirect3DDevice9>;
/// Trait for uniform scalars that can be converted to f32 as required by SM3.0
/// Mostly used to get around orphan rule.
#[allow(unused)]
trait D3D9UniformScalar: UniformScalar + AsPrimitive<f32> + Copy {}
impl D3D9UniformScalar for u32 {}
impl D3D9UniformScalar for i32 {}
impl D3D9UniformScalar for f32 {}
pub(crate) struct D3D9UniformBinder;
impl<T> BindUniform<ConstantRegister, T, IDirect3DDevice9> for D3D9UniformBinder
where
T: D3D9UniformScalar,
impl<T: D3D9UniformScalar> BindUniform<ConstantRegister, T, IDirect3DDevice9>
for D3D9UniformBinder
{
fn bind_uniform(
_block: UniformMemberBlock,

View file

@ -68,7 +68,11 @@ where
.ok()
}
windows::core::imp::define_interface!(ID3DXConstantTable, ID3DXConstantTable_Vtbl, 0xab3c758f_93e_4356_b7_62_4d_b1_8f_1b_3a1);
windows::core::imp::define_interface!(
ID3DXConstantTable,
ID3DXConstantTable_Vtbl,
0xab3c758f_93e_4356_b7_62_4d_b1_8f_1b_3a1
);
#[allow(dead_code)]
impl ID3DXConstantTable {
@ -423,4 +427,4 @@ pub enum D3DXPARAMETER_TYPE {
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct D3DXHANDLE(pub *const c_void);
pub struct D3DXHANDLE(pub *const c_void);

View file

@ -25,7 +25,7 @@ use librashader_reflect::reflect::naga::{Naga, NagaLoweringOptions};
use librashader_runtime::framebuffer::FramebufferInit;
use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::scaling::ScaleFramebuffer;
use wgpu::{AdapterInfo, Device, TextureFormat};
use wgpu::{Device, TextureFormat};
use crate::error;
use crate::error::FilterChainError;

View file

@ -1,4 +1,3 @@
use crate::error::FilterChainError;
use crate::framebuffer::WgpuOutputView;
use crate::util;
use librashader_cache::cache_pipeline;