From 43f835b7bdddddcddf4c4e11a91e157e1cbe0e2e Mon Sep 17 00:00:00 2001 From: Zach Lee Date: Wed, 17 May 2023 15:44:53 +0800 Subject: [PATCH] fix: vb ib indirect should be shared. (#15062) --- native/cocos/core/assets/RenderingSubMesh.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/native/cocos/core/assets/RenderingSubMesh.cpp b/native/cocos/core/assets/RenderingSubMesh.cpp index e031c50ca8..363414194c 100644 --- a/native/cocos/core/assets/RenderingSubMesh.cpp +++ b/native/cocos/core/assets/RenderingSubMesh.cpp @@ -207,15 +207,9 @@ void RenderingSubMesh::enableVertexIdChannel(gfx::Device *device) { } bool RenderingSubMesh::destroy() { - for (auto *vertexBuffer : _vertexBuffers) { - vertexBuffer->destroy(); - } _vertexBuffers.clear(); - - if (_indexBuffer && _isOwnerOfIndexBuffer) { - _indexBuffer->destroy(); - _indexBuffer = nullptr; - } + _indexBuffer = nullptr; + _indirectBuffer = nullptr; if (!_jointMappedBuffers.empty() && !_jointMappedBufferIndices.empty()) { for (uint32_t index : _jointMappedBufferIndices) { @@ -224,8 +218,6 @@ bool RenderingSubMesh::destroy() { _jointMappedBuffers.clear(); _jointMappedBufferIndices.clear(); } - - CC_SAFE_DESTROY_NULL(_indirectBuffer); return true; }