Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Ignore stage3d_raytrace on WARP #9843

Merged
merged 1 commit into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/tests/swfs/avm2/stage3d_raytrace/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Dinnerbone marked this conversation as resolved.
Show resolved Hide resolved
53 changes: 36 additions & 17 deletions tests/tests/util/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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()))?,
);
}
}
}

Expand All @@ -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
Expand Down Expand Up @@ -245,13 +251,26 @@ impl ImageComparison {
pub struct RenderOptions {
optional: bool,
sample_count: u32,
exclude_warp: bool,
}

impl Default for RenderOptions {
fn default() -> Self {
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 {
Dinnerbone marked this conversation as resolved.
Show resolved Hide resolved
return false;
}
true
}
}