[dawn/native] Use C++20 default equation comparison when possible

Bug: 343500108
Change-Id: I0b690f32467eeb705ee45c47bc5bc7ac92c7c995
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/241375
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn
index 3bb03aa..9164aa8 100644
--- a/src/dawn/native/BUILD.gn
+++ b/src/dawn/native/BUILD.gn
@@ -318,7 +318,6 @@
     "ObjectBase.h",
     "ObjectContentHasher.cpp",
     "ObjectContentHasher.h",
-    "PassResourceUsage.cpp",
     "PassResourceUsage.h",
     "PassResourceUsageTracker.cpp",
     "PassResourceUsageTracker.h",
diff --git a/src/dawn/native/BindingInfo.cpp b/src/dawn/native/BindingInfo.cpp
index 65e6111..099d9f7 100644
--- a/src/dawn/native/BindingInfo.cpp
+++ b/src/dawn/native/BindingInfo.cpp
@@ -309,11 +309,6 @@
     };
 }
 
-bool BufferBindingInfo::operator==(const BufferBindingInfo& other) const {
-    return type == other.type && minBindingSize == other.minBindingSize &&
-           hasDynamicOffset == other.hasDynamicOffset;
-}
-
 // TextureBindingInfo
 
 // static
@@ -326,11 +321,6 @@
     };
 }
 
-bool TextureBindingInfo::operator==(const TextureBindingInfo& other) const {
-    return sampleType == other.sampleType && viewDimension == other.viewDimension &&
-           multisampled == other.multisampled;
-}
-
 // StorageTextureBindingInfo
 
 // static
@@ -344,10 +334,6 @@
     };
 }
 
-bool StorageTextureBindingInfo::operator==(const StorageTextureBindingInfo& other) const {
-    return format == other.format && viewDimension == other.viewDimension && access == other.access;
-}
-
 // SamplerBindingInfo
 
 // static
@@ -358,10 +344,6 @@
     };
 }
 
-bool SamplerBindingInfo::operator==(const SamplerBindingInfo& other) const {
-    return type == other.type;
-}
-
 // SamplerBindingInfo
 
 // static
@@ -373,28 +355,4 @@
     };
 }
 
-bool StaticSamplerBindingInfo::operator==(const StaticSamplerBindingInfo& other) const {
-    return sampler == other.sampler && sampledTextureBinding == other.sampledTextureBinding &&
-           isUsedForSingleTextureBinding == other.isUsedForSingleTextureBinding;
-}
-
-// ExternalTextureBindingLayout
-
-bool ExternalTextureBindingInfo::operator==(const ExternalTextureBindingInfo&) const {
-    return true;
-}
-
-// InputAttachmentBindingInfo
-
-bool InputAttachmentBindingInfo::operator==(const InputAttachmentBindingInfo& other) const {
-    return sampleType == other.sampleType;
-}
-
-// BindingInfo
-
-bool BindingInfo::operator==(const BindingInfo& other) const {
-    return binding == other.binding && visibility == other.visibility &&
-           arraySize == other.arraySize && bindingLayout == other.bindingLayout;
-}
-
 }  // namespace dawn::native
diff --git a/src/dawn/native/BindingInfo.h b/src/dawn/native/BindingInfo.h
index 1810654..292c256 100644
--- a/src/dawn/native/BindingInfo.h
+++ b/src/dawn/native/BindingInfo.h
@@ -78,7 +78,7 @@
     // Always false in shader reflection.
     bool hasDynamicOffset = false;
 
-    bool operator==(const BufferBindingInfo& other) const;
+    bool operator==(const BufferBindingInfo& other) const = default;
 };
 
 // A mirror of wgpu::TextureBindingLayout for use inside dawn::native.
@@ -91,7 +91,7 @@
     wgpu::TextureViewDimension viewDimension;
     bool multisampled;
 
-    bool operator==(const TextureBindingInfo& other) const;
+    bool operator==(const TextureBindingInfo& other) const = default;
 };
 
 // A mirror of wgpu::StorageTextureBindingLayout for use inside dawn::native.
@@ -102,7 +102,7 @@
     wgpu::TextureViewDimension viewDimension;
     wgpu::StorageTextureAccess access;
 
-    bool operator==(const StorageTextureBindingInfo& other) const;
+    bool operator==(const StorageTextureBindingInfo& other) const = default;
 };
 
 // A mirror of wgpu::SamplerBindingLayout for use inside dawn::native.
@@ -112,7 +112,7 @@
     // For shader reflection NonFiltering is never used and Filtering is used for any `sampler`.
     wgpu::SamplerBindingType type;
 
-    bool operator==(const SamplerBindingInfo& other) const;
+    bool operator==(const SamplerBindingInfo& other) const = default;
 };
 
 // A mirror of wgpu::StaticSamplerBindingLayout for use inside dawn::native.
@@ -127,19 +127,19 @@
     // Whether this instance is statically paired with a single texture.
     bool isUsedForSingleTextureBinding = false;
 
-    bool operator==(const StaticSamplerBindingInfo& other) const;
+    bool operator==(const StaticSamplerBindingInfo& other) const = default;
 };
 
 // A mirror of wgpu::ExternalTextureBindingLayout for use inside dawn::native.
 struct ExternalTextureBindingInfo {
-    bool operator==(const ExternalTextureBindingInfo& other) const;
+    bool operator==(const ExternalTextureBindingInfo& other) const = default;
 };
 
 // Internal to vulkan only.
 struct InputAttachmentBindingInfo {
     wgpu::TextureSampleType sampleType;
 
-    bool operator==(const InputAttachmentBindingInfo& other) const;
+    bool operator==(const InputAttachmentBindingInfo& other) const = default;
 };
 
 struct BindingInfo {
@@ -159,7 +159,7 @@
                  InputAttachmentBindingInfo>
         bindingLayout;
 
-    bool operator==(const BindingInfo& other) const;
+    bool operator==(const BindingInfo& other) const = default;
 };
 
 BindingInfoType GetBindingInfoType(const BindingInfo& bindingInfo);
@@ -169,9 +169,7 @@
     BindGroupIndex group;
     BindingNumber binding;
 
-    constexpr bool operator==(const BindingSlot& rhs) const {
-        return group == rhs.group && binding == rhs.binding;
-    }
+    constexpr bool operator==(const BindingSlot& rhs) const = default;
 };
 
 struct PerStageBindingCounts {
diff --git a/src/dawn/native/CMakeLists.txt b/src/dawn/native/CMakeLists.txt
index f11f6c9..291f351 100644
--- a/src/dawn/native/CMakeLists.txt
+++ b/src/dawn/native/CMakeLists.txt
@@ -214,7 +214,6 @@
     "Limits.cpp"
     "ObjectBase.cpp"
     "ObjectContentHasher.cpp"
-    "PassResourceUsage.cpp"
     "PassResourceUsageTracker.cpp"
     "PerStage.cpp"
     "PhysicalDevice.cpp"
diff --git a/src/dawn/native/CommandEncoder.cpp b/src/dawn/native/CommandEncoder.cpp
index 10048f8..eaea791 100644
--- a/src/dawn/native/CommandEncoder.cpp
+++ b/src/dawn/native/CommandEncoder.cpp
@@ -75,10 +75,7 @@
     // For 3d color attachment, it's the attachment's depthSlice.
     uint32_t depthOrArrayLayer;
 
-    bool operator==(const RecordedAttachment& other) const {
-        return ((other.texture == texture) && (other.mipLevel == mipLevel) &&
-                (other.depthOrArrayLayer == depthOrArrayLayer));
-    }
+    bool operator==(const RecordedAttachment& other) const = default;
 };
 
 enum class AttachmentType : uint8_t {
diff --git a/src/dawn/native/EnumMaskIterator.h b/src/dawn/native/EnumMaskIterator.h
index 0e337c8..594c007 100644
--- a/src/dawn/native/EnumMaskIterator.h
+++ b/src/dawn/native/EnumMaskIterator.h
@@ -55,9 +55,7 @@
             return *this;
         }
 
-        bool operator==(const Iterator& other) const { return mIter == other.mIter; }
-
-        bool operator!=(const Iterator& other) const { return mIter != other.mIter; }
+        bool operator==(const Iterator& other) const = default;
 
         T operator*() const {
             U value = *mIter;
diff --git a/src/dawn/native/EventManager.cpp b/src/dawn/native/EventManager.cpp
index 62ff4565..3dc70bf 100644
--- a/src/dawn/native/EventManager.cpp
+++ b/src/dawn/native/EventManager.cpp
@@ -79,8 +79,7 @@
 
     explicit WrappingIterator(typename Traits::WrappedIter wrappedIt) : mWrappedIt(wrappedIt) {}
 
-    bool operator!=(const WrappingIterator& rhs) const { return rhs.mWrappedIt != mWrappedIt; }
-    bool operator==(const WrappingIterator& rhs) const { return rhs.mWrappedIt == mWrappedIt; }
+    bool operator==(const WrappingIterator& rhs) const = default;
 
     difference_type operator-(const WrappingIterator& rhs) const {
         return mWrappedIt - rhs.mWrappedIt;
diff --git a/src/dawn/native/IndirectDrawMetadata.cpp b/src/dawn/native/IndirectDrawMetadata.cpp
index 135fa2c..72fa797 100644
--- a/src/dawn/native/IndirectDrawMetadata.cpp
+++ b/src/dawn/native/IndirectDrawMetadata.cpp
@@ -280,11 +280,4 @@
                     other.drawType);
 }
 
-bool IndirectDrawMetadata::IndexedIndirectConfig::operator==(
-    const IndexedIndirectConfig& other) const {
-    return std::tie(inputIndirectBufferPtr, duplicateBaseVertexInstance, drawType) ==
-           std::tie(other.inputIndirectBufferPtr, other.duplicateBaseVertexInstance,
-                    other.drawType);
-}
-
 }  // namespace dawn::native
diff --git a/src/dawn/native/IndirectDrawMetadata.h b/src/dawn/native/IndirectDrawMetadata.h
index 1617a4a..e58813b 100644
--- a/src/dawn/native/IndirectDrawMetadata.h
+++ b/src/dawn/native/IndirectDrawMetadata.h
@@ -142,7 +142,7 @@
         DrawType drawType;
 
         bool operator<(const IndexedIndirectConfig& other) const;
-        bool operator==(const IndexedIndirectConfig& other) const;
+        bool operator==(const IndexedIndirectConfig& other) const = default;
     };
 
     using IndexedIndirectBufferValidationInfoMap =
diff --git a/src/dawn/native/PassResourceUsage.cpp b/src/dawn/native/PassResourceUsage.cpp
deleted file mode 100644
index 977d554..0000000
--- a/src/dawn/native/PassResourceUsage.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2022 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-//    contributors may be used to endorse or promote products derived from
-//    this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "dawn/native/PassResourceUsage.h"
-
-namespace dawn::native {
-
-bool operator==(const TextureSyncInfo& a, const TextureSyncInfo& b) {
-    return (a.usage == b.usage) && (a.shaderStages == b.shaderStages);
-}
-
-}  // namespace dawn::native
diff --git a/src/dawn/native/PassResourceUsage.h b/src/dawn/native/PassResourceUsage.h
index f85642b..fc6f2b0 100644
--- a/src/dawn/native/PassResourceUsage.h
+++ b/src/dawn/native/PassResourceUsage.h
@@ -56,10 +56,9 @@
 struct TextureSyncInfo {
     wgpu::TextureUsage usage = wgpu::TextureUsage::None;
     wgpu::ShaderStage shaderStages = wgpu::ShaderStage::None;
+    bool operator==(const TextureSyncInfo& b) const = default;
 };
 
-bool operator==(const TextureSyncInfo& a, const TextureSyncInfo& b);
-
 // The texture usage inside passes must be tracked per-subresource.
 using TextureSubresourceSyncInfo = SubresourceStorage<TextureSyncInfo>;