dep: upgrade to spirv-to-dxil 0.3

This commit is contained in:
chyyran 2023-02-06 19:22:53 -05:00
parent 8588021a6e
commit 3ad67d9539
8 changed files with 17 additions and 115 deletions

105
Cargo.lock generated
View file

@ -64,28 +64,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bindgen"
version = "0.63.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885"
dependencies = [
"bitflags",
"cexpr",
"clang-sys",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"syn",
"which",
]
[[package]]
name = "bit-set"
version = "0.5.3"
@ -185,32 +163,12 @@ dependencies = [
"jobserver",
]
[[package]]
name = "cexpr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
dependencies = [
"nom",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clang-sys"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]]
name = "cmake"
version = "0.1.49"
@ -661,12 +619,6 @@ dependencies = [
"cmake",
]
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "hashbrown"
version = "0.12.3"
@ -769,12 +721,6 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.139"
@ -1348,12 +1294,6 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba"
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "percent-encoding"
version = "2.2.0"
@ -1492,21 +1432,6 @@ dependencies = [
"bitflags",
]
[[package]]
name = "regex"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
name = "roxmltree"
version = "0.14.1"
@ -1625,12 +1550,6 @@ dependencies = [
"roxmltree",
]
[[package]]
name = "shlex"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]]
name = "slotmap"
version = "1.0.6"
@ -1677,21 +1596,22 @@ dependencies = [
[[package]]
name = "spirv-to-dxil"
version = "0.2.5"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eb2294ffb1db58f59cd21ba6f75bce09c6a3efbce8f66e7e133d79753deccd3"
checksum = "fe416a0585b1f9d8d87c563c12b45c1075921d6250d5975c34bfa95617336ee7"
dependencies = [
"bitflags",
"bytemuck",
"spirv-to-dxil-sys",
"thiserror",
]
[[package]]
name = "spirv-to-dxil-sys"
version = "0.2.3"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a5fb60ed3db4f27a7cf2a1a17f08d1bd4db3b6d76e419b6e8763b9f39fecd85"
checksum = "9e28ad63f8369949dd21f4fc30e3e424902680ede7c6fbb240d889ceec9665ef"
dependencies = [
"bindgen",
"bytemuck",
"cmake",
]
@ -1964,17 +1884,6 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
[[package]]
name = "which"
version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
dependencies = [
"either",
"libc",
"once_cell",
]
[[package]]
name = "widestring"
version = "1.0.2"

View file

@ -23,7 +23,7 @@ librashader-common = { path = "../librashader-common", version = "0.1.0-beta.12"
librashader-preprocess = { path = "../librashader-preprocess", version = "0.1.0-beta.12" }
librashader-presets = { path = "../librashader-presets", version = "0.1.0-beta.12" }
spirv-to-dxil = { version = "0.2", optional = true }
spirv-to-dxil = { version = "0.3", optional = true }
naga = { version = "0.10.0", features = ["glsl-in", "spv-in", "spv-out", "glsl-out", "wgsl-out"], optional = true }
bytemuck = "1.13.0"
@ -34,8 +34,3 @@ default = ["dxil"]
unstable-naga = [ "naga", "rspirv" ]
standalone = ["shaderc/build-from-source"]
dxil = ["spirv-to-dxil"]
[dev-dependencies]
[package.metadata.docs.rs]
features = ["spirv-to-dxil/included-bindings"]

View file

@ -2,7 +2,7 @@ use crate::back::spirv::WriteSpirV;
use crate::back::{CompileShader, CompilerBackend, FromCompilation, ShaderCompilerOutput};
pub use spirv_to_dxil::DxilObject;
pub use spirv_to_dxil::ShaderModel;
use spirv_to_dxil::{ConstantBufferConfig, RuntimeConfig, ShaderStage, ValidatorVersion};
use spirv_to_dxil::{PushConstantBufferConfig, RuntimeConfig, RuntimeDataBufferConfig, ShaderStage, ValidatorVersion};
use crate::back::targets::{OutputTarget, DXIL};
use crate::error::{ShaderCompileError, ShaderReflectError};
@ -49,11 +49,11 @@ impl CompileShader<DXIL> for WriteSpirV {
let sm = options.unwrap_or(ShaderModel::ShaderModel6_0);
let config = RuntimeConfig {
runtime_data_cbv: ConstantBufferConfig {
runtime_data_cbv: RuntimeDataBufferConfig {
register_space: 0,
base_shader_register: u32::MAX,
},
push_constant_cbv: ConstantBufferConfig {
push_constant_cbv: PushConstantBufferConfig {
register_space: 0,
base_shader_register: 1,
},
@ -68,7 +68,7 @@ impl CompileShader<DXIL> for WriteSpirV {
ShaderStage::Vertex,
sm,
ValidatorVersion::None,
config.clone(),
&config,
)
.map_err(ShaderCompileError::SpirvToDxilCompileError)?;
@ -79,7 +79,7 @@ impl CompileShader<DXIL> for WriteSpirV {
ShaderStage::Fragment,
sm,
ValidatorVersion::None,
config,
&config,
)
.map_err(ShaderCompileError::SpirvToDxilCompileError)?;

View file

@ -25,7 +25,7 @@ pub enum ShaderCompileError {
/// Error when transpiling from spirv-to-dxil
#[cfg(feature = "dxil")]
#[error("spirv-to-dxil")]
SpirvToDxilCompileError(String),
SpirvToDxilCompileError(#[from] spirv_to_dxil::SpirvToDxilError),
}
/// The error kind encountered when reflecting shader semantics.

View file

@ -7,7 +7,7 @@ use crate::reflect::semantics::{
MAX_BINDINGS_COUNT, MAX_PUSH_BUFFER_SIZE,
};
use crate::reflect::{align_uniform_size, ReflectShader};
use std::ops::{Deref, DerefMut};
use std::ops::Deref;
use spirv_cross::hlsl::ShaderModel;
use spirv_cross::spirv::{Ast, Decoration, Module, Resource, ShaderResources, Type};

View file

@ -3,8 +3,6 @@ use crate::texture::InputTexture;
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_preprocess::ShaderSource;
use librashader_presets::ShaderPassConfig;
use librashader_reflect::back::cross::CrossHlslContext;
use librashader_reflect::back::ShaderCompilerOutput;
use librashader_reflect::reflect::semantics::{
BindingStage, MemberOffset, TextureBinding, UniformBinding,
};

View file

@ -398,7 +398,7 @@ impl FilterChainD3D12 {
ImageFormat::R8G8B8A8Unorm
}.into();
/// incredibly cursed.
// incredibly cursed.
let (reflection, graphics_pipeline) = if !force_hlsl &&
let Ok(graphics_pipeline) =
D3D12GraphicsPipeline::new_from_dxil(

View file

@ -5,7 +5,7 @@ use librashader_reflect::reflect::semantics::BindingStage;
use std::mem::ManuallyDrop;
use std::u64;
use widestring::u16cstr;
use windows::core::{Interface, PCSTR, PCWSTR};
use windows::core::{PCSTR, PCWSTR};
use windows::Win32::Graphics::Direct3D::Dxc::{
DxcValidatorFlags_InPlaceEdit, IDxcBlob, IDxcCompiler, IDxcUtils, IDxcValidator, DXC_CP,
DXC_CP_UTF8,