dep: upgrade librashader-spirv-cross

This commit is contained in:
chyyran 2024-02-11 13:21:50 -05:00 committed by Ronny Chan
parent 178790a202
commit d0a5224c10
13 changed files with 29 additions and 34 deletions

26
Cargo.lock generated
View file

@ -35,9 +35,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.7.7" version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"once_cell", "once_cell",
@ -46,9 +46,9 @@ dependencies = [
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.8.7" version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"getrandom", "getrandom",
@ -1209,7 +1209,7 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [ dependencies = [
"ahash 0.7.7", "ahash 0.7.8",
] ]
[[package]] [[package]]
@ -1218,7 +1218,7 @@ version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [ dependencies = [
"ahash 0.8.7", "ahash 0.8.8",
"allocator-api2", "allocator-api2",
] ]
@ -1632,7 +1632,6 @@ dependencies = [
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.9",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"librashader-spirv-cross",
"rayon", "rayon",
"rustc-hash", "rustc-hash",
"thiserror", "thiserror",
@ -1654,7 +1653,6 @@ dependencies = [
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.9",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"librashader-spirv-cross",
"parking_lot", "parking_lot",
"rayon", "rayon",
"rustc-hash", "rustc-hash",
@ -1698,7 +1696,6 @@ dependencies = [
"librashader-presets 0.2.0-beta.9", "librashader-presets 0.2.0-beta.9",
"librashader-reflect", "librashader-reflect",
"librashader-runtime", "librashader-runtime",
"librashader-spirv-cross",
"num", "num",
"parking_lot", "parking_lot",
"raw-window-handle 0.5.2", "raw-window-handle 0.5.2",
@ -1734,10 +1731,11 @@ dependencies = [
[[package]] [[package]]
name = "librashader-spirv-cross" name = "librashader-spirv-cross"
version = "0.23.5" version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc8e651a93a3bec5cec3264949f8ca9a8c4cbd09f03911af789000e3cebf98f6" checksum = "1842c733107d5f223c30a9d9c532d8f4bfd403d51e9ce22c53d6248a0ffa8318"
dependencies = [ dependencies = [
"build-target",
"cc", "cc",
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -3578,7 +3576,7 @@ version = "0.29.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c824f11941eeae66ec71111cc2674373c772f482b58939bb4066b642aa2ffcf" checksum = "4c824f11941eeae66ec71111cc2674373c772f482b58939bb4066b642aa2ffcf"
dependencies = [ dependencies = [
"ahash 0.8.7", "ahash 0.8.8",
"android-activity", "android-activity",
"atomic-waker", "atomic-waker",
"bitflags 2.4.2", "bitflags 2.4.2",
@ -3679,9 +3677,9 @@ checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911"
[[package]] [[package]]
name = "xkbcommon-dl" name = "xkbcommon-dl"
version = "0.4.1" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6924668544c48c0133152e7eec86d644a056ca3d09275eb8d5cdb9855f9d8699" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.4.2",
"dlib", "dlib",

View file

@ -29,7 +29,7 @@ paste = "1.0.9"
gl = { version = "0.14.0", optional = true } gl = { version = "0.14.0", optional = true }
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
ash = { version = "0.37", optional = true } 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] [target.'cfg(windows)'.dependencies.windows]
version = "0.48.0" version = "0.48.0"

View file

@ -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-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.9" }
librashader-presets = { path = "../librashader-presets", 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 } naga = { version = "0.19.0", features = ["spv-in", "spv-out"], optional = true }
rspirv = { version = "0.12.0", optional = true } rspirv = { version = "0.12.0", optional = true }

View file

@ -31,15 +31,15 @@ impl CompileShader<MSL> for CrossReflect<spirv_cross::msl::Target> {
for resource in &resources.push_constant_buffers { for resource in &resources.push_constant_buffers {
let location = ResourceBindingLocation { let location = ResourceBindingLocation {
stage, stage,
desc_set: u32::MAX, // ResourceBindingPushConstantDescriptorSet desc_set: msl::PUSH_CONSTANT_DESCRIPTOR_SET,
binding: 0, binding: msl::PUSH_CONSTANT_BINDING,
}; };
let overridden = ResourceBinding { let overridden = ResourceBinding {
buffer_id: ast.get_decoration(resource.id, Decoration::Binding)?, buffer_id: ast.get_decoration(resource.id, Decoration::Binding)?,
texture_id: 0, texture_id: 0,
sampler_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); binding_map.insert(location, overridden);
@ -57,7 +57,8 @@ impl CompileShader<MSL> for CrossReflect<spirv_cross::msl::Target> {
buffer_id: binding, buffer_id: binding,
texture_id: binding, texture_id: binding,
sampler_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); binding_map.insert(location, overridden);
@ -77,6 +78,7 @@ impl CompileShader<MSL> for CrossReflect<spirv_cross::msl::Target> {
&mut frag_options.resource_binding_overrides &mut frag_options.resource_binding_overrides
)?; )?;
eprintln!("{:?}", frag_options.resource_binding_overrides);
self.vertex.set_compiler_options(&vert_options)?; self.vertex.set_compiler_options(&vert_options)?;
self.fragment.set_compiler_options(&frag_options)?; self.fragment.set_compiler_options(&frag_options)?;
@ -95,6 +97,7 @@ impl CompileShader<MSL> for CrossReflect<spirv_cross::msl::Target> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::io::Write;
use crate::back::targets::{MSL, WGSL}; use crate::back::targets::{MSL, WGSL};
use crate::back::{CompileShader, FromCompilation}; use crate::back::{CompileShader, FromCompilation};
use crate::reflect::naga::{Naga, NagaLoweringOptions}; use crate::reflect::naga::{Naga, NagaLoweringOptions};

View file

@ -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-preprocess = { path = "../librashader-preprocess", version = "0.2.0-beta.9" }
librashader-reflect = { path = "../librashader-reflect", 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" } 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"] } librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.9", features = ["d3d"] }
thiserror = "1.0.37" thiserror = "1.0.37"

View file

@ -13,8 +13,6 @@ pub enum FilterChainError {
Direct3DOperationError(&'static str), Direct3DOperationError(&'static str),
#[error("direct3d driver error")] #[error("direct3d driver error")]
Direct3DError(#[from] windows::core::Error), Direct3DError(#[from] windows::core::Error),
#[error("SPIRV reflection error")]
SpirvCrossReflectError(#[from] spirv_cross::ErrorCode),
#[error("shader preset parse error")] #[error("shader preset parse error")]
ShaderPresetError(#[from] ParsePresetError), ShaderPresetError(#[from] ParsePresetError),
#[error("shader preprocess error")] #[error("shader preprocess error")]

View file

@ -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"] } librashader-cache = { path = "../librashader-cache", version = "0.2.0-beta.9", features = ["d3d"] }
thiserror = "1.0.37" thiserror = "1.0.37"
spirv_cross = { package = "librashader-spirv-cross", version = "0.23" }
parking_lot = "0.12.1" parking_lot = "0.12.1"
rustc-hash = "1.1.0" rustc-hash = "1.1.0"

View file

@ -9,8 +9,6 @@ pub enum FilterChainError {
Direct3DOperationError(&'static str), Direct3DOperationError(&'static str),
#[error("direct3d driver error")] #[error("direct3d driver error")]
Direct3DError(#[from] windows::core::Error), Direct3DError(#[from] windows::core::Error),
#[error("SPIRV reflection error")]
SpirvCrossReflectError(#[from] spirv_cross::ErrorCode),
#[error("shader preset parse error")] #[error("shader preset parse error")]
ShaderPresetError(#[from] ParsePresetError), ShaderPresetError(#[from] ParsePresetError),
#[error("shader preprocess error")] #[error("shader preprocess error")]

View file

@ -27,7 +27,6 @@ use librashader_runtime::image::{Image, ImageError, UVDirection};
use librashader_runtime::quad::QuadType; use librashader_runtime::quad::QuadType;
use librashader_runtime::uniforms::UniformStorage; use librashader_runtime::uniforms::UniformStorage;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use spirv_cross::hlsl::ShaderModel;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::mem::ManuallyDrop; use std::mem::ManuallyDrop;
use std::path::Path; use std::path::Path;
@ -502,7 +501,9 @@ impl FilterChainD3D12 {
(dxil_reflection, graphics_pipeline) (dxil_reflection, graphics_pipeline)
} else { } else {
let hlsl_reflection = hlsl.reflect(index, semantics)?; 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( let graphics_pipeline = D3D12GraphicsPipeline::new_from_hlsl(
device, device,

View file

@ -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-reflect = { path = "../librashader-reflect", version = "0.2.0-beta.9" }
librashader-runtime = { path = "../librashader-runtime" , 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" } 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" rustc-hash = "1.1.0"
gl = "0.14.0" gl = "0.14.0"
bytemuck = "1.12.3" bytemuck = "1.12.3"

View file

@ -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-runtime = { path = "../librashader-runtime" , version = "0.2.0-beta.9" }
librashader-cache = { path = "../librashader-cache", 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" rustc-hash = "1.1.0"
bytemuck = "1.12.3" bytemuck = "1.12.3"
thiserror = "1.0.37" thiserror = "1.0.37"

View file

@ -10,8 +10,6 @@ use thiserror::Error;
/// Cumulative error type for Vulkan filter chains. /// Cumulative error type for Vulkan filter chains.
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum FilterChainError { pub enum FilterChainError {
#[error("SPIRV reflection error")]
SpirvCrossReflectError(#[from] spirv_cross::ErrorCode),
#[error("shader preset parse error")] #[error("shader preset parse error")]
ShaderPresetError(#[from] ParsePresetError), ShaderPresetError(#[from] ParsePresetError),
#[error("shader preprocess error")] #[error("shader preprocess error")]

View file

@ -4,6 +4,7 @@
layout(set = 0, binding = 0, std140) uniform UBO layout(set = 0, binding = 0, std140) uniform UBO
{ {
mat4 MVP; mat4 MVP;
float ColorMod2;
}; };
layout(push_constant) uniform Push { layout(push_constant) uniform Push {
@ -13,6 +14,7 @@ layout(push_constant) uniform Push {
#pragma name StockShader #pragma name StockShader
#pragma format R8G8B8A8_UNORM #pragma format R8G8B8A8_UNORM
#pragma parameter ColorMod "Color intensity" 1.0 0.1 2.0 0.1 #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 #pragma stage vertex
layout(location = 0) in vec4 Position; layout(location = 0) in vec4 Position;
@ -30,5 +32,5 @@ layout(location = 0) out vec4 FragColor;
layout(binding = 1) uniform sampler2D Source; layout(binding = 1) uniform sampler2D Source;
void main() void main()
{ {
FragColor = texture(Source, vTexCoord) * params.ColorMod; FragColor = texture(Source, vTexCoord) * params.ColorMod * ColorMod2;
} }