diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e8e25a..c0daede 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,9 +39,6 @@ jobs: - if: runner.os == 'Windows' run: pip install meson ninja mako name: Install Meson for spirv-to-dxil-sys - - if: runner.os == 'Linux' - name: Install Mesa build deps - run: apt-get build-dep mesa - name: Build dynamic library run: cargo run -p librashader-build-script -- --profile ${{ matrix.profile }} - name: Upload build artifacts diff --git a/librashader-cache/Cargo.toml b/librashader-cache/Cargo.toml index 1266a72..7f150c7 100644 --- a/librashader-cache/Cargo.toml +++ b/librashader-cache/Cargo.toml @@ -12,7 +12,7 @@ description = "RetroArch shaders for all." [dependencies] serde = { version = "1.0" } -librashader-reflect = { path = "../librashader-reflect", version = "0.1.4", features = ["serialize", "dxil"] } +librashader-reflect = { path = "../librashader-reflect", version = "0.1.4", features = ["serialize"] } librashader-preprocess = { path = "../librashader-preprocess", version = "0.1.4" } platform-dirs = "0.3.0" blake3 = { version = "1.3.3" } @@ -32,7 +32,7 @@ features = [ optional = true [features] -d3d = ["windows"] +d3d = ["windows", "librashader-reflect/dxil"] # hack to get building on docsrs docsrs = ["blake3/pure", "rusqlite/in_gecko"] diff --git a/librashader-cache/src/compilation.rs b/librashader-cache/src/compilation.rs index b3feeca..df094f5 100644 --- a/librashader-cache/src/compilation.rs +++ b/librashader-cache/src/compilation.rs @@ -56,6 +56,7 @@ impl serde::Deserialize<'de> + serde::Serialize } } +#[cfg(all(target_os = "windows", feature = "d3d"))] impl FromCompilation> for DXIL { type Target = >::Target; type Options = >::Options; diff --git a/librashader-reflect/Cargo.toml b/librashader-reflect/Cargo.toml index db3bb78..09981b3 100644 --- a/librashader-reflect/Cargo.toml +++ b/librashader-reflect/Cargo.toml @@ -24,12 +24,16 @@ librashader-preprocess = { path = "../librashader-preprocess", version = "0.1.4" librashader-presets = { path = "../librashader-presets", version = "0.1.4" } spirv_cross = { package = "librashader-spirv-cross", version = "0.23", optional = true } -spirv-to-dxil = { version = "0.4", optional = true } naga = { version = "0.11.0", features = ["glsl-in", "spv-in", "spv-out", "glsl-out", "wgsl-out"], optional = true } rspirv = { version = "0.11.0+1.5.4", optional = true } serde = { version = "1.0", features = ["derive"], optional = true } + +[target.'cfg(windows)'.dependencies.spirv-to-dxil] +version = "0.4" +optional = true + [features] default = ["cross", "serialize"] unstable-naga = [ "naga", "rspirv" ] diff --git a/librashader-reflect/src/back/mod.rs b/librashader-reflect/src/back/mod.rs index cdd87bc..8022c4b 100644 --- a/librashader-reflect/src/back/mod.rs +++ b/librashader-reflect/src/back/mod.rs @@ -1,5 +1,5 @@ pub mod cross; -#[cfg(feature = "dxil")] +#[cfg(all(target_os = "windows", feature = "dxil"))] pub mod dxil; mod spirv; pub mod targets; diff --git a/librashader-reflect/src/error.rs b/librashader-reflect/src/error.rs index d83a309..1175686 100644 --- a/librashader-reflect/src/error.rs +++ b/librashader-reflect/src/error.rs @@ -23,7 +23,7 @@ pub enum ShaderCompileError { SpirvCrossCompileError(#[from] spirv_cross::ErrorCode), /// Error when transpiling from spirv-to-dxil - #[cfg(feature = "dxil")] + #[cfg(all(target_os = "windows", feature = "dxil"))] #[error("spirv-to-dxil")] SpirvToDxilCompileError(#[from] spirv_to_dxil::SpirvToDxilError), } diff --git a/librashader/src/lib.rs b/librashader/src/lib.rs index 555381d..5de5194 100644 --- a/librashader/src/lib.rs +++ b/librashader/src/lib.rs @@ -170,8 +170,8 @@ pub mod reflect { } /// DXIL reflection via spirv-to-dxil. - #[cfg(feature = "reflect-dxil")] - #[doc(cfg(feature = "reflect-dxil"))] + #[cfg(all(target_os = "windows", feature = "reflect-dxil"))] + #[doc(cfg(all(target_os = "windows", feature = "reflect-dxil")))] pub mod dxil { /// The maximum shader model to use when compiling the DXIL blob. pub use librashader_reflect::back::dxil::ShaderModel;