wgpu-hal(vk): Add WGPU_ALLOW_NONCOMPLIANT_ADAPTER (#4754)

This commit is contained in:
i509VCB authored and GitHub committed 2023-11-22 23:13:29 -05:00
1 parent eadd750412
commit 1a7db86917
4 files changed
+19

No files matched your search

+4
View File
@@ -40,6 +40,10 @@ Bottom level categories:
## Unreleased
### `WGPU_ALLOW_NONCOMPLIANT_ADAPTER` environment variable
This adds a way to allow a Vulkan driver which is non-compliant per VK_KHR_driver_properties to be enumerated. This is intended for testing new Vulkan drivers which are not Vulkan compliant yet.
### New Features
#### General
+1
View File
@@ -143,6 +143,7 @@ All testing and example infrastructure shares the same set of environment variab
- `WGPU_POWER_PREF` with the power preference to choose when a specific adapter name isn't specified (`high`, `low` or `none`)
- `WGPU_DX12_COMPILER` with the DX12 shader compiler you wish to use (`dxc` or `fxc`, note that `dxc` requires `dxil.dll` and `dxcompiler.dll` to be in the working directory otherwise it will fall back to `fxc`)
- `WGPU_GLES_MINOR_VERSION` with the minor OpenGL ES 3 version number to request (`0`, `1`, `2` or `automatic`).
- `WGPU_ALLOW_NONCOMPLIANT_ADAPTER` with a boolean whether non-compliant drivers are enumerated (`0` for false, `1` for true).
When running the CTS, use the variables `DENO_WEBGPU_ADAPTER_NAME`, `DENO_WEBGPU_BACKEND`, `DENO_WEBGPU_POWER_PREFERENCE`.
+6
View File
@@ -995,6 +995,12 @@ impl super::Instance {
if driver.conformance_version.major == 0 {
if driver.driver_id == ash::vk::DriverId::MOLTENVK {
log::debug!("Adapter is not Vulkan compliant, but is MoltenVK, continuing");
} else if self
.shared
.flags
.contains(wgt::InstanceFlags::ALLOW_NONCOMPLIANT_ADAPTER)
{
log::warn!("Adapter is not Vulkan compliant: {}", info.name);
} else {
log::warn!(
"Adapter is not Vulkan compliant, hiding adapter: {}",
+8
View File
@@ -858,6 +858,11 @@ bitflags::bitflags! {
const VALIDATION = 1 << 1;
/// Don't pass labels to wgpu-hal.
const DISCARD_HAL_LABELS = 1 << 2;
/// Whether non-compliant adapters should be enumerated.
///
/// This mainly applies to a Vulkan driver's compliance version. If the major compliance version
/// is `0`, then the driver is ignored. This flag allows that driver to be enabled for testing.
const ALLOW_NONCOMPLIANT_ADAPTER = 1 << 3;
}
}
@@ -910,6 +915,9 @@ impl InstanceFlags {
if let Some(bit) = env("WGPU_DEBUG") {
self.set(Self::DEBUG, bit);
}
if let Some(bit) = env("WGPU_ALLOW_NONCOMPLIANT_ADAPTER") {
self.set(Self::ALLOW_NONCOMPLIANT_ADAPTER, bit);
}
self
}