diff --git a/tests/README.md b/tests/README.md index 32edfc89397e..956510422557 100644 --- a/tests/README.md +++ b/tests/README.md @@ -34,7 +34,7 @@ max_relative = 0.0 # The default relative tolerance for testing values that are [player_options] max_execution_duration = { secs = 15, nanos = 0} # How long can actionscript execute for before being forcefully stopped viewport_dimensions = { width = 100, height = 100, scale_factor = 1 } # The size of the player. Defaults to the swfs stage size -with_renderer = { optional = false, sample_count = 4 } # If this test requires a renderer to run. Optional will enable the renderer where available. +with_renderer = { optional = false, sample_count = 4, exclude_warp = false } # If this test requires a renderer to run. Optional will enable the renderer where available. with_audio = false # If this test requires an audio backend to run. # Whether or not to compare the image rendered with an expected image diff --git a/tests/tests/swfs/avm2/stage3d_raytrace/test.toml b/tests/tests/swfs/avm2/stage3d_raytrace/test.toml index 76291f1c55fa..55a478c62433 100644 --- a/tests/tests/swfs/avm2/stage3d_raytrace/test.toml +++ b/tests/tests/swfs/avm2/stage3d_raytrace/test.toml @@ -5,12 +5,12 @@ num_frames = 80 [image_comparison] -tolerance = 0 -# FIXME - see if we can decrease this. Ideally, it wouldn't be nearly so high -max_outliers = 5100 +tolerance = 1 +max_outliers = 3 [player_options] # This test runs very slowly on unoptimized `test` builds, # so give it plenty of time. max_execution_duration = { secs = 1000, nanos = 0 } -with_renderer = { optional = false, sample_count = 1 } +# Exclude WARP due to https://github.com/gfx-rs/wgpu/issues/3193 +with_renderer = { optional = false, sample_count = 1, exclude_warp = true } diff --git a/tests/tests/util/options.rs b/tests/tests/util/options.rs index ed9889adcc01..12417fbe248d 100644 --- a/tests/tests/util/options.rs +++ b/tests/tests/util/options.rs @@ -6,6 +6,7 @@ use regex::Regex; use ruffle_core::tag_utils::SwfMovie; use ruffle_core::{PlayerBuilder, ViewportDimensions}; use ruffle_render::quality::StageQuality; +use ruffle_render_wgpu::wgpu; use serde::Deserialize; use std::fs; use std::path::{Path, PathBuf}; @@ -118,21 +119,23 @@ impl PlayerOptions { use ruffle_render_wgpu::target::TextureTarget; if let Some(descriptors) = WGPU.clone() { - let target = TextureTarget::new(&descriptors.device, (width, height)) - .map_err(|e| anyhow!(e.to_string()))?; + if render_options.is_supported(&descriptors.adapter) { + let target = TextureTarget::new(&descriptors.device, (width, height)) + .map_err(|e| anyhow!(e.to_string()))?; - player_builder = player_builder - .with_quality(match render_options.sample_count { - 16 => StageQuality::High16x16, - 8 => StageQuality::High8x8, - 4 => StageQuality::High, - 2 => StageQuality::Medium, - _ => StageQuality::Low, - }) - .with_renderer( - WgpuRenderBackend::new(descriptors, target) - .map_err(|e| anyhow!(e.to_string()))?, - ); + player_builder = player_builder + .with_quality(match render_options.sample_count { + 16 => StageQuality::High16x16, + 8 => StageQuality::High8x8, + 4 => StageQuality::High, + 2 => StageQuality::Medium, + _ => StageQuality::Low, + }) + .with_renderer( + WgpuRenderBackend::new(descriptors, target) + .map_err(|e| anyhow!(e.to_string()))?, + ); + } } } @@ -147,9 +150,12 @@ impl PlayerOptions { if let Some(render) = &self.with_renderer { // If we don't actually want to check the renderer (ie we're just listing potential tests), // don't spend the cost to create it - let has_renderer = !check_renderer || WGPU.is_some(); - if !render.optional && !has_renderer { - return false; + if check_renderer && !render.optional { + if let Some(wgpu) = WGPU.as_deref() { + if !render.is_supported(&wgpu.adapter) { + return false; + } + } } } true @@ -245,6 +251,7 @@ impl ImageComparison { pub struct RenderOptions { optional: bool, sample_count: u32, + exclude_warp: bool, } impl Default for RenderOptions { @@ -252,6 +259,18 @@ impl Default for RenderOptions { Self { optional: false, sample_count: 1, + exclude_warp: false, } } } + +impl RenderOptions { + pub fn is_supported(&self, adapter: &wgpu::Adapter) -> bool { + let info = adapter.get_info(); + // 5140 & 140 is WARP, https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/d3d10-graphics-programming-guide-dxgi#new-info-about-enumerating-adapters-for-windows-8 + if self.exclude_warp && cfg!(windows) && info.vendor == 5140 && info.device == 140 { + return false; + } + true + } +}