From b68ca071f39218fbce7e624b5d3a5ad04a5da1ba Mon Sep 17 00:00:00 2001 From: Hao Li Date: Wed, 9 Jun 2021 01:33:46 +0000 Subject: [PATCH] Disable timestamp query on macOS 10.15 on AMD On macOS 10.15 on AMD GPU, WriteTimestamp cannot be called without any copy commands on MTLBlitCommandEncoder, otherwise crash occurs. But this issue is not reproduced on macOS 11.0, just disable timestamp query on the bad version on AMD. BUG: dawn:545 Change-Id: I69a012b2091b8ccd251d23ddb26b72e06c07492f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53581 Reviewed-by: Austin Eng Reviewed-by: Corentin Wallez Commit-Queue: Hao Li --- src/dawn_native/metal/BackendMTL.mm | 11 ++++++++--- src/tests/end2end/QueryTests.cpp | 8 -------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/dawn_native/metal/BackendMTL.mm b/src/dawn_native/metal/BackendMTL.mm index 49e8ed31b8..04082d3ff2 100644 --- a/src/dawn_native/metal/BackendMTL.mm +++ b/src/dawn_native/metal/BackendMTL.mm @@ -221,9 +221,14 @@ namespace dawn_native { namespace metal { if ([*mDevice supportsFamily:MTLGPUFamilyMac2] || [*mDevice supportsFamily:MTLGPUFamilyApple5]) { mSupportedExtensions.EnableExtension(Extension::PipelineStatisticsQuery); - // TODO(crbug.com/dawn/545): Crash occurs if we only call WriteTimestamp in a - // command encoder without any copy commands on Metal on AMD GPU. - mSupportedExtensions.EnableExtension(Extension::TimestampQuery); + + // Disable timestamp query on macOS 10.15 on AMD GPU because WriteTimestamp + // fails to call without any copy commands on MTLBlitCommandEncoder. This issue + // has been fixed on macOS 11.0. See crbug.com/dawn/545 + if (!gpu_info::IsAMD(GetPCIInfo().vendorId) || + [NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:{11, 0, 0}]) { + mSupportedExtensions.EnableExtension(Extension::TimestampQuery); + } } } if (@available(macOS 10.11, iOS 11.0, *)) { diff --git a/src/tests/end2end/QueryTests.cpp b/src/tests/end2end/QueryTests.cpp index 69b4de502e..0ab39e3ecc 100644 --- a/src/tests/end2end/QueryTests.cpp +++ b/src/tests/end2end/QueryTests.cpp @@ -534,10 +534,6 @@ TEST_P(TimestampQueryTests, QuerySetCreation) { // Test calling timestamp query from command encoder TEST_P(TimestampQueryTests, TimestampOnCommandEncoder) { - // TODO(crbug.com/dawn/545): Crash occurs if we only call WriteTimestamp in a command encoder - // without any copy commands on Metal on AMD GPU. - DAWN_SUPPRESS_TEST_IF(IsMetal() && IsAMD()); - constexpr uint32_t kQueryCount = 2; // Write timestamp with different query indexes @@ -760,10 +756,6 @@ TEST_P(TimestampQueryTests, ResolveToBufferWithOffset) { // the issue is fixed. DAWN_SUPPRESS_TEST_IF(IsWindows() && IsVulkan() && IsIntel()); - // TODO(crbug.com/dawn/545): Crash occurs if we only call WriteTimestamp in a command encoder - // without any copy commands on Metal on AMD GPU. - DAWN_SUPPRESS_TEST_IF(IsMetal() && IsAMD()); - constexpr uint32_t kQueryCount = 2; constexpr uint64_t kZero = 0;