Fix SamplerFilterAnisotropicTests mipmap
Fix a bug about mipmap level in SamplerFilterAnisotropicTests.
Sizes of the 3 miplevels should be 4,2,1.
The old code allocates 8,4,2 (which don't have a 1x1 level)
Expected rendered pixel values have to change.
The render result now fits the webgl demo at https://jsfiddle.net/t8k7c95o/5/
(Thanks Kai for the enlarged pixelated canvas)
ComputeBoids.cpp and DawnTest.cpp change is due to git cl format
Bug: dawn:568
Change-Id: I9069732208a16be285be13b8cd1ab19b211995a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37380
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp
index 4acc6aa..7bf1062 100644
--- a/examples/ComputeBoids.cpp
+++ b/examples/ComputeBoids.cpp
@@ -95,8 +95,7 @@
}
void initRender() {
- wgpu::ShaderModule vsModule =
- utils::CreateShaderModuleFromWGSL(device, R"(
+ wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[location(0)]] var<in> a_particlePos : vec2<f32>;
[[location(1)]] var<in> a_particleVel : vec2<f32>;
[[location(2)]] var<in> a_pos : vec2<f32>;
@@ -113,8 +112,7 @@
}
)");
- wgpu::ShaderModule fsModule =
- utils::CreateShaderModuleFromWGSL(device, R"(
+ wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[location(0)]] var<out> FragColor : vec4<f32>;
[[stage(fragment)]]
fn main() -> void {
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index 446ebd0..a44581c 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -901,7 +901,6 @@
// upgrade. Violently suppress this whole configuration until we figure out what to do.
// See https://crbug.com/dawn/598
DAWN_SKIP_TEST_IF(IsBackendValidationEnabled() && IsIntel() && IsD3D12());
-
}
void DawnTestBase::TearDown() {
diff --git a/src/tests/end2end/SamplerFilterAnisotropicTests.cpp b/src/tests/end2end/SamplerFilterAnisotropicTests.cpp
index cd96b97..4ffbe55 100644
--- a/src/tests/end2end/SamplerFilterAnisotropicTests.cpp
+++ b/src/tests/end2end/SamplerFilterAnisotropicTests.cpp
@@ -93,8 +93,8 @@
void InitTexture() {
const uint32_t mipLevelCount = colors.size();
- const uint32_t textureWidthLevel0 = 1 << mipLevelCount;
- const uint32_t textureHeightLevel0 = 1 << mipLevelCount;
+ const uint32_t textureWidthLevel0 = 1 << (mipLevelCount - 1);
+ const uint32_t textureHeightLevel0 = 1 << (mipLevelCount - 1);
wgpu::TextureDescriptor descriptor;
descriptor.dimension = wgpu::TextureDimension::e2D;
@@ -197,18 +197,18 @@
queue.Submit(1, &commands);
// https://jsfiddle.net/t8k7c95o/5/
- // (x, y) -> (8, [0,15)) full readpixels result on Mac metal backend Intel GPU
+ // (x, y) -> (8, [0,15)) full readpixels result on Win10 Nvidia D3D12 GPU
// maxAnisotropy: 1
// 0 - 00 00 00
// 1 - 00 00 ff
// 2 - 00 00 ff
// 3 - 00 00 ff
- // 4 - 00 00 ff
- // 5 - 00 00 ff
- // 6 - 00 ef 10
- // 7 - 00 ef 10
- // 8 - a7 58 00
- // 9 - a7 58 00
+ // 4 - 00 f9 06
+ // 5 - 00 f9 06
+ // 6 - f2 0d 00
+ // 7 - f2 0d 00
+ // 8 - ff 00 00
+ // 9 - ff 00 00
// 10 - ff 00 00
// 11 - ff 00 00
// 12 - ff 00 00
@@ -219,12 +219,12 @@
// maxAnisotropy: 2
// 0 - 00 00 00
// 1 - 00 00 ff
- // 2 - 00 00 ff
- // 3 - 00 00 ff
- // 4 - 00 f7 08
- // 5 - 00 f7 08
- // 6 - ed 12 00
- // 7 - ed 12 10
+ // 2 - 00 7e 81
+ // 3 - 00 7e 81
+ // 4 - ff 00 00
+ // 5 - ff 00 00
+ // 6 - ff 00 00
+ // 7 - ff 00 00
// 8 - ff 00 00
// 9 - ff 00 00
// 10 - ff 00 00
@@ -237,10 +237,10 @@
// maxAnisotropy: 16
// 0 - 00 00 00
// 1 - 00 00 ff
- // 2 - 00 ad 52
- // 3 - 00 ad 52
- // 4 - 81 7e 00
- // 5 - 81 7e 00
+ // 2 - dd 22 00
+ // 3 - dd 22 00
+ // 4 - ff 00 00
+ // 5 - ff 00 00
// 6 - ff 00 00
// 7 - ff 00 00
// 8 - ff 00 00
@@ -253,14 +253,14 @@
// 15 - ff 00 00
if (maxAnisotropy >= 16) {
- EXPECT_PIXEL_RGBA8_BETWEEN(colors[0], colors[1], mRenderPass.color, 8, 4);
- EXPECT_PIXEL_RGBA8_EQ(colors[0], mRenderPass.color, 8, 7);
+ EXPECT_PIXEL_RGBA8_BETWEEN(colors[0], colors[1], mRenderPass.color, 8, 2);
+ EXPECT_PIXEL_RGBA8_EQ(colors[0], mRenderPass.color, 8, 6);
} else if (maxAnisotropy == 2) {
- EXPECT_PIXEL_RGBA8_BETWEEN(colors[1], colors[2], mRenderPass.color, 8, 4);
- EXPECT_PIXEL_RGBA8_BETWEEN(colors[0], colors[1], mRenderPass.color, 8, 7);
+ EXPECT_PIXEL_RGBA8_BETWEEN(colors[1], colors[2], mRenderPass.color, 8, 2);
+ EXPECT_PIXEL_RGBA8_EQ(colors[0], mRenderPass.color, 8, 6);
} else if (maxAnisotropy <= 1) {
- EXPECT_PIXEL_RGBA8_EQ(colors[2], mRenderPass.color, 8, 4);
- EXPECT_PIXEL_RGBA8_BETWEEN(colors[1], colors[2], mRenderPass.color, 8, 7);
+ EXPECT_PIXEL_RGBA8_EQ(colors[2], mRenderPass.color, 8, 2);
+ EXPECT_PIXEL_RGBA8_BETWEEN(colors[0], colors[1], mRenderPass.color, 8, 6);
}
}