Skip to content

Commit f21087d

Browse files
Revert "docs: inline document-features usage, remove dep." (#5169)
* docs: sync. `wgpu/Cargo.toml` feature comments with `lib.rs` * Revert "docs: inline `document-features` usage, remove dep." This reverts commit 3d5bec6, with an update to `document-features`, and preferring to keep new `feature` content. To be clear, the only difference I have observed is the addition of the `serde` feature. In case it shortens anyone's search, the specific issue resolved is [`slint-ui/document-features`#20](slint-ui/document-features#20).
1 parent 3028972 commit f21087d

File tree

6 files changed

+30
-83
lines changed

6 files changed

+30
-83
lines changed

Cargo.lock

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ cfg_aliases = "0.1"
7777
cfg-if = "1"
7878
codespan-reporting = "0.11"
7979
ctor = "0.2"
80+
document-features = "0.2.8"
8081
encase = "0.7"
8182
env_logger = "0.10"
8283
fern = "0.6"

wgpu-core/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ bit-vec = "0.6"
101101
bitflags = "2"
102102
bytemuck = { version = "1.14", optional = true }
103103
codespan-reporting = "0.11"
104+
document-features.workspace = true
104105
indexmap = "2"
105106
log = "0.4"
106107
once_cell = "1"

wgpu-core/src/lib.rs

+1-29
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,8 @@
33
//! into other language-specific user-friendly libraries.
44
//!
55
//! ## Feature flags
6-
// NOTE: feature docs. below should be kept in sync. with `Cargo.toml`!
6+
#![doc = document_features::document_features!()]
77
//!
8-
//! - **`api_log_info`** --- Log all API entry points at info instead of trace level.
9-
//! - **`resource_log_info`** --- Log resource lifecycle management at info instead of trace level.
10-
//! - **`link`** _(enabled by default)_ --- Use static linking for libraries. Disable to manually
11-
//! link. Enabled by default.
12-
//! - **`renderdoc`** --- Support the Renderdoc graphics debugger:
13-
//! [https://renderdoc.org/](https://renderdoc.org/)
14-
//! - **`strict_asserts`** --- Apply run-time checks, even in release builds. These are in addition
15-
//! to the validation carried out at public APIs in all builds.
16-
//! - **`serde`** --- Enables serialization via `serde` on common wgpu types.
17-
//! - **`trace`** --- Enable API tracing.
18-
//! - **`replay`** --- Enable API replaying
19-
//! - **`wgsl`** --- Enable `ShaderModuleSource::Wgsl`
20-
//! - **`fragile-send-sync-non-atomic-wasm`** --- Implement `Send` and `Sync` on Wasm, but only if
21-
//! atomics are not enabled.
22-
//!
23-
//! WebGL/WebGPU objects can not be shared between threads. However, it can be useful to
24-
//! artificially mark them as `Send` and `Sync` anyways to make it easier to write cross-platform
25-
//! code. This is technically _very_ unsafe in a multithreaded environment, but on a wasm binary
26-
//! compiled without atomics we know we are definitely not in a multithreaded environment.
27-
//!
28-
//! ### Backends, passed through to wgpu-hal
29-
//!
30-
//! - **`metal`** --- Enable the `metal` backend.
31-
//! - **`vulkan`** --- Enable the `vulkan` backend.
32-
//! - **`gles`** --- Enable the `GLES` backend.
33-
//!
34-
//! This is used for all of GLES, OpenGL, and WebGL.
35-
//! - **`dx12`** --- Enable the `dx12` backend.
368
379
// When we have no backends, we end up with a lot of dead or otherwise unreachable code.
3810
#![cfg_attr(

wgpu/Cargo.toml

+9-5
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,24 @@ dx12 = ["wgc?/dx12"]
3838
## Enables the Metal backend on macOS & iOS.
3939
metal = ["wgc?/metal"]
4040

41+
## Enables the WebGPU backend on Wasm. Disabled when targeting `emscripten`.
42+
webgpu = ["naga?/wgsl-out"]
43+
4144
## Enables the GLES backend via [ANGLE](https://github.com/google/angle) on macOS using.
4245
angle = ["wgc?/gles"]
4346

4447
## Enables the Vulkan backend on macOS & iOS.
4548
vulkan-portability = ["wgc?/vulkan"]
4649

47-
## Enables the WebGPU backend on Wasm. Disabled when targeting `emscripten`.
48-
webgpu = ["naga?/wgsl-out"]
49-
5050
## Enables the GLES backend on Wasm
5151
##
5252
## * ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.
5353
webgl = ["hal", "wgc/gles"]
5454

55+
#! **Note:** In the documentation, if you see that an item depends on a backend,
56+
#! it means that the item is only available when that backend is enabled _and_ the backend
57+
#! is supported on the current platform.
58+
5559
#! ### Shading language support
5660
# --------------------------------------------------------------------
5761

@@ -81,8 +85,7 @@ api_log_info = ["wgc/api_log_info"]
8185
## Enables serialization via `serde` on common wgpu types.
8286
serde = ["dep:serde", "wgc/serde"]
8387

84-
## Allow writing of trace capture files.
85-
## See [`Adapter::request_device`].
88+
## Allow writing of trace capture files. See [`Adapter::request_device`].
8689
trace = ["serde", "wgc/trace"]
8790

8891
## Allow deserializing of trace capture files that were written with the `trace` feature.
@@ -163,6 +166,7 @@ optional = true
163166
[dependencies]
164167
arrayvec.workspace = true
165168
cfg-if.workspace = true
169+
document-features.workspace = true
166170
log.workspace = true
167171
parking_lot.workspace = true
168172
profiling.workspace = true

wgpu/src/lib.rs

+1-49
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,7 @@
33
//! To start using the API, create an [`Instance`].
44
//!
55
//! ## Feature flags
6-
// NOTE: feature docs. below should be kept in sync. with `Cargo.toml`!
7-
//!
8-
//! ### Backends
9-
//!
10-
//! ⚠️ WIP: Not all backends can be manually configured today. On Windows & Linux the **Vulkan & GLES
11-
//! backends are always enabled**. See [#3514](https://github.com/gfx-rs/wgpu/issues/3514) for more
12-
//! details.
13-
//!
14-
//! - **`dx12`** _(enabled by default)_ --- Enables the DX12 backend on Windows.
15-
//! - **`metal`** _(enabled by default)_ --- Enables the Metal backend on macOS & iOS.
16-
//! - **`webgpu`** _(enabled by default)_ --- Enables the WebGPU backend on Wasm. Disabled when targeting `emscripten`.
17-
//! - **`angle`** --- Enables the GLES backend via [ANGLE](https://github.com/google/angle) on macOS.
18-
//! - **`vulkan-portability`** --- Enables the Vulkan backend on macOS & iOS.
19-
//! - **`webgl`** --- Enables the GLES backend on Wasm.
20-
//! - ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.
21-
//!
22-
//! **Note:** In the documentation, if you see that an item depends on a backend,
23-
//! it means that the item is only available when that backend is enabled _and_ the backend
24-
//! is supported on the current platform.
25-
//!
26-
//! ### Shading language support
27-
//!
28-
//! - **`wgsl`** _(enabled by default)_ --- Enable accepting WGSL shaders as input.
29-
//! - **`spirv`** --- Enable accepting SPIR-V shaders as input.
30-
//! - **`glsl`** --- Enable accepting GLSL shaders as input.
31-
//! - **`naga-ir`** --- Enable accepting Naga IR shaders as input.
32-
//!
33-
//! ### Logging & Tracing
34-
//!
35-
//! The following features do not have any effect on the WebGPU backend.
36-
//!
37-
//! - **`strict_asserts`** --- Apply run-time checks, even in release builds. These are in addition
38-
//! to the validation carried out at public APIs in all builds.
39-
//! - **`api_log_info`** --- Log all API entry points at info instead of trace level.
40-
//! - **`serde`** --- Enables serialization via `serde` on common wgpu types.
41-
//! - **`trace`** --- Allow writing of trace capture files. See [`Adapter::request_device`].
42-
//! - **`replay`** --- Allow deserializing of trace capture files that were written with the `trace`
43-
//! feature. To replay a trace file use the [wgpu
44-
//! player](https://github.com/gfx-rs/wgpu/tree/trunk/player).
45-
//!
46-
//! ### Other
47-
//!
48-
//! - **`fragile-send-sync-non-atomic-wasm`** --- Implement `Send` and `Sync` on Wasm, but only if
49-
//! atomics are not enabled.
50-
//!
51-
//! WebGL/WebGPU objects can not be shared between threads. However, it can be useful to
52-
//! artificially mark them as `Send` and `Sync` anyways to make it easier to write cross-platform
53-
//! code. This is technically _very_ unsafe in a multithreaded environment, but on a wasm binary
54-
//! compiled without atomics we know we are definitely not in a multithreaded environment.
6+
#![doc = document_features::document_features!()]
557
//!
568
//! ### Feature Aliases
579
//!

0 commit comments

Comments
 (0)