Files
wgpu/wgpu/Cargo.toml
T

224 lines
7.3 KiB
TOML

[package]
name = "wgpu"
version.workspace = true
authors.workspace = true
edition.workspace = true
description = "Cross-platform, safe, pure-rust graphics API"
homepage.workspace = true
repository.workspace = true
keywords.workspace = true
license.workspace = true
rust-version.workspace = true
readme = "../README.md"
exclude = ["Cargo.lock"]
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"wasm32-unknown-unknown",
]
[package.metadata.cargo-machete]
# Cargo machete can't check build.rs dependencies. See https://github.com/bnjbvr/cargo-machete/issues/100
ignored = ["cfg_aliases"]
[lib]
[features]
default = ["wgsl", "dx12", "metal", "webgpu"]
#! ### Backends
# --------------------------------------------------------------------
#! ⚠️ WIP: Not all backends can be manually configured today.
#! On Windows, Linux & Android the Vulkan & GLES backends are always enabled.
#! See [#3514](https://github.com/gfx-rs/wgpu/issues/3514) for more details.
## Enables the DX12 backend on Windows.
dx12 = ["wgpu-core?/dx12"]
## Enables the Metal backend on macOS & iOS.
metal = ["wgpu-core?/metal"]
## Enables the WebGPU backend on Wasm. Disabled when targeting `emscripten`.
webgpu = ["naga?/wgsl-out"]
## Enables the GLES backend via [ANGLE](https://github.com/google/angle) on macOS using.
angle = ["wgpu-core?/gles"]
## Enables the Vulkan backend on macOS & iOS.
vulkan-portability = ["wgpu-core?/vulkan"]
## Enables the GLES backend on Wasm
##
## * ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.
webgl = ["dep:wgpu-hal", "wgpu-core/gles"]
## Enables the noop backend for testing.
##
## This backend allows creating resources such as buffers and textures,
## but performs no computation.
## Because it lacks basic functionality, it is only actually used if explicitly enabled
## through `NoopBackendOptions`.
noop = ["wgpu-core/noop"]
#! **Note:** In the documentation, if you see that an item depends on a backend,
#! it means that the item is only available when that backend is enabled _and_ the backend
#! is supported on the current platform.
#! ### Shading language support
# --------------------------------------------------------------------
## Enable accepting SPIR-V shaders as input.
spirv = ["naga/spv-in", "wgpu-core?/spirv"]
## Enable accepting GLSL shaders as input.
glsl = ["naga/glsl-in", "wgpu-core?/glsl"]
## Enable accepting WGSL shaders as input.
wgsl = ["wgpu-core?/wgsl"]
## Enable accepting naga IR shaders as input.
naga-ir = ["dep:naga"]
#! ### Logging & Tracing
# --------------------------------------------------------------------
#! The following features do not have any effect on the WebGPU backend.
## Apply run-time checks, even in release builds. These are in addition
## to the validation carried out at public APIs in all builds.
strict_asserts = ["wgpu-core?/strict_asserts", "wgpu-types/strict_asserts"]
## Enables serialization via `serde` on common wgpu types.
serde = ["dep:serde", "wgpu-core?/serde"]
# Uncomment once we get to https://github.com/gfx-rs/wgpu/issues/5974
# ## Allow writing of trace capture files. See [`Adapter::request_device`].
# trace = ["serde", "wgpu-core/trace"]
## Allow deserializing of trace capture files that were written with the `trace` feature.
## To replay a trace file use the [wgpu player](https://github.com/gfx-rs/wgpu/tree/trunk/player).
replay = ["serde", "wgpu-core?/replay"]
#! ### Other
# --------------------------------------------------------------------
## Internally count resources and events for debugging purposes. If the counters
## feature is disabled, the counting infrastructure is removed from the build and
## the exposed counters always return 0.
counters = ["wgpu-core?/counters"]
## Implement `Send` and `Sync` on Wasm, but only if atomics are not enabled.
##
## WebGL/WebGPU objects can not be shared between threads.
## However, it can be useful to artificially mark them as `Send` and `Sync`
## anyways to make it easier to write cross-platform code.
## This is technically *very* unsafe in a multithreaded environment,
## but on a wasm binary compiled without atomics we know we are definitely
## not in a multithreaded environment.
fragile-send-sync-non-atomic-wasm = [
"wgpu-hal?/fragile-send-sync-non-atomic-wasm",
"wgpu-core?/fragile-send-sync-non-atomic-wasm",
"wgpu-types/fragile-send-sync-non-atomic-wasm",
]
#! ### External libraries
# --------------------------------------------------------------------
#! The following features facilitate integration with third-party supporting libraries.
## Enables statically linking DXC.
## Normally, to use the modern DXC shader compiler with WGPU, the final application
## must be shipped alongside `dxcompiler.dll` and `dxil.dll` (which can be downloaded from Microsoft's GitHub).
## This feature statically links a version of DXC so that no external binaries are required
## to compile DX12 shaders.
static-dxc = ["wgpu-hal?/static-dxc"]
#########################
# Standard Dependencies #
#########################
[dependencies]
naga = { workspace = true, optional = true }
wgpu-core = { workspace = true, optional = true }
wgpu-types = { workspace = true, features = ["serde"] }
arrayvec.workspace = true
bitflags.workspace = true
document-features.workspace = true
hashbrown.workspace = true
log.workspace = true
parking_lot.workspace = true
profiling.workspace = true
raw-window-handle = { workspace = true, features = ["std"] }
serde = { workspace = true, features = ["default", "derive"], optional = true }
smallvec.workspace = true
static_assertions.workspace = true
########################################
# Target Specific Feature Dependencies #
########################################
# Windows
[target.'cfg(windows)'.dependencies]
wgpu-core = { workspace = true, features = [
"raw-window-handle",
"vulkan",
"gles",
] }
wgpu-hal = { workspace = true, features = ["renderdoc"] }
# Apple Platforms
[target.'cfg(target_vendor = "apple")'.dependencies]
wgpu-core = { workspace = true, features = ["raw-window-handle"] }
wgpu-hal = { workspace = true, features = [] }
# Linux + Android
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
wgpu-core = { workspace = true, features = [
"raw-window-handle",
"vulkan",
"gles",
] }
wgpu-hal = { workspace = true, features = ["renderdoc"] }
# Webassembly
[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
wgpu-core = { workspace = true, optional = true, features = [
"raw-window-handle",
] }
wgpu-hal = { workspace = true, optional = true }
js-sys = { workspace = true, features = ["default"] }
parking_lot.workspace = true
wasm-bindgen-futures.workspace = true
wasm-bindgen.workspace = true
web-sys = { workspace = true, features = [
"default",
"Document",
"Navigator",
"Node",
"NodeList",
"HtmlCanvasElement",
"OffscreenCanvas",
"ImageBitmap",
"ImageBitmapRenderingContext",
"Window",
"WorkerGlobalScope",
"WorkerNavigator",
# Needed by webgpu_sys
"Event",
"EventTarget",
] }
# Emscripten
[target.'cfg(target_os = "emscripten")'.dependencies]
wgpu-core = { workspace = true, features = ["raw-window-handle", "gles"] }
wgpu-hal = { workspace = true }
[build-dependencies]
cfg_aliases.workspace = true