diff --git a/Cargo.lock b/Cargo.lock index 774dd7a..9d330ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,9 +35,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", @@ -46,9 +46,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" dependencies = [ "cfg-if", "getrandom", @@ -1209,7 +1209,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] @@ -1218,7 +1218,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.8", "allocator-api2", ] @@ -1632,7 +1632,6 @@ dependencies = [ "librashader-presets 0.2.0-beta.9", "librashader-reflect", "librashader-runtime", - "librashader-spirv-cross", "rayon", "rustc-hash", "thiserror", @@ -1654,7 +1653,6 @@ dependencies = [ "librashader-presets 0.2.0-beta.9", "librashader-reflect", "librashader-runtime", - "librashader-spirv-cross", "parking_lot", "rayon", "rustc-hash", @@ -1698,7 +1696,6 @@ dependencies = [ "librashader-presets 0.2.0-beta.9", "librashader-reflect", "librashader-runtime", - "librashader-spirv-cross", "num", "parking_lot", "raw-window-handle 0.5.2", @@ -1734,10 +1731,11 @@ dependencies = [ [[package]] name = "librashader-spirv-cross" -version = "0.23.5" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc8e651a93a3bec5cec3264949f8ca9a8c4cbd09f03911af789000e3cebf98f6" +checksum = "1842c733107d5f223c30a9d9c532d8f4bfd403d51e9ce22c53d6248a0ffa8318" dependencies = [ + "build-target", "cc", "js-sys", "wasm-bindgen", @@ -3578,7 +3576,7 @@ version = "0.29.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c824f11941eeae66ec71111cc2674373c772f482b58939bb4066b642aa2ffcf" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.8", "android-activity", "atomic-waker", "bitflags 2.4.2", @@ -3679,9 +3677,9 @@ checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911" [[package]] name = "xkbcommon-dl" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6924668544c48c0133152e7eec86d644a056ca3d09275eb8d5cdb9855f9d8699" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" dependencies = [ "bitflags 2.4.2", "dlib", diff --git a/librashader-capi/Cargo.toml b/librashader-capi/Cargo.toml index 7f769d2..0bcd3bc 100644 --- a/librashader-capi/Cargo.toml +++ b/librashader-capi/Cargo.toml @@ -29,7 +29,7 @@ paste = "1.0.9" gl = { version = "0.14.0", optional = true } rustc-hash = "1.1.0" ash = { version = "0.37", optional = true } -spirv_cross = { package = "librashader-spirv-cross", version = "0.23" } +spirv_cross = { package = "librashader-spirv-cross", version = "0.24" } [target.'cfg(windows)'.dependencies.windows] version = "0.48.0" diff --git a/librashader-reflect/Cargo.toml b/librashader-reflect/Cargo.toml index d9cadbf..c6c4c09 100644 --- a/librashader-reflect/Cargo.toml +++ b/librashader-reflect/Cargo.toml @@ -23,7 +23,7 @@ librashader-common = { path = "../librashader-common", version = "0.2.0-beta.9" librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.9" } librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.9" } -spirv_cross = { package = "librashader-spirv-cross", version = "0.23", optional = true } +spirv_cross = { package = "librashader-spirv-cross", version = "0.24", optional = true } naga = { version = "0.19.0", features = ["spv-in", "spv-out"], optional = true } rspirv = { version = "0.12.0", optional = true } diff --git a/librashader-reflect/src/reflect/cross/msl.rs b/librashader-reflect/src/reflect/cross/msl.rs index 49a3402..e4dfa9e 100644 --- a/librashader-reflect/src/reflect/cross/msl.rs +++ b/librashader-reflect/src/reflect/cross/msl.rs @@ -31,15 +31,15 @@ impl CompileShader for CrossReflect { for resource in &resources.push_constant_buffers { let location = ResourceBindingLocation { stage, - desc_set: u32::MAX, // ResourceBindingPushConstantDescriptorSet - binding: 0, + desc_set: msl::PUSH_CONSTANT_DESCRIPTOR_SET, + binding: msl::PUSH_CONSTANT_BINDING, }; - let overridden = ResourceBinding { buffer_id: ast.get_decoration(resource.id, Decoration::Binding)?, texture_id: 0, sampler_id: 0, - count: 0, + base_type: None, + count: 0, // no arrays allowed in slang shaders, otherwise we'd have to get the type and get the array length }; binding_map.insert(location, overridden); @@ -57,7 +57,8 @@ impl CompileShader for CrossReflect { buffer_id: binding, texture_id: binding, sampler_id: binding, - count: 0, + base_type: None, + count: 0, // no arrays allowed in slang shaders, otherwise we'd have to get the type and get the array length }; binding_map.insert(location, overridden); @@ -77,6 +78,7 @@ impl CompileShader for CrossReflect { &mut frag_options.resource_binding_overrides )?; + eprintln!("{:?}", frag_options.resource_binding_overrides); self.vertex.set_compiler_options(&vert_options)?; self.fragment.set_compiler_options(&frag_options)?; @@ -95,6 +97,7 @@ impl CompileShader for CrossReflect { #[cfg(test)] mod test { + use std::io::Write; use crate::back::targets::{MSL, WGSL}; use crate::back::{CompileShader, FromCompilation}; use crate::reflect::naga::{Naga, NagaLoweringOptions}; diff --git a/librashader-runtime-d3d11/Cargo.toml b/librashader-runtime-d3d11/Cargo.toml index ee345e5..6ac6deb 100644 --- a/librashader-runtime-d3d11/Cargo.toml +++ b/librashader-runtime-d3d11/Cargo.toml @@ -17,7 +17,6 @@ librashader-presets = { path = "../librashader-presets", version = "0.2.0-beta.9 librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.9" } librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.9" } librashader-runtime = { path = "../librashader-runtime", version = "0.2.0-beta.9" } -spirv_cross = { package = "librashader-spirv-cross", version = "0.23" } librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.9", features = ["d3d"] } thiserror = "1.0.37" diff --git a/librashader-runtime-d3d11/src/error.rs b/librashader-runtime-d3d11/src/error.rs index f5c99bf..660f2f9 100644 --- a/librashader-runtime-d3d11/src/error.rs +++ b/librashader-runtime-d3d11/src/error.rs @@ -13,8 +13,6 @@ pub enum FilterChainError { Direct3DOperationError(&'static str), #[error("direct3d driver error")] Direct3DError(#[from] windows::core::Error), - #[error("SPIRV reflection error")] - SpirvCrossReflectError(#[from] spirv_cross::ErrorCode), #[error("shader preset parse error")] ShaderPresetError(#[from] ParsePresetError), #[error("shader preprocess error")] diff --git a/librashader-runtime-d3d12/Cargo.toml b/librashader-runtime-d3d12/Cargo.toml index 5a59fd8..ef936d2 100644 --- a/librashader-runtime-d3d12/Cargo.toml +++ b/librashader-runtime-d3d12/Cargo.toml @@ -20,7 +20,6 @@ librashader-runtime = { path = "../librashader-runtime", version = "0.2.0-beta.9 librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.9", features = ["d3d"] } thiserror = "1.0.37" -spirv_cross = { package = "librashader-spirv-cross", version = "0.23" } parking_lot = "0.12.1" rustc-hash = "1.1.0" diff --git a/librashader-runtime-d3d12/src/error.rs b/librashader-runtime-d3d12/src/error.rs index 09d2ad3..1d1bb4d 100644 --- a/librashader-runtime-d3d12/src/error.rs +++ b/librashader-runtime-d3d12/src/error.rs @@ -9,8 +9,6 @@ pub enum FilterChainError { Direct3DOperationError(&'static str), #[error("direct3d driver error")] Direct3DError(#[from] windows::core::Error), - #[error("SPIRV reflection error")] - SpirvCrossReflectError(#[from] spirv_cross::ErrorCode), #[error("shader preset parse error")] ShaderPresetError(#[from] ParsePresetError), #[error("shader preprocess error")] diff --git a/librashader-runtime-d3d12/src/filter_chain.rs b/librashader-runtime-d3d12/src/filter_chain.rs index 6b11602..c31a7ec 100644 --- a/librashader-runtime-d3d12/src/filter_chain.rs +++ b/librashader-runtime-d3d12/src/filter_chain.rs @@ -27,7 +27,6 @@ use librashader_runtime::image::{Image, ImageError, UVDirection}; use librashader_runtime::quad::QuadType; use librashader_runtime::uniforms::UniformStorage; use rustc_hash::FxHashMap; -use spirv_cross::hlsl::ShaderModel; use std::collections::VecDeque; use std::mem::ManuallyDrop; use std::path::Path; @@ -502,7 +501,9 @@ impl FilterChainD3D12 { (dxil_reflection, graphics_pipeline) } else { let hlsl_reflection = hlsl.reflect(index, semantics)?; - let hlsl = hlsl.compile(Some(ShaderModel::V6_0))?; + let hlsl = hlsl.compile( + Some(librashader_reflect::back::hlsl::HlslShaderModel::V6_0) + )?; let graphics_pipeline = D3D12GraphicsPipeline::new_from_hlsl( device, diff --git a/librashader-runtime-gl/Cargo.toml b/librashader-runtime-gl/Cargo.toml index a724f29..9489e8a 100644 --- a/librashader-runtime-gl/Cargo.toml +++ b/librashader-runtime-gl/Cargo.toml @@ -18,8 +18,8 @@ librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.0- librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.9" } librashader-runtime = { path = "../librashader-runtime" , version = "0.2.0-beta.9" } librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.9" } +spirv_cross = { package = "librashader-spirv-cross", version = "0.24" } -spirv_cross = { package = "librashader-spirv-cross", version = "0.23" } rustc-hash = "1.1.0" gl = "0.14.0" bytemuck = "1.12.3" diff --git a/librashader-runtime-vk/Cargo.toml b/librashader-runtime-vk/Cargo.toml index e7bba84..514b099 100644 --- a/librashader-runtime-vk/Cargo.toml +++ b/librashader-runtime-vk/Cargo.toml @@ -21,7 +21,6 @@ librashader-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.9 librashader-runtime = { path = "../librashader-runtime" , version = "0.2.0-beta.9" } librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.9" } -spirv_cross = { package = "librashader-spirv-cross", version = "0.23" } rustc-hash = "1.1.0" bytemuck = "1.12.3" thiserror = "1.0.37" diff --git a/librashader-runtime-vk/src/error.rs b/librashader-runtime-vk/src/error.rs index 252797b..56e6041 100644 --- a/librashader-runtime-vk/src/error.rs +++ b/librashader-runtime-vk/src/error.rs @@ -10,8 +10,6 @@ use thiserror::Error; /// Cumulative error type for Vulkan filter chains. #[derive(Error, Debug)] pub enum FilterChainError { - #[error("SPIRV reflection error")] - SpirvCrossReflectError(#[from] spirv_cross::ErrorCode), #[error("shader preset parse error")] ShaderPresetError(#[from] ParsePresetError), #[error("shader preprocess error")] diff --git a/test/basic.slang b/test/basic.slang index 4d26a5f..6638990 100644 --- a/test/basic.slang +++ b/test/basic.slang @@ -4,6 +4,7 @@ layout(set = 0, binding = 0, std140) uniform UBO { mat4 MVP; + float ColorMod2; }; layout(push_constant) uniform Push { @@ -13,6 +14,7 @@ layout(push_constant) uniform Push { #pragma name StockShader #pragma format R8G8B8A8_UNORM #pragma parameter ColorMod "Color intensity" 1.0 0.1 2.0 0.1 +#pragma parameter ColorMod2 "Color intensity" 1.0 0.1 2.0 0.1 #pragma stage vertex layout(location = 0) in vec4 Position; @@ -30,5 +32,5 @@ layout(location = 0) out vec4 FragColor; layout(binding = 1) uniform sampler2D Source; void main() { - FragColor = texture(Source, vTexCoord) * params.ColorMod; + FragColor = texture(Source, vTexCoord) * params.ColorMod * ColorMod2; } \ No newline at end of file