1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! What this machine actually says about mesh shaders.
//!
//! # The disagreement this exists to settle
//!
//! `CLAUDE.md` records two sources that contradict each other: *"wgpu's spec
//! table lists MSL as planned while the tracking issue says the Metal HAL
//! backend merged"*, and instructs that nothing be built on mesh shaders
//! before a capability probe reports what is actually there.
//!
//! **Both sources are right, and they are about different layers.** From
//! `wgpu-types` 29.0.4's own source, on `EXPERIMENTAL_MESH_SHADER`:
//!
//! > Supported platforms:
//! > - Vulkan (with `VK_EXT_mesh_shader`)
//! > - DX12
//! > - Metal
//! >
//! > **Naga is only supported on vulkan. On other platforms you will have to
//! > use passthrough shaders.**
//!
//! So the *feature* reaches Metal and the *WGSL compiler* does not. On Metal a
//! caller must hand wgpu pre-compiled MSL rather than the WGSL this crate
//! composes — which makes mesh shaders a fork in the shader pipeline, not a
//! flag on it. That is the fact GPU-008 has to be designed around, and it is a
//! documentation claim rather than a measurement, so it carries its source.
//!
//! # Enabling it requires `unsafe`, and this workspace forbids `unsafe`
//!
//! The probe **cannot** report whether a device opens with mesh shaders, and
//! that is a finding rather than a gap. `ExperimentalFeatures::enabled()` is a
//! `const unsafe fn` in `wgpu-types` 29.0.4 — its `disabled()` counterpart is
//! documented as *"uses of `Features` prefixed with EXPERIMENTAL are
//! disallowed"* — so requesting `EXPERIMENTAL_MESH_SHADER` at device creation
//! needs an `unsafe` block acknowledging possible UB.
//!
//! This workspace sets `unsafe_code = "forbid"`. So GPU-008 cannot be written
//! here at all without that policy changing, which is a decision rather than a
//! task. See M-146.
//!
//! An earlier version of this probe requested the feature with
//! `ExperimentalFeatures::disabled()` and reported `usable: false` for an
//! adapter that advertises it — measuring its own configuration and calling it
//! a hardware limit. The field is gone rather than fixed, because without
//! `unsafe` there is nothing honest for it to say.
//!
//! # What is reported
//!
//! The feature bits, for **every adapter on every backend**, not just the one
//! [`headless::Gpu`](crate::headless::Gpu) would pick — the question is what
//! this *machine* can do, and one high-performance adapter would miss a second
//! GPU or a second backend.
use crateblock_on;
/// One adapter's answer.
/// Probe every adapter on every backend this build supports.
///
/// Returns one report per adapter, in enumeration order. An empty result means
/// no adapter at all, which is itself an answer and not an error — a machine
/// with no GPU has honestly reported that it has no mesh shaders.