Skip to content

Commit

Permalink
Introduce hlsl-out-if-target-windows feature to Naga
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf authored and teoxoy committed Jul 9, 2024
1 parent e1913b1 commit 7c51bb4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
11 changes: 11 additions & 0 deletions naga/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,18 @@ spv-in = ["dep:petgraph", "dep:spirv"]
spv-out = ["dep:spirv"]
wgsl-in = ["dep:hexf-parse", "dep:unicode-xid", "compact"]
wgsl-out = []

## Enables outputting to HLSL (Microsoft's High-Level Shader Language).
##
## This enables HLSL output regardless of the target platform.
## If you want to enable it only when targeting Windows, use `hlsl-out-if-target-windows`.
hlsl-out = []

## Enables outputting to HLSL (Microsoft's High-Level Shader Language) only if the target platform is Windows.
##
## If you want to enable HLSL output it regardless of the target platform, use `naga/hlsl-out`.
hlsl-out-if-target-windows = []

compact = []

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion naga/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fn main() {
cfg_aliases::cfg_aliases! {
dot_out: { feature = "dot-out" },
glsl_out: { feature = "glsl-out" },
hlsl_out: { feature = "hlsl-out" },
hlsl_out: { any(feature = "hlsl-out", all(target_os = "windows", feature = "hlsl-out-if-target-windows")) },
msl_out: { any(feature = "msl-out", all(any(target_os = "ios", target_os = "macos"), feature = "msl-out-if-target-apple")) },
spv_out: { feature = "spv-out" },
wgsl_out: { feature = "wgsl-out" },
Expand Down
6 changes: 5 additions & 1 deletion wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ gles = [
"dep:ndk-sys",
"winapi/libloaderapi",
]
## Enables the DX12 backend when targeting Windows.
##
## Has no effect if not targeting Windows.
dx12 = [
"naga/hlsl-out",
# DX12 is only available on Windows, therefore request HLSL output also only if we target Windows.
"naga/hlsl-out-if-target-windows",
"dep:d3d12",
"dep:bit-set",
"dep:libloading",
Expand Down

0 comments on commit 7c51bb4

Please sign in to comment.