Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendor id clarification #3036

Merged
merged 3 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ SurfaceConfiguration {
- Added missing validation for `BufferUsages` mismatches when `Features::MAPPABLE_PRIMARY_BUFFERS` is not
enabled. By @imberflur in [#3023](https://github.com/gfx-rs/wgpu/pull/3023)
- Fixed `CommandEncoder` not being `Send` and `Sync` on web by @i509VCB in [#3025](https://github.com/gfx-rs/wgpu/pull/3025)
- Document meaning of `vendor` in `AdapterInfo` if the vendor has no PCI id.

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

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

### Changes

#### General
Expand Down
10 changes: 10 additions & 0 deletions wgpu-hal/src/auxil/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pub mod db {
pub mod amd {
pub const VENDOR: u32 = 0x1002;
}
pub mod apple {
pub const VENDOR: u32 = 0x106B;
}
pub mod arm {
pub const VENDOR: u32 = 0x13B5;
}
Expand All @@ -22,6 +25,13 @@ pub mod db {
pub const DEVICE_KABY_LAKE_MASK: u32 = 0x5900;
pub const DEVICE_SKY_LAKE_MASK: u32 = 0x1900;
}
pub mod mesa {
// Mesa does not actually have a PCI vendor id.
//
// To match Vulkan, we use the VkVendorId for Mesa in the gles backend so that lavapipe (Vulkan) and
// llvmpipe (OpenGL) have the same vendor id.
pub const VENDOR: u32 = 0x10005;
}
pub mod nvidia {
pub const VENDOR: u32 = 0x10DE;
}
Expand Down
6 changes: 5 additions & 1 deletion wgpu-hal/src/gles/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl super::Adapter {
"mali",
"intel",
"v3d",
"apple m1",
"apple m", // all apple m are integrated
];
let strings_that_imply_cpu = ["mesa offscreen", "swiftshader", "llvmpipe"];

Expand Down Expand Up @@ -160,6 +160,10 @@ impl super::Adapter {
db::intel::VENDOR
} else if vendor.contains("broadcom") {
db::broadcom::VENDOR
} else if vendor.contains("mesa") {
db::mesa::VENDOR
} else if vendor.contains("apple") {
db::apple::VENDOR
} else {
0
};
Expand Down
3 changes: 3 additions & 0 deletions wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,9 @@ pub struct AdapterInfo {
/// Adapter name
pub name: String,
/// Vendor PCI id of the adapter
///
/// If the vendor has no PCI id, then this value will be the backend's vendor id equivalent. On Vulkan,
/// Mesa would have a vendor id equivalent to it's `VkVendorId` value.
pub vendor: usize,
/// PCI id of the adapter
pub device: usize,
Expand Down