Change AdapterInfo::{device,vendor} fields to u32 (#3760)

* Change AdapterInfo device and vendor to u32s

* Add CHANGELOG
This commit is contained in:
Ame
2023-05-09 03:17:27 -06:00
committed by GitHub
parent 45588492d2
commit 4d8a7ed38d
7 changed files with 17 additions and 11 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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(),

View File

@@ -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,

View File

@@ -691,12 +691,12 @@ impl crate::Instance<super::Api> 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!(

View File

@@ -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

View File

@@ -53,7 +53,7 @@ fn lowest_downlevel_properties() -> DownlevelCapabilities {
pub struct FailureCase {
backends: Option<wgpu::Backends>,
vendor: Option<usize>,
vendor: Option<u32>,
adapter: Option<String>,
skip: bool,
}
@@ -170,7 +170,7 @@ impl TestParameters {
pub fn specific_failure(
mut self,
backends: Option<Backends>,
vendor: Option<usize>,
vendor: Option<u32>,
device: Option<&'static str>,
skip: bool,
) -> Self {