CopyTextureForBrowser: Use large triangle to avoid arithmetic precision

In previous internal shader, we draw a just fit-in rectangle to do the
copy. But there is arithmetic precision issues in border pixels when
copy from a large texture.

ANGLE handle the same issue by drawing a large triangle. Dawn adopte the
same idea here

BUG=dawn:465

Change-Id: I2366e28b1e96e7a33116a170023a5138d8c9f770
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33900
Reviewed-by: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
This commit is contained in:
Yan, Shaobo
2020-12-01 03:37:37 +00:00
committed by Commit Bot service account
parent d1b65e0d32
commit a827aa2c29
2 changed files with 86 additions and 36 deletions

View File

@@ -176,6 +176,66 @@ TEST_P(CopyTextureForBrowserTests, PassthroughCopy) {
DoTest(textureSpec, textureSpec, {kWidth, kHeight, 1});
}
TEST_P(CopyTextureForBrowserTests, VerifyCopyOnXDirection) {
// These tests fails due to crbug.com/tint/63.
DAWN_SKIP_TEST_IF(IsSwiftshader());
DAWN_SKIP_TEST_IF(IsVulkan());
DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
// OpenGL tests fails due to 'WriteTexture' unimplemented.
// Related bug : crbug.com/dawn/483
DAWN_SKIP_TEST_IF(IsOpenGL());
constexpr uint32_t kWidth = 1000;
constexpr uint32_t kHeight = 1;
TextureSpec textureSpec;
textureSpec.copyOrigin = {0, 0, 0};
textureSpec.level = 0;
textureSpec.textureSize = {kWidth, kHeight, 1};
DoTest(textureSpec, textureSpec, {kWidth, kHeight, 1});
}
TEST_P(CopyTextureForBrowserTests, VerifyCopyOnYDirection) {
// These tests fails due to crbug.com/tint/63.
DAWN_SKIP_TEST_IF(IsSwiftshader());
DAWN_SKIP_TEST_IF(IsVulkan());
DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
// OpenGL tests fails due to 'WriteTexture' unimplemented.
// Related bug : crbug.com/dawn/483
DAWN_SKIP_TEST_IF(IsOpenGL());
constexpr uint32_t kWidth = 1;
constexpr uint32_t kHeight = 1000;
TextureSpec textureSpec;
textureSpec.copyOrigin = {0, 0, 0};
textureSpec.level = 0;
textureSpec.textureSize = {kWidth, kHeight, 1};
DoTest(textureSpec, textureSpec, {kWidth, kHeight, 1});
}
TEST_P(CopyTextureForBrowserTests, VerifyCopyFromLargeTexture) {
// These tests fails due to crbug.com/tint/63.
DAWN_SKIP_TEST_IF(IsSwiftshader());
DAWN_SKIP_TEST_IF(IsVulkan());
DAWN_SKIP_TEST_IF(IsD3D12() && IsBackendValidationEnabled());
// OpenGL tests fails due to 'WriteTexture' unimplemented.
// Related bug : crbug.com/dawn/483
DAWN_SKIP_TEST_IF(IsOpenGL());
constexpr uint32_t kWidth = 899;
constexpr uint32_t kHeight = 999;
TextureSpec textureSpec;
textureSpec.copyOrigin = {0, 0, 0};
textureSpec.level = 0;
textureSpec.textureSize = {kWidth, kHeight, 1};
DoTest(textureSpec, textureSpec, {kWidth, kHeight, 1});
}
DAWN_INSTANTIATE_TEST(CopyTextureForBrowserTests,
D3D12Backend(),
MetalBackend(),