From 79c28d6dacbbc192c886d3e9ba14e1ae0a762ac6 Mon Sep 17 00:00:00 2001 From: hyde zhou Date: Tue, 13 Aug 2024 09:26:15 +0800 Subject: [PATCH] RenderPass now considers clearColor (#17530) --- native/cocos/renderer/gfx-base/GFXDef.cpp | 10 ++++++++++ .../cocos/renderer/pipeline/custom/RenderGraphTypes.h | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/native/cocos/renderer/gfx-base/GFXDef.cpp b/native/cocos/renderer/gfx-base/GFXDef.cpp index f3ed22f35a1..8a89def0486 100644 --- a/native/cocos/renderer/gfx-base/GFXDef.cpp +++ b/native/cocos/renderer/gfx-base/GFXDef.cpp @@ -248,6 +248,16 @@ bool operator==(const BufferBarrierInfo &lhs, const BufferBarrierInfo &rhs) { return !memcmp(&lhs, &rhs, sizeof(BufferBarrierInfo)); } +template <> +ccstd::hash_t Hasher::operator()(const Color &info) const { + ccstd::hash_t seed = 0; + ccstd::hash_combine(seed, info.x); + ccstd::hash_combine(seed, info.y); + ccstd::hash_combine(seed, info.z); + ccstd::hash_combine(seed, info.w); + return seed; +} + /////////////////////////////////////////////////////////////////////////////// bool operator==(const Viewport &lhs, const Viewport &rhs) { diff --git a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h index cebfb9f9114..7f7ee8197d3 100644 --- a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h +++ b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h @@ -108,8 +108,8 @@ struct RasterView { }; inline bool operator==(const RasterView& lhs, const RasterView& rhs) noexcept { - return std::forward_as_tuple(lhs.slotName, lhs.slotName1, lhs.accessType, lhs.attachmentType, lhs.loadOp, lhs.storeOp, lhs.clearFlags, lhs.shaderStageFlags) == - std::forward_as_tuple(rhs.slotName, rhs.slotName1, rhs.accessType, rhs.attachmentType, rhs.loadOp, rhs.storeOp, rhs.clearFlags, rhs.shaderStageFlags); + return std::forward_as_tuple(lhs.slotName, lhs.slotName1, lhs.accessType, lhs.attachmentType, lhs.loadOp, lhs.storeOp, lhs.clearFlags, lhs.clearColor, lhs.shaderStageFlags) == + std::forward_as_tuple(rhs.slotName, rhs.slotName1, rhs.accessType, rhs.attachmentType, rhs.loadOp, rhs.storeOp, rhs.clearFlags, rhs.clearColor, rhs.shaderStageFlags); } inline bool operator!=(const RasterView& lhs, const RasterView& rhs) noexcept { @@ -1219,6 +1219,7 @@ inline hash_t hash::operator()(const cc::render::RasterV hash_combine(seed, val.loadOp); hash_combine(seed, val.storeOp); hash_combine(seed, val.clearFlags); + hash_combine(seed, val.clearColor); hash_combine(seed, val.shaderStageFlags); return seed; }