Add workaround on using non-zero ResolveLevel or ResolveSlice on Metal

Current Metal drivers have a bug that doing MSAA resolve with non-zero
ResolveLevel and ResolveSlice cannot work correctly. This patch adds a
workaround for this bug that first resolving into a temporary one-level
2D texture, then copying the result into the true resolve target.

Although the end2end test ResolveIntoOneMipmapLevelOf2DTexture and
ResolveInto2DArrayTexture can pass on the try bot using AMD GPU, we
find they fail on some other AMD GPUs (Macbook Pro 2018), so currently
this workaround is enabled on all Metal backends.

BUG=dawn:56
TEST=dawn_end2end_tests

Change-Id: Ie85858e58ff486d49dc11c270d8b6d95e216fd42
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6780
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao
2019-05-22 00:05:14 +00:00
committed by Commit Bot service account
parent 2a7b631482
commit c0c7e2f85b
6 changed files with 113 additions and 7 deletions

View File

@@ -410,8 +410,6 @@ TEST_P(MultisampledRenderingTest, ResolveOneMultisampledTextureTwice) {
// Test using a layer of a 2D texture as resolve target works correctly.
TEST_P(MultisampledRenderingTest, ResolveIntoOneMipmapLevelOf2DTexture) {
// TODO(jiawei.shao@intel.com): investigate why this case fails on Intel and Nvidia.
DAWN_SKIP_TEST_IF(IsMetal() && (IsIntel() || IsNvidia()));
constexpr uint32_t kBaseMipLevel = 2;
dawn::TextureViewDescriptor textureViewDescriptor;
@@ -450,8 +448,6 @@ TEST_P(MultisampledRenderingTest, ResolveIntoOneMipmapLevelOf2DTexture) {
// Test using a level or a layer of a 2D array texture as resolve target works correctly.
TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
// TODO(jiawei.shao@intel.com): investigate why this case fails on Intel and Nvidia.
DAWN_SKIP_TEST_IF(IsMetal() && (IsIntel() || IsNvidia()));
dawn::TextureView multisampledColorView2 =
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateDefaultView();
@@ -515,4 +511,5 @@ DAWN_INSTANTIATE_TEST(MultisampledRenderingTest,
MetalBackend,
OpenGLBackend,
VulkanBackend,
ForceWorkaround(MetalBackend, "emulate_store_and_msaa_resolve"));
ForceWorkaround(MetalBackend, "emulate_store_and_msaa_resolve"),
ForceWorkaround(MetalBackend, "always_resolve_into_zero_level_and_layer"));