1586: Assorted Fixes of Testing-Infra r=kvark a=cwfitzgerald

**Connections**

Couple of low hanging fruit issues solved here. The biggest thing done is moving the masks to associated functions instead of being members of the bitflags, this is done so `all()` only includes the actual members.

Follows up on 579de425e5 to mark vk/mipmap as passing


Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
This commit is contained in:
bors[bot]
2021-07-02 05:19:36 +00:00
committed by GitHub
6 changed files with 48 additions and 25 deletions

View File

@@ -210,7 +210,7 @@ impl<A: HalApi> Adapter<A> {
let caps = &self.raw.capabilities;
if !caps.downlevel.is_webgpu_compliant() {
let missing_flags = wgt::DownlevelFlags::COMPLIANT - caps.downlevel.flags;
let missing_flags = wgt::DownlevelFlags::compliant() - caps.downlevel.flags;
log::warn!(
"Missing downlevel flags: {:?}\n{}",
missing_flags,

View File

@@ -480,11 +480,18 @@ bitflags::bitflags! {
///
/// This is a native only feature.
const SPIRV_SHADER_PASSTHROUGH = 0x0000_0800_0000_0000;
}
}
/// Features which are part of the upstream WebGPU standard.
const ALL_WEBGPU = 0x0000_0000_0000_FFFF;
/// Features that are only available when targeting native (not web).
const ALL_NATIVE = 0xFFFF_FFFF_FFFF_0000;
impl Features {
/// Mask of all features which are part of the upstream WebGPU standard.
pub const fn all_webgpu_mask() -> Self {
Self::from_bits_truncate(0x0000_0000_0000_FFFF)
}
/// Mask of all features that are only available when targeting native (not web).
pub const fn all_native_mask() -> Self {
Self::from_bits_truncate(0xFFFF_FFFF_FFFF_0000)
}
}
@@ -611,7 +618,7 @@ pub struct DownlevelCapabilities {
impl Default for DownlevelCapabilities {
fn default() -> Self {
Self {
flags: DownlevelFlags::COMPLIANT,
flags: DownlevelFlags::compliant(),
limits: DownlevelLimits::default(),
shader_model: ShaderModel::Sm5,
}
@@ -624,7 +631,7 @@ impl DownlevelCapabilities {
/// If this returns false, some parts of the API will result in validation errors where they would not normally.
/// These parts can be determined by the values in this structure.
pub fn is_webgpu_compliant(&self) -> bool {
self.flags.contains(DownlevelFlags::COMPLIANT)
self.flags.contains(DownlevelFlags::compliant())
&& self.limits == DownlevelLimits::default()
&& self.shader_model >= ShaderModel::Sm5
}
@@ -657,8 +664,16 @@ bitflags::bitflags! {
const INDEPENDENT_BLENDING = 0x0000_0200;
/// Supports samplers with anisotropic filtering
const ANISOTROPIC_FILTERING = 0x0001_0000;
/// All flags are in their compliant state.
const COMPLIANT = 0x0000_13FF;
}
}
impl DownlevelFlags {
/// All flags that indicate if the backend is WebGPU compliant
pub const fn compliant() -> Self {
// We use manual bit twiddling to make this a const fn as `Sub` and `.remove` aren't const
// WebGPU doesn't actually require aniso
Self::from_bits_truncate(Self::all().bits() & !Self::ANISOTROPIC_FILTERING.bits)
}
}

View File

@@ -74,7 +74,7 @@ fn test_compute_overflow() {
#[test]
fn test_multithreaded_compute() {
initialize_test(
TestParameters::default().backend_failures(wgpu::Backends::GL),
TestParameters::default().backend_failure(wgpu::Backends::GL),
|ctx| {
use std::{sync::mpsc, thread, time::Duration};

View File

@@ -483,7 +483,7 @@ fn mipmap() {
height: 768,
optional_features: wgpu::Features::default(),
base_test_parameters: framework::test_common::TestParameters::default()
.backend_failures(wgpu::Backends::VULKAN | wgpu::Backends::GL),
.backend_failure(wgpu::Backends::GL),
tolerance: 25,
max_outliers: 3000, // Mipmap sampling is highly variant between impls. This is currently bounded by AMD on mac
});

View File

@@ -227,25 +227,33 @@ pub fn initialize_test(parameters: TestParameters, test_function: impl FnOnce(Te
let always =
backend_failure.is_none() && vendor_failure.is_none() && adapter_failure.is_none();
let expect_failure_backend = backend_failure
.map(|f| f.contains(wgpu::Backends::from(adapter_info.backend)))
.unwrap_or(true);
let expect_failure_vendor = vendor_failure
.map(|v| v == adapter_info.vendor)
.unwrap_or(true);
let expect_failure_backend =
backend_failure.map(|f| f.contains(wgpu::Backends::from(adapter_info.backend)));
let expect_failure_vendor = vendor_failure.map(|v| v == adapter_info.vendor);
let expect_failure_adapter = adapter_failure
.as_deref()
.map(|f| adapter_lowercase_name.contains(f))
.unwrap_or(true);
.map(|f| adapter_lowercase_name.contains(f));
if expect_failure_backend && expect_failure_vendor && expect_failure_adapter {
if expect_failure_backend.unwrap_or(true)
&& expect_failure_vendor.unwrap_or(true)
&& expect_failure_adapter.unwrap_or(true)
{
if always {
Some((FailureReasons::ALWAYS, *segfault))
} else {
let mut reason = FailureReasons::empty();
reason.set(FailureReasons::BACKEND, expect_failure_backend);
reason.set(FailureReasons::VENDOR, expect_failure_vendor);
reason.set(FailureReasons::ADAPTER, expect_failure_adapter);
reason.set(
FailureReasons::BACKEND,
expect_failure_backend.unwrap_or(false),
);
reason.set(
FailureReasons::VENDOR,
expect_failure_vendor.unwrap_or(false),
);
reason.set(
FailureReasons::ADAPTER,
expect_failure_adapter.unwrap_or(false),
);
Some((reason, *segfault))
}
} else {

View File

@@ -143,7 +143,7 @@ fn draw_vertex_offset() {
initialize_test(
TestParameters::default()
.test_features()
.backend_failures(wgpu::Backends::DX12 | wgpu::Backends::DX11),
.backend_failure(wgpu::Backends::DX12 | wgpu::Backends::DX11),
|ctx| {
pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| {
cmb.draw(0..3, 0..1);
@@ -167,7 +167,7 @@ fn draw_instanced_offset() {
initialize_test(
TestParameters::default()
.test_features()
.backend_failures(wgpu::Backends::DX12 | wgpu::Backends::DX11),
.backend_failure(wgpu::Backends::DX12 | wgpu::Backends::DX11),
|ctx| {
pulling_common(ctx, &[0, 1, 2, 3, 4, 5], |cmb| {
cmb.draw(0..3, 0..1);