Skip to content

Commit f877a8a

Browse files
authored
Vendor id clarification (#3036)
* set GL vendor for id Mesa and Apple * match on "apple m" to mark M2 cpu as integrated in gles * document AdapterInfo::vendor if the vendor has no PCI id
1 parent 03b989c commit f877a8a

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ SurfaceConfiguration {
8585
- Added missing validation for `BufferUsages` mismatches when `Features::MAPPABLE_PRIMARY_BUFFERS` is not
8686
enabled. By @imberflur in [#3023](https://github.com/gfx-rs/wgpu/pull/3023)
8787
- Fixed `CommandEncoder` not being `Send` and `Sync` on web by @i509VCB in [#3025](https://github.com/gfx-rs/wgpu/pull/3025)
88+
- Document meaning of `vendor` in `AdapterInfo` if the vendor has no PCI id.
8889

8990
#### Metal
9091
- Add the missing `msg_send![view, retain]` call within `from_view` by @jinleili in [#2976](https://github.com/gfx-rs/wgpu/pull/2976)
@@ -98,6 +99,10 @@ SurfaceConfiguration {
9899
and `VUID-StandaloneSpirv-Flat-04744`. By @jimblandy in
99100
[#3008](https://github.com/gfx-rs/wgpu/pull/3008)
100101

102+
#### Gles
103+
- Report vendor id for Mesa and Apple GPUs. By @i509VCB [#3036](https://github.com/gfx-rs/wgpu/pull/3036)
104+
- Report Apple M2 gpu as integrated. By @i509VCB [#3036](https://github.com/gfx-rs/wgpu/pull/3036)
105+
101106
### Changes
102107

103108
#### General

wgpu-hal/src/auxil/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ pub mod db {
88
pub mod amd {
99
pub const VENDOR: u32 = 0x1002;
1010
}
11+
pub mod apple {
12+
pub const VENDOR: u32 = 0x106B;
13+
}
1114
pub mod arm {
1215
pub const VENDOR: u32 = 0x13B5;
1316
}
@@ -22,6 +25,13 @@ pub mod db {
2225
pub const DEVICE_KABY_LAKE_MASK: u32 = 0x5900;
2326
pub const DEVICE_SKY_LAKE_MASK: u32 = 0x1900;
2427
}
28+
pub mod mesa {
29+
// Mesa does not actually have a PCI vendor id.
30+
//
31+
// To match Vulkan, we use the VkVendorId for Mesa in the gles backend so that lavapipe (Vulkan) and
32+
// llvmpipe (OpenGL) have the same vendor id.
33+
pub const VENDOR: u32 = 0x10005;
34+
}
2535
pub mod nvidia {
2636
pub const VENDOR: u32 = 0x10DE;
2737
}

wgpu-hal/src/gles/adapter.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl super::Adapter {
122122
"mali",
123123
"intel",
124124
"v3d",
125-
"apple m1",
125+
"apple m", // all apple m are integrated
126126
];
127127
let strings_that_imply_cpu = ["mesa offscreen", "swiftshader", "llvmpipe"];
128128

@@ -160,6 +160,10 @@ impl super::Adapter {
160160
db::intel::VENDOR
161161
} else if vendor.contains("broadcom") {
162162
db::broadcom::VENDOR
163+
} else if vendor.contains("mesa") {
164+
db::mesa::VENDOR
165+
} else if vendor.contains("apple") {
166+
db::apple::VENDOR
163167
} else {
164168
0
165169
};

wgpu-types/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,9 @@ pub struct AdapterInfo {
11401140
/// Adapter name
11411141
pub name: String,
11421142
/// Vendor PCI id of the adapter
1143+
///
1144+
/// If the vendor has no PCI id, then this value will be the backend's vendor id equivalent. On Vulkan,
1145+
/// Mesa would have a vendor id equivalent to it's `VkVendorId` value.
11431146
pub vendor: usize,
11441147
/// PCI id of the adapter
11451148
pub device: usize,

0 commit comments

Comments
 (0)