Files
wgpu/wgpu/Cargo.toml
T
Bude 4face1c2ba Feature/serde feature (#5149)
* Add serde, serialize, deserialize features to wgpu and wgpu-core
Remove trace, replay features from wgpu-types

* Do not use trace, replay in wgpu-types anymore

* Make use of deserialize, serialize features in wgpu-core

* Make use of serialize, deserialize features in wgpu

* Run cargo fmt

* Use serde(default) for deserialize only

* Fix serial-pass feature

* Add a comment for new features

* Add CHANGELOG entry

* Run cargo fmt

* serial-pass also needs serde features for Id<T>

* Add feature documentation to lib.rs docs

* wgpu-types implicit serde feature

* wgpu-core explicit serde feature

* wgpu explicit serde feature

* Update CHANGELOG.md

* Fix compilation with default features

* Address review comments
2024-01-28 20:13:04 +00:00

323 lines
9.4 KiB
TOML

[package]
name = "wgpu"
version.workspace = true
authors.workspace = true
edition.workspace = true
description = "Rusty WebGPU API wrapper"
homepage.workspace = true
repository.workspace = true
keywords.workspace = true
license.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",
]
[lib]
[features]
default = ["wgsl", "dx12", "metal", "webgpu"]
#! ### Backends
# --------------------------------------------------------------------
#! ⚠️ WIP: Not all backends can be manually configured today.
#! On Windows & Linux 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 = ["wgc?/dx12"]
## Enables the Metal backend on macOS & iOS.
metal = ["wgc?/metal"]
## Enables the GLES backend via [ANGLE](https://github.com/google/angle) on macOS using.
angle = ["wgc?/gles"]
## Enables the Vulkan backend on macOS & iOS.
vulkan-portability = ["wgc?/vulkan"]
## Enables the WebGPU backend on Wasm. Disabled when targeting `emscripten`.
webgpu = ["naga?/wgsl-out"]
## Enables the GLES backend on Wasm
##
## * ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.
webgl = ["hal", "wgc/gles"]
#! ### Shading language support
# --------------------------------------------------------------------
## Enable accepting SPIR-V shaders as input.
spirv = ["naga/spv-in", "wgc/spirv"]
## Enable accepting GLSL shaders as input.
glsl = ["naga/glsl-in", "wgc/glsl"]
## Enable accepting WGSL shaders as input.
wgsl = ["wgc?/wgsl"]
## Enable accepting naga IR shaders as input.
naga-ir = ["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 = ["wgc?/strict_asserts", "wgt/strict_asserts"]
## Log all API entry points at info instead of trace level.
api_log_info = ["wgc/api_log_info"]
## Enables serialization via `serde` on common wgpu types.
serde = ["dep:serde", "wgc/serde"]
## Allow writing of trace capture files.
## See [`Adapter::request_device`].
trace = ["serde", "wgc/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", "wgc/replay"]
#! ### Other
# --------------------------------------------------------------------
## 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 = [
"hal/fragile-send-sync-non-atomic-wasm",
"wgc/fragile-send-sync-non-atomic-wasm",
"wgt/fragile-send-sync-non-atomic-wasm",
]
# wgpu-core is always available as an optional dependency, "wgc".
# Whenever wgpu-core is selected, we want raw window handle support.
[dependencies.wgc]
optional = true
workspace = true
features = ["raw-window-handle"]
# wgpu-core is required whenever not targeting web APIs directly.
# Whenever wgpu-core is selected, we want raw window handle support.
[target.'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))'.dependencies.wgc]
workspace = true
features = ["raw-window-handle"]
# Enable `wgc` by default on macOS and iOS to allow the `metal` crate feature to
# enable the Metal backend while being no-op on other targets.
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc]
workspace = true
# We want the wgpu-core Direct3D backend and OpenGL (via WGL) on Windows.
[target.'cfg(windows)'.dependencies.wgc]
workspace = true
features = ["gles"]
# We want the wgpu-core Vulkan backend on Unix (but not emscripten, macOS, iOS) and Windows.
[target.'cfg(any(windows, all(unix, not(target_os = "emscripten"), not(target_os = "ios"), not(target_os = "macos"))))'.dependencies.wgc]
workspace = true
features = ["vulkan"]
# We want the wgpu-core GLES backend on Unix (but not macOS, iOS).
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies.wgc]
workspace = true
features = ["gles"]
[dependencies.wgt]
workspace = true
# We need wgpu-hal unless we're targeting the web APIs.
[target.'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))'.dependencies]
hal = { workspace = true }
[target.'cfg(all(not(target_arch = "wasm32"), unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies]
hal = { workspace = true, features = ["renderdoc"] }
[target.'cfg(windows)'.dependencies]
hal = { workspace = true, features = [
"dxc_shader_compiler",
"renderdoc",
"windows_rs",
] }
[target.'cfg(target_arch = "wasm32")'.dependencies.hal]
workspace = true
optional = true
[dependencies]
arrayvec.workspace = true
cfg-if.workspace = true
log.workspace = true
parking_lot.workspace = true
profiling.workspace = true
raw-window-handle = { workspace = true, features = ["std"] }
serde = { workspace = true, features = ["derive"], optional = true }
smallvec.workspace = true
static_assertions.workspace = true
[dependencies.naga]
workspace = true
features = ["clone"]
optional = true
[build-dependencies]
cfg_aliases.workspace = true
# used to test all the example shaders
[dev-dependencies.naga]
workspace = true
features = ["wgsl-in"]
[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { workspace = true, features = [
"Document",
"Navigator",
"Node",
"NodeList",
"Gpu",
"GpuAdapter",
"GpuAddressMode",
"GpuAutoLayoutMode",
"GpuBindGroup",
"GpuBindGroupDescriptor",
"GpuBindGroupEntry",
"GpuBindGroupLayout",
"GpuBindGroupLayoutDescriptor",
"GpuBindGroupLayoutEntry",
"GpuBlendComponent",
"GpuBlendFactor",
"GpuBlendOperation",
"GpuBlendState",
"GpuBuffer",
"GpuBufferBinding",
"GpuBufferBindingLayout",
"GpuBufferBindingType",
"GpuBufferDescriptor",
"GpuCanvasAlphaMode",
"GpuCanvasContext",
"GpuCanvasConfiguration",
"GpuColorDict",
"GpuColorTargetState",
"GpuCommandBuffer",
"GpuCommandBufferDescriptor",
"GpuCommandEncoder",
"GpuCommandEncoderDescriptor",
"GpuCompareFunction",
"GpuCompilationInfo",
"GpuCompilationMessage",
"GpuCompilationMessageType",
"GpuComputePassDescriptor",
"GpuComputePassEncoder",
"GpuComputePassTimestampWrites",
"GpuComputePipeline",
"GpuComputePipelineDescriptor",
"GpuCullMode",
"GpuDepthStencilState",
"GpuDevice",
"GpuDeviceDescriptor",
"GpuDeviceLostInfo",
"GpuDeviceLostReason",
"GpuError",
"GpuErrorFilter",
# "GpuExtent2dDict", Not yet implemented in web_sys
"GpuExtent3dDict",
"GpuFeatureName",
"GpuFilterMode",
"GpuFragmentState",
"GpuFrontFace",
"GpuImageCopyBuffer",
"GpuImageCopyExternalImage",
"GpuImageCopyTexture",
"GpuImageCopyTextureTagged",
"GpuImageDataLayout",
"GpuIndexFormat",
"GpuLoadOp",
"gpu_map_mode",
"GpuMipmapFilterMode",
"GpuMultisampleState",
"GpuObjectDescriptorBase",
"GpuOrigin2dDict",
"GpuOrigin3dDict",
"GpuOutOfMemoryError",
"GpuPipelineDescriptorBase",
"GpuPipelineLayout",
"GpuPipelineLayoutDescriptor",
"GpuPowerPreference",
"GpuPrimitiveState",
"GpuPrimitiveTopology",
"GpuProgrammableStage",
"GpuQuerySet",
"GpuQuerySetDescriptor",
"GpuQueryType",
"GpuQueue",
"GpuRenderBundle",
"GpuRenderBundleDescriptor",
"GpuRenderBundleEncoder",
"GpuRenderBundleEncoderDescriptor",
"GpuRenderPassColorAttachment",
"GpuRenderPassDepthStencilAttachment",
"GpuRenderPassDescriptor",
"GpuRenderPassEncoder",
"GpuRenderPipeline",
"GpuRenderPipelineDescriptor",
"GpuRequestAdapterOptions",
"GpuSampler",
"GpuSamplerBindingLayout",
"GpuSamplerBindingType",
"GpuSamplerDescriptor",
"GpuShaderModule",
"GpuShaderModuleDescriptor",
"GpuStencilFaceState",
"GpuStencilOperation",
"GpuStorageTextureAccess",
"GpuStorageTextureBindingLayout",
"GpuStoreOp",
"GpuSupportedFeatures",
"GpuSupportedLimits",
"GpuTexture",
"GpuTextureAspect",
"GpuTextureBindingLayout",
"GpuTextureDescriptor",
"GpuTextureDimension",
"GpuTextureFormat",
"GpuTextureSampleType",
"GpuTextureView",
"GpuTextureViewDescriptor",
"GpuTextureViewDimension",
"GpuUncapturedErrorEvent",
"GpuUncapturedErrorEventInit",
"GpuValidationError",
"GpuVertexAttribute",
"GpuVertexBufferLayout",
"GpuVertexFormat",
"GpuVertexState",
"GpuVertexStepMode",
"HtmlCanvasElement",
"OffscreenCanvas",
"ImageBitmap",
"ImageBitmapRenderingContext",
"Window",
"WorkerGlobalScope",
"WorkerNavigator",
] }
wasm-bindgen.workspace = true
js-sys.workspace = true
wasm-bindgen-futures.workspace = true
parking_lot.workspace = true