Introduce hlsl-out-if-target-windows feature to Naga

This commit is contained in:
Andreas Reich 2024-07-06 11:11:54 +02:00 committed by Teodor Tanasoaia
parent e1913b1209
commit 7c51bb4a13
3 changed files with 17 additions and 2 deletions

View File

@ -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]

View File

@ -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" },

View File

@ -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",