diff --git a/Cargo.lock b/Cargo.lock index 85ad2f9..bc144ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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]] diff --git a/librashader-capi/Cargo.toml b/librashader-capi/Cargo.toml index aa21292..03caa0f 100644 --- a/librashader-capi/Cargo.toml +++ b/librashader-capi/Cargo.toml @@ -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. diff --git a/librashader-capi/src/lib.rs b/librashader-capi/src/lib.rs index 2e110ec..52252b6 100644 --- a/librashader-capi/src/lib.rs +++ b/librashader-capi/src/lib.rs @@ -75,7 +75,7 @@ pub mod error; mod ffi; pub mod presets; -#[cfg(feature = "reflect")] +#[cfg(feature = "reflect-unstable")] #[doc(hidden)] pub mod reflect; diff --git a/librashader-capi/src/runtime/d3d11/filter_chain.rs b/librashader-capi/src/runtime/d3d11/filter_chain.rs index 7e9d8e9..8a5aaec 100644 --- a/librashader-capi/src/runtime/d3d11/filter_chain.rs +++ b/librashader-capi/src/runtime/d3d11/filter_chain.rs @@ -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)] diff --git a/librashader-presets/src/context.rs b/librashader-presets/src/context.rs index 1d35875..62af7ca 100644 --- a/librashader-presets/src/context.rs +++ b/librashader-presets/src/context.rs @@ -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 { let mut map = FastHashMap::default(); let last_user_rot = self diff --git a/librashader-presets/src/parse/value.rs b/librashader-presets/src/parse/value.rs index 333fe4e..bc59310 100644 --- a/librashader-presets/src/parse/value.rs +++ b/librashader-presets/src/parse/value.rs @@ -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), diff --git a/librashader-reflect/Cargo.toml b/librashader-reflect/Cargo.toml index 41992ca..b59f769 100644 --- a/librashader-reflect/Cargo.toml +++ b/librashader-reflect/Cargo.toml @@ -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"] \ No newline at end of file diff --git a/librashader-reflect/src/error.rs b/librashader-reflect/src/error.rs index e76a6e8..d7d72ca 100644 --- a/librashader-reflect/src/error.rs +++ b/librashader-reflect/src/error.rs @@ -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), @@ -131,7 +131,7 @@ pub enum ShaderReflectError { NagaReflectError(#[from] naga::WithSpan), } -#[cfg(feature = "unstable-naga")] +#[cfg(feature = "unstable-naga-in")] impl From> for ShaderCompileError { fn from(err: Vec) -> Self { ShaderCompileError::NagaCompileError(err) diff --git a/librashader-runtime-d3d11/Cargo.toml b/librashader-runtime-d3d11/Cargo.toml index 98fb19e..71afbe7 100644 --- a/librashader-runtime-d3d11/Cargo.toml +++ b/librashader-runtime-d3d11/Cargo.toml @@ -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 = [ diff --git a/librashader-runtime-d3d11/src/texture.rs b/librashader-runtime-d3d11/src/texture.rs index 04c5afc..a6f1f98 100644 --- a/librashader-runtime-d3d11/src/texture.rs +++ b/librashader-runtime-d3d11/src/texture.rs @@ -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 { diff --git a/librashader-runtime-d3d11/tests/hello_triangle/mod.rs b/librashader-runtime-d3d11/tests/hello_triangle/mod.rs index 1bb6cb0..de9a08e 100644 --- a/librashader-runtime-d3d11/tests/hello_triangle/mod.rs +++ b/librashader-runtime-d3d11/tests/hello_triangle/mod.rs @@ -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(()) diff --git a/librashader-runtime-d3d12/src/util.rs b/librashader-runtime-d3d12/src/util.rs index ea3da76..d7b1907 100644 --- a/librashader-runtime-d3d12/src/util.rs +++ b/librashader-runtime-d3d12/src/util.rs @@ -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; -} - -impl GetSize for ID3D12Resource { - fn size(&self) -> Size { - let desc = unsafe { - self.GetDesc() - }; - - Size::new(desc.Width as u32, desc.Height) - } -} diff --git a/librashader-runtime-d3d12/tests/hello_triangle/mod.rs b/librashader-runtime-d3d12/tests/hello_triangle/mod.rs index ff97c67..af1156b 100644 --- a/librashader-runtime-d3d12/tests/hello_triangle/mod.rs +++ b/librashader-runtime-d3d12/tests/hello_triangle/mod.rs @@ -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; diff --git a/librashader-runtime-d3d9/src/binding.rs b/librashader-runtime-d3d9/src/binding.rs index cf43f39..71698cb 100644 --- a/librashader-runtime-d3d9/src/binding.rs +++ b/librashader-runtime-d3d9/src/binding.rs @@ -98,15 +98,17 @@ impl ContextOffset for Co pub(crate) type D3D9UniformStorage = UniformStorage, 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 + Copy {} impl D3D9UniformScalar for u32 {} impl D3D9UniformScalar for i32 {} impl D3D9UniformScalar for f32 {} pub(crate) struct D3D9UniformBinder; -impl BindUniform for D3D9UniformBinder -where - T: D3D9UniformScalar, +impl BindUniform + for D3D9UniformBinder { fn bind_uniform( _block: UniformMemberBlock, diff --git a/librashader-runtime-d3d9/src/d3dx.rs b/librashader-runtime-d3d9/src/d3dx.rs index e818541..d95e1cd 100644 --- a/librashader-runtime-d3d9/src/d3dx.rs +++ b/librashader-runtime-d3d9/src/d3dx.rs @@ -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); \ No newline at end of file +pub struct D3DXHANDLE(pub *const c_void); diff --git a/librashader-runtime-wgpu/src/filter_chain.rs b/librashader-runtime-wgpu/src/filter_chain.rs index a28e496..0d2baca 100644 --- a/librashader-runtime-wgpu/src/filter_chain.rs +++ b/librashader-runtime-wgpu/src/filter_chain.rs @@ -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; diff --git a/librashader-runtime-wgpu/src/graphics_pipeline.rs b/librashader-runtime-wgpu/src/graphics_pipeline.rs index ac36ed8..cd3ecd9 100644 --- a/librashader-runtime-wgpu/src/graphics_pipeline.rs +++ b/librashader-runtime-wgpu/src/graphics_pipeline.rs @@ -1,4 +1,3 @@ -use crate::error::FilterChainError; use crate::framebuffer::WgpuOutputView; use crate::util; use librashader_cache::cache_pipeline;