Expand metal combined ds workaround

This workaround is needed unless the system is MacOS 13.1+
with architecture at least AMD gcn-4.

Bug: dawn:1389, chromium:1412119
No-Try: true
Change-Id: I3a85be150a0c5ca8b0b74e4b097906f278dd3049
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118023
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
(cherry picked from commit 3da942086d48d732cbe51485f4c9739fba8b73fa)
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118600
diff --git a/src/dawn/native/metal/DeviceMTL.mm b/src/dawn/native/metal/DeviceMTL.mm
index 77de03e..1f2d9bc 100644
--- a/src/dawn/native/metal/DeviceMTL.mm
+++ b/src/dawn/native/metal/DeviceMTL.mm
@@ -275,6 +275,25 @@
     if (gpu_info::IsAMD(vendorId) || gpu_info::IsIntel(vendorId)) {
         SetToggle(Toggle::MetalUseCombinedDepthStencilFormatForStencil8, true);
     }
+
+    // Local testing shows the workaround is needed on AMD Radeon HD 8870M (gcn-1) MacOS 12.1;
+    // not on AMD Radeon Pro 555 (gcn-4) MacOS 13.1.
+    // Conservatively enable the workaround on AMD unless the system is MacOS 13.1+
+    // with architecture at least AMD gcn-4.
+    bool isLessThanAMDGN4OrMac13Dot1 = false;
+    if (gpu_info::IsAMDGCN1(vendorId, deviceId) || gpu_info::IsAMDGCN2(vendorId, deviceId) ||
+        gpu_info::IsAMDGCN3(vendorId, deviceId)) {
+        isLessThanAMDGN4OrMac13Dot1 = true;
+    } else if (gpu_info::IsAMD(vendorId)) {
+        if (@available(macos 13.1, *)) {
+        } else {
+            isLessThanAMDGN4OrMac13Dot1 = true;
+        }
+    }
+    if (isLessThanAMDGN4OrMac13Dot1) {
+        SetToggle(Toggle::MetalUseBothDepthAndStencilAttachmentsForCombinedDepthStencilFormats,
+                  true);
+    }
 #endif
 }