diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d042c06be..044cf07e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,12 @@ Bottom level categories: ## Unreleased +### Changes + +#### Misc Breaking Changes + +- Change `AdapterInfo::{device,vendor}` to be `u32` instead of `usize`. By @ameknite in [#3760](https://github.com/gfx-rs/wgpu/pull/3760) + ### Documentation #### General diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index fd7f2f926c..13530afb3e 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -115,8 +115,8 @@ impl super::Adapter { let info = wgt::AdapterInfo { backend: wgt::Backend::Dx12, name: device_name, - vendor: desc.VendorId as usize, - device: desc.DeviceId as usize, + vendor: desc.VendorId, + device: desc.DeviceId, device_type: if (desc.Flags & dxgi::DXGI_ADAPTER_FLAG_SOFTWARE) != 0 { workarounds.avoid_cpu_descriptor_overwrites = true; wgt::DeviceType::Cpu diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 5ccae1154f..b14857ae22 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -170,7 +170,7 @@ impl super::Adapter { wgt::AdapterInfo { name: renderer_orig, - vendor: vendor_id as usize, + vendor: vendor_id, device: 0, device_type: inferred_device_type, driver: String::new(), diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 5aed876d18..f8f26e422f 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -961,8 +961,8 @@ impl super::Instance { .unwrap_or("?") .to_owned() }, - vendor: phd_capabilities.properties.vendor_id as usize, - device: phd_capabilities.properties.device_id as usize, + vendor: phd_capabilities.properties.vendor_id, + device: phd_capabilities.properties.device_id, device_type: match phd_capabilities.properties.device_type { ash::vk::PhysicalDeviceType::OTHER => wgt::DeviceType::Other, ash::vk::PhysicalDeviceType::INTEGRATED_GPU => wgt::DeviceType::IntegratedGpu, diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 5fbdf42f44..101f303c16 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -691,12 +691,12 @@ impl crate::Instance for super::Instance { // Detect if it's an Intel + NVidia configuration with Optimus let has_nvidia_dgpu = exposed_adapters.iter().any(|exposed| { exposed.info.device_type == wgt::DeviceType::DiscreteGpu - && exposed.info.vendor == db::nvidia::VENDOR as usize + && exposed.info.vendor == db::nvidia::VENDOR }); if cfg!(target_os = "linux") && has_nvidia_dgpu && self.shared.has_nv_optimus { for exposed in exposed_adapters.iter_mut() { if exposed.info.device_type == wgt::DeviceType::IntegratedGpu - && exposed.info.vendor == db::intel::VENDOR as usize + && exposed.info.vendor == db::intel::VENDOR { // See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4688 log::warn!( diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index a4af880ef2..7378883da3 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -1307,9 +1307,9 @@ pub struct AdapterInfo { /// /// 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, + pub vendor: u32, /// PCI id of the adapter - pub device: usize, + pub device: u32, /// Type of device pub device_type: DeviceType, /// Driver name diff --git a/wgpu/tests/common/mod.rs b/wgpu/tests/common/mod.rs index 4e0f784bec..11044a9660 100644 --- a/wgpu/tests/common/mod.rs +++ b/wgpu/tests/common/mod.rs @@ -53,7 +53,7 @@ fn lowest_downlevel_properties() -> DownlevelCapabilities { pub struct FailureCase { backends: Option, - vendor: Option, + vendor: Option, adapter: Option, skip: bool, } @@ -170,7 +170,7 @@ impl TestParameters { pub fn specific_failure( mut self, backends: Option, - vendor: Option, + vendor: Option, device: Option<&'static str>, skip: bool, ) -> Self {