From 57502a4582fa15a3d5b57155846bf4ccb54bef22 Mon Sep 17 00:00:00 2001 From: Doris Wu Date: Mon, 3 Feb 2025 23:58:33 +0800 Subject: [PATCH] Add operator== for FrameGraphInfo --- .../fgviewer/include/fgviewer/FrameGraphInfo.h | 8 ++++++++ libs/fgviewer/src/FrameGraphInfo.cpp | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/libs/fgviewer/include/fgviewer/FrameGraphInfo.h b/libs/fgviewer/include/fgviewer/FrameGraphInfo.h index 1e51a89f6ec8..d1e3b292df9a 100644 --- a/libs/fgviewer/include/fgviewer/FrameGraphInfo.h +++ b/libs/fgviewer/include/fgviewer/FrameGraphInfo.h @@ -36,17 +36,25 @@ class FrameGraphInfo { FrameGraphInfo(FrameGraphInfo const &) = delete; + bool operator==(const FrameGraphInfo& rhs) const; + struct Pass { Pass(utils::CString name, std::vector reads, std::vector writes); + bool operator==(const Pass& rhs) const; + utils::CString name; std::vector reads; std::vector writes; }; struct Resource { + bool operator==(const Resource& rhs) const; + struct Property { + bool operator==(const Property& rhs) const; + utils::CString name; utils::CString value; }; diff --git a/libs/fgviewer/src/FrameGraphInfo.cpp b/libs/fgviewer/src/FrameGraphInfo.cpp index 544171120be5..90cca55bc169 100644 --- a/libs/fgviewer/src/FrameGraphInfo.cpp +++ b/libs/fgviewer/src/FrameGraphInfo.cpp @@ -25,15 +25,33 @@ FrameGraphInfo::~FrameGraphInfo() = default; FrameGraphInfo::FrameGraphInfo(FrameGraphInfo&& rhs) noexcept = default; +bool FrameGraphInfo::operator==(const FrameGraphInfo& rhs) const { + return viewName == rhs.viewName + && passes == rhs.passes + && resources == rhs.resources; +} + FrameGraphInfo::Pass::Pass(utils::CString name, std::vector reads, std::vector writes): name(std::move(name)), reads(std::move(reads)), writes(std::move(writes)) {} +bool FrameGraphInfo::Pass::operator==(const Pass& rhs) const { + return name == rhs.name && reads == rhs.reads && writes == rhs.writes; +} + FrameGraphInfo::Resource::Resource(ResourceId id, utils::CString name, std::vector properties): id(id), name(std::move(name)), properties(std::move(properties)) {} +bool FrameGraphInfo::Resource::operator==(const Resource& rhs) const { + return id == rhs.id && name == rhs.name && properties == rhs.properties; +} + +bool FrameGraphInfo::Resource::Property::operator==(const Property &rhs) const { + return name == rhs.name && value == rhs.value; +} + void FrameGraphInfo::setResources( std::unordered_map resources) { this->resources = std::move(resources);