From 72bd01f273df6bf82dceecfbe762dd3cb87c6eb2 Mon Sep 17 00:00:00 2001 From: timlyeee <43355299+timlyeee@users.noreply.github.com> Date: Thu, 14 Apr 2022 21:37:16 +0800 Subject: [PATCH] Combine hash with validator/agent (#10753) While the texture is destroyed, the old validator is destroyed and new validator inited. But framebuffer validator maintains the old one as hash is the same, so when it start the validation check, the old texture validator jumped out and assertion failed. --- native/cocos/renderer/gfx-base/GFXDef.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/native/cocos/renderer/gfx-base/GFXDef.cpp b/native/cocos/renderer/gfx-base/GFXDef.cpp index 734e7f716b..3ef36f4680 100644 --- a/native/cocos/renderer/gfx-base/GFXDef.cpp +++ b/native/cocos/renderer/gfx-base/GFXDef.cpp @@ -113,12 +113,14 @@ bool operator==(const RenderPassInfo& lhs, const RenderPassInfo& rhs) { template <> size_t Hasher::operator()(const FramebufferInfo& info) const { // render pass is mostly irrelevant - size_t seed = (info.colorTextures.size() + 1) * 2; + size_t seed = (info.colorTextures.size() + 1) * 3; for (auto* colorTexture : info.colorTextures) { + boost::hash_combine(seed, colorTexture); boost::hash_combine(seed, colorTexture->getRaw()); boost::hash_combine(seed, colorTexture->getHash()); } + boost::hash_combine(seed, info.depthStencilTexture); boost::hash_combine(seed, info.depthStencilTexture->getRaw()); boost::hash_combine(seed, info.depthStencilTexture->getHash()); return seed;