Skip to content

Commit

Permalink
Round up clear texture tests to block size
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald committed Feb 25, 2022
1 parent 2c9087a commit 8605899
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
21 changes: 3 additions & 18 deletions wgpu/examples/skybox/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,7 @@ fn skybox_bc1() {
width: 1024,
height: 768,
optional_features: wgpu::Features::TEXTURE_COMPRESSION_BC,
base_test_parameters: framework::test_common::TestParameters::default().specific_failure(
Some(wgpu::Backends::GL),
None,
Some("ANGLE"),
false,
), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056
base_test_parameters: framework::test_common::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056
tolerance: 5,
max_outliers: 105, // Bounded by llvmpipe
});
Expand All @@ -508,12 +503,7 @@ fn skybox_etc2() {
width: 1024,
height: 768,
optional_features: wgpu::Features::TEXTURE_COMPRESSION_ETC2,
base_test_parameters: framework::test_common::TestParameters::default().specific_failure(
Some(wgpu::Backends::GL),
None,
Some("ANGLE"),
false,
), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056
base_test_parameters: framework::test_common::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056
tolerance: 5,
max_outliers: 105, // Bounded by llvmpipe
});
Expand All @@ -526,12 +516,7 @@ fn skybox_astc() {
width: 1024,
height: 768,
optional_features: wgpu::Features::TEXTURE_COMPRESSION_ASTC_LDR,
base_test_parameters: framework::test_common::TestParameters::default().specific_failure(
Some(wgpu::Backends::GL),
None,
Some("ANGLE"),
false,
), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056
base_test_parameters: framework::test_common::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056
tolerance: 5,
max_outliers: 300, // Bounded by rp4 on vk
});
Expand Down
22 changes: 15 additions & 7 deletions wgpu/tests/clear_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,28 @@ fn single_texture_clear_test(
// TODO: Read back and check zeroness?
}

fn round_up(value: u32, alignment: u32) -> u32 {
((value + alignment - 1) / alignment) * alignment
}

fn clear_texture_tests(
ctx: &TestingContext,
formats: &[wgpu::TextureFormat],
supports_1d: bool,
supports_3d: bool,
) {
for &format in formats {
let desc = format.describe();
let rounded_width = round_up(64, desc.block_dimensions.0 as u32);
let rounded_height = round_up(64, desc.block_dimensions.1 as u32);

// 1D texture
if supports_1d {
single_texture_clear_test(
ctx,
format,
wgpu::Extent3d {
width: 64,
width: rounded_width,
height: 1,
depth_or_array_layers: 1,
},
Expand All @@ -264,8 +272,8 @@ fn clear_texture_tests(
ctx,
format,
wgpu::Extent3d {
width: 64,
height: 64,
width: rounded_width,
height: rounded_height,
depth_or_array_layers: 1,
},
wgpu::TextureDimension::D2,
Expand All @@ -275,8 +283,8 @@ fn clear_texture_tests(
ctx,
format,
wgpu::Extent3d {
width: 64,
height: 64,
width: rounded_width,
height: rounded_height,
depth_or_array_layers: 4,
},
wgpu::TextureDimension::D2,
Expand All @@ -287,8 +295,8 @@ fn clear_texture_tests(
ctx,
format,
wgpu::Extent3d {
width: 16,
height: 16,
width: rounded_width,
height: rounded_height,
depth_or_array_layers: 16,
},
wgpu::TextureDimension::D3,
Expand Down

0 comments on commit 8605899

Please sign in to comment.