GetFormatEquivalentToIOSurfaceFormat: Add compressed formats

The following formats can be bound to Metal textures exactly the same
way as their non-compressed versions.
- kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarVideoRange
- kCVPixelFormatType_Lossless_420YpCbCr10PackedBiPlanarVideoRange
- kCVPixelFormatType_Lossless_422YpCbCr10PackedBiPlanarVideoRange

Bug: 500766607
Change-Id: I538d6dac245da4c16dfb0c0816cc93fe31cd70b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/326215
Reviewed-by: Christopher Cameron <ccameron@google.com>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
diff --git a/src/dawn/native/metal/SharedTextureMemoryMTL.mm b/src/dawn/native/metal/SharedTextureMemoryMTL.mm
index d566e82..bb2a3eb 100644
--- a/src/dawn/native/metal/SharedTextureMemoryMTL.mm
+++ b/src/dawn/native/metal/SharedTextureMemoryMTL.mm
@@ -64,16 +64,19 @@
         case kCVPixelFormatType_OneComponent16:
             return wgpu::TextureFormat::R16Unorm;
         case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
+        case kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarVideoRange:
             return wgpu::TextureFormat::R8BG8Biplanar420Unorm;
         case kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange:
             return wgpu::TextureFormat::R8BG8Biplanar422Unorm;
         case kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange:
             return wgpu::TextureFormat::R8BG8Biplanar444Unorm;
         case kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange:
+        case kCVPixelFormatType_Lossless_420YpCbCr10PackedBiPlanarVideoRange:
             return wgpu::TextureFormat::R10X6BG10X6Biplanar420Unorm;
         case kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange:
             return wgpu::TextureFormat::R10X6BG10X6Biplanar422Unorm;
         case kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange:
+        case kCVPixelFormatType_Lossless_422YpCbCr10PackedBiPlanarVideoRange:
             return wgpu::TextureFormat::R10X6BG10X6Biplanar444Unorm;
         case kCVPixelFormatType_420YpCbCr8VideoRange_8A_TriPlanar:
             return wgpu::TextureFormat::R8BG8A8Triplanar420Unorm;
diff --git a/src/dawn/tests/white_box/SharedTextureMemoryTests_apple.mm b/src/dawn/tests/white_box/SharedTextureMemoryTests_apple.mm
index 9ae7a59..4918cc2 100644
--- a/src/dawn/tests/white_box/SharedTextureMemoryTests_apple.mm
+++ b/src/dawn/tests/white_box/SharedTextureMemoryTests_apple.mm
@@ -144,7 +144,7 @@
             uint32_t bytesPerElement;
             wgpu::FeatureName requiredFeature = wgpu::FeatureName(0u);
         };
-        const std::array<IOSurfaceFormat, 21> kFormats{
+        const std::array<IOSurfaceFormat, 24> kFormats{
             {{kCVPixelFormatType_64RGBAHalf, 8},
              {kCVPixelFormatType_TwoComponent16Half, 4},
              {kCVPixelFormatType_OneComponent16Half, 2},
@@ -161,6 +161,7 @@
              {kCVPixelFormatType_DisparityFloat32, 4},
              // Below bytes per element isn't correct.
              {kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange, 4},
+             {kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarVideoRange, 4},
              {kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange, 4,
               wgpu::FeatureName::MultiPlanarFormatNv16},
              {kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange, 4,
@@ -169,9 +170,13 @@
               wgpu::FeatureName::MultiPlanarFormatNv12a},
              {kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange, 8,
               wgpu::FeatureName::MultiPlanarFormatP010},
+             {kCVPixelFormatType_Lossless_420YpCbCr10PackedBiPlanarVideoRange, 8,
+              wgpu::FeatureName::MultiPlanarFormatP010},
              {kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange, 8,
               wgpu::FeatureName::MultiPlanarFormatP210},
              {kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange, 8,
+              wgpu::FeatureName::MultiPlanarFormatP410},
+             {kCVPixelFormatType_Lossless_422YpCbCr10PackedBiPlanarVideoRange, 8,
               wgpu::FeatureName::MultiPlanarFormatP410}}};
 
         for (auto f : kFormats) {