From d9a9ec10b7a16d1f1358e0b6588a5ec0cab08650 Mon Sep 17 00:00:00 2001 From: owen <1053210246@qq.com> Date: Sun, 23 Jun 2019 23:14:24 +0800 Subject: [PATCH] Native optimize --- .../cocos2d_libs.xcodeproj/project.pbxproj | 12 ++ native/cocos/Android.mk | 1 + native/cocos/renderer/scene/MemPool.cpp | 41 ++++- native/cocos/renderer/scene/MemPool.hpp | 7 +- native/cocos/renderer/scene/MeshBuffer.cpp | 43 +++-- native/cocos/renderer/scene/MeshBuffer.hpp | 9 +- native/cocos/renderer/scene/ModelBatcher.cpp | 1 - native/cocos/renderer/scene/NodeMemPool.cpp | 39 ++++- native/cocos/renderer/scene/NodeMemPool.hpp | 15 +- native/cocos/renderer/scene/NodeProxy.cpp | 30 ++-- native/cocos/renderer/scene/NodeProxy.hpp | 2 +- native/cocos/renderer/scene/ParallelTask.cpp | 155 ++++++++++++++++++ native/cocos/renderer/scene/ParallelTask.hpp | 78 +++++++++ native/cocos/renderer/scene/RenderFlow.cpp | 131 ++++++++++++++- native/cocos/renderer/scene/RenderFlow.hpp | 39 ++++- .../renderer/scene/assembler/Assembler.cpp | 33 ++++ .../renderer/scene/assembler/Assembler.hpp | 39 +---- .../auto/api/jsb_renderer_auto_api.js | 20 +++ .../js-bindings/auto/jsb_renderer_auto.cpp | 40 +++++ .../js-bindings/auto/jsb_renderer_auto.hpp | 2 + 20 files changed, 635 insertions(+), 102 deletions(-) create mode 100644 native/cocos/renderer/scene/ParallelTask.cpp create mode 100644 native/cocos/renderer/scene/ParallelTask.hpp diff --git a/native/build/cocos2d_libs.xcodeproj/project.pbxproj b/native/build/cocos2d_libs.xcodeproj/project.pbxproj index a8d673957b..99649eeab8 100644 --- a/native/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/native/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -255,6 +255,10 @@ 0482F1C0228D87970019ECF7 /* Assembler.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0482F197228D87960019ECF7 /* Assembler.hpp */; }; 0482F1C1228D87970019ECF7 /* AssemblerBase.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0482F198228D87970019ECF7 /* AssemblerBase.hpp */; }; 0482F1C2228D87970019ECF7 /* AssemblerBase.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0482F198228D87970019ECF7 /* AssemblerBase.hpp */; }; + 0494CFD422BEFC6D00B73B79 /* ParallelTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0494CFD222BEFC6D00B73B79 /* ParallelTask.cpp */; }; + 0494CFD522BEFC6D00B73B79 /* ParallelTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0494CFD222BEFC6D00B73B79 /* ParallelTask.cpp */; }; + 0494CFD622BEFC6D00B73B79 /* ParallelTask.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0494CFD322BEFC6D00B73B79 /* ParallelTask.hpp */; }; + 0494CFD722BEFC6D00B73B79 /* ParallelTask.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0494CFD322BEFC6D00B73B79 /* ParallelTask.hpp */; }; 04AF62FF219190ED00AED9DE /* TypedArrayPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04AF62FD219190ED00AED9DE /* TypedArrayPool.cpp */; }; 04AF6300219190ED00AED9DE /* TypedArrayPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 04AF62FD219190ED00AED9DE /* TypedArrayPool.cpp */; }; 04AF6301219190ED00AED9DE /* TypedArrayPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 04AF62FE219190ED00AED9DE /* TypedArrayPool.h */; }; @@ -1499,6 +1503,8 @@ 0482F196228D87960019ECF7 /* CustomAssembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomAssembler.cpp; sourceTree = ""; }; 0482F197228D87960019ECF7 /* Assembler.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Assembler.hpp; sourceTree = ""; }; 0482F198228D87970019ECF7 /* AssemblerBase.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = AssemblerBase.hpp; sourceTree = ""; }; + 0494CFD222BEFC6D00B73B79 /* ParallelTask.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ParallelTask.cpp; sourceTree = ""; }; + 0494CFD322BEFC6D00B73B79 /* ParallelTask.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ParallelTask.hpp; sourceTree = ""; }; 04AF62FD219190ED00AED9DE /* TypedArrayPool.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TypedArrayPool.cpp; path = "../cocos/editor-support/TypedArrayPool.cpp"; sourceTree = ""; }; 04AF62FE219190ED00AED9DE /* TypedArrayPool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TypedArrayPool.h; path = "../cocos/editor-support/TypedArrayPool.h"; sourceTree = ""; }; 04DBD30922AE2D8000DBE4CD /* VertexEffectDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexEffectDelegate.h; path = "../cocos/editor-support/spine-creator-support/VertexEffectDelegate.h"; sourceTree = ""; }; @@ -2559,6 +2565,8 @@ 04DBD4DA22B51EA300DBE4CD /* MemPool.hpp */, 04DBD4DF22B51EB300DBE4CD /* NodeMemPool.cpp */, 04DBD4E022B51EB300DBE4CD /* NodeMemPool.hpp */, + 0494CFD222BEFC6D00B73B79 /* ParallelTask.cpp */, + 0494CFD322BEFC6D00B73B79 /* ParallelTask.hpp */, ); path = scene; sourceTree = ""; @@ -3844,6 +3852,7 @@ 4617863120522469008256E1 /* SocketIO.h in Headers */, 46FDDBD1202ADDCE00931238 /* ccUTF8.h in Headers */, 4693045A2046AE06004A3D6C /* EventDispatcher.h in Headers */, + 0494CFD622BEFC6D00B73B79 /* ParallelTask.hpp in Headers */, 1AAAC8F3205CB6E9005321B9 /* AudioEngine.h in Headers */, 1A52DB6E205BCDC700350EE3 /* Object.hpp in Headers */, ED3057A21BEC77D50083C3ED /* xxhash.h in Headers */, @@ -3985,6 +3994,7 @@ 04DBD3E822AE2DBD00DBE4CD /* PathConstraintMixTimeline.h in Headers */, 04DBD43622AE2DBD00DBE4CD /* RotateMode.h in Headers */, 04355819217EADF300B9C056 /* IOBuffer.h in Headers */, + 0494CFD722BEFC6D00B73B79 /* ParallelTask.hpp in Headers */, 046E06342185B41100B24E2D /* Animation.h in Headers */, 461786682052607E008256E1 /* jsb_websocket.hpp in Headers */, 4617865E2052607E008256E1 /* jsb_xmlhttprequest.hpp in Headers */, @@ -4379,6 +4389,7 @@ 04DBD48522AE2DBD00DBE4CD /* EventTimeline.cpp in Sources */, 046E06DD2185B49F00B24E2D /* AnimationData.cpp in Sources */, 046E06202185B37100B24E2D /* CCArmatureDisplay.cpp in Sources */, + 0494CFD422BEFC6D00B73B79 /* ParallelTask.cpp in Sources */, 046E06882185B44A00B24E2D /* BaseFactory.cpp in Sources */, 1A52DB30205BCD9200350EE3 /* ScriptEngine.cpp in Sources */, 0482F1A1228D87970019ECF7 /* NodeProxy.cpp in Sources */, @@ -4821,6 +4832,7 @@ 046E06442185B41100B24E2D /* Animation.cpp in Sources */, 50ABBD3D1925AB0000A911A9 /* CCGeometry.cpp in Sources */, 046E06CA2185B49F00B24E2D /* UserData.cpp in Sources */, + 0494CFD522BEFC6D00B73B79 /* ParallelTask.cpp in Sources */, 1A28FF8C1F20AFAB007A1D9D /* SRURLUtilities.m in Sources */, 0482F1B4228D87970019ECF7 /* MaskAssembler.cpp in Sources */, 04DBD45222AE2DBD00DBE4CD /* AnimationStateData.cpp in Sources */, diff --git a/native/cocos/Android.mk b/native/cocos/Android.mk index 372a3efca4..c9fe7c10de 100644 --- a/native/cocos/Android.mk +++ b/native/cocos/Android.mk @@ -150,6 +150,7 @@ renderer/scene/RenderFlow.cpp \ renderer/scene/StencilManager.cpp \ renderer/scene/MemPool.cpp \ renderer/scene/NodeMemPool.cpp \ +renderer/scene/ParallelTask.cpp \ scripting/js-bindings/auto/jsb_gfx_auto.cpp \ scripting/js-bindings/auto/jsb_renderer_auto.cpp \ scripting/js-bindings/manual/jsb_renderer_manual.cpp \ diff --git a/native/cocos/renderer/scene/MemPool.cpp b/native/cocos/renderer/scene/MemPool.cpp index f1d63733dc..a07417da43 100644 --- a/native/cocos/renderer/scene/MemPool.cpp +++ b/native/cocos/renderer/scene/MemPool.cpp @@ -102,11 +102,33 @@ MemPool::~MemPool() { for(auto it = _commonPool.begin(); it != _commonPool.end(); it++) { - delete (*it); + if (*it) + { + delete (*it); + } } _commonPool.clear(); } +void MemPool::removeCommonData(std::size_t unitID) +{ + CCASSERT(unitID < _commonPool.size(), "MemPool removeCommonData unitID can not be rather than pool size"); + auto unit = _commonPool[unitID]; + if (unit) + { + delete unit; + _commonPool[unitID] = nullptr; + for (auto it = _commonList.begin(); it != _commonList.end(); it++) + { + if ((*it)->unitID == unitID) + { + _commonList.erase(it); + break; + } + } + } +} + void MemPool::updateCommonData(std::size_t unitID, se_object_ptr dataObj, se_object_ptr signDataObj) { CCASSERT(unitID <= _commonPool.size(), "MemPool updateData unitID can not be rather than pool size"); @@ -116,16 +138,24 @@ void MemPool::updateCommonData(std::size_t unitID, se_object_ptr dataObj, se_obj { unit = new UnitCommon; _commonPool.push_back(unit); + _commonList.push_back(unit); } else if (unitID < _commonPool.size()) { unit = _commonPool[unitID]; + if (!unit) + { + unit = new UnitCommon; + _commonPool[unitID] = unit; + _commonList.push_back(unit); + } } else { return; } + unit->unitID = unitID; unit->setData(dataObj); unit->setSignData(signDataObj); } @@ -135,10 +165,15 @@ const std::vector& MemPool::getCommonPool() const return _commonPool; } -UnitCommon& MemPool::getCommonUnit(std::size_t unitID) +const std::vector& MemPool::getCommonList() const +{ + return _commonList; +} + +UnitCommon* MemPool::getCommonUnit(std::size_t unitID) { CCASSERT(unitID < _commonPool.size(), "MemPool getCommonUnit unitID can not be rather than pool size"); - return *_commonPool[unitID]; + return _commonPool[unitID]; } RENDERER_END diff --git a/native/cocos/renderer/scene/MemPool.hpp b/native/cocos/renderer/scene/MemPool.hpp index 75ad3eb46c..70288a1e3d 100644 --- a/native/cocos/renderer/scene/MemPool.hpp +++ b/native/cocos/renderer/scene/MemPool.hpp @@ -38,6 +38,8 @@ public: void set(se::Object** dataObj, uint8_t** data, std::size_t* dataLen, se::Object* jsData); void unset(se::Object** dataObj, uint8_t** data, std::size_t* dataLen); + + std::size_t unitID = 0; }; struct Sign @@ -84,11 +86,14 @@ public: MemPool(); virtual ~MemPool(); + void removeCommonData(std::size_t unitID); void updateCommonData(std::size_t unitID, se_object_ptr dataObj, se_object_ptr signDataObj); - UnitCommon& getCommonUnit(std::size_t unitID); + UnitCommon* getCommonUnit(std::size_t unitID); const std::vector& getCommonPool() const; + const std::vector& getCommonList() const; private: std::vector _commonPool; + std::vector _commonList; }; RENDERER_END diff --git a/native/cocos/renderer/scene/MeshBuffer.cpp b/native/cocos/renderer/scene/MeshBuffer.cpp index c1ac832ddb..dc23da4b1d 100644 --- a/native/cocos/renderer/scene/MeshBuffer.cpp +++ b/native/cocos/renderer/scene/MeshBuffer.cpp @@ -54,7 +54,26 @@ MeshBuffer::MeshBuffer(ModelBatcher* batcher, VertexFormat* fmt) MeshBuffer::~MeshBuffer() { + for (std::size_t i = 0, n = _vbArr.size(); i < n; i++) + { + _vbArr.at(i)->destroy(); + } + _vbArr.clear(); + + _ib->destroy(); _ib->release(); + + if (iData) + { + delete[] iData; + iData = nullptr; + } + + if (vData) + { + delete[] vData; + vData = nullptr; + } } void MeshBuffer::reallocVBuffer() @@ -63,7 +82,7 @@ void MeshBuffer::reallocVBuffer() vData = new float[_vDataCount]; if (oldVData) { - memcpy(vData, oldVData, sizeof(float) * _vDataCount); + memcpy(vData, oldVData, sizeof(float) * _oldVDataCount); delete[] oldVData; oldVData = nullptr; } @@ -76,7 +95,7 @@ void MeshBuffer::reallocIBuffer() iData = new uint16_t[_iDataCount]; if (oldIData) { - memcpy(iData, oldIData, sizeof(uint16_t) * _iDataCount); + memcpy(iData, oldIData, sizeof(uint16_t) * _oldIDataCount); delete[] oldIData; oldIData = nullptr; } @@ -135,6 +154,8 @@ bool MeshBuffer::requestStatic(uint32_t vertexCount, uint32_t indexCount, Offset if (byteOffset > vBytes) { + _oldVDataCount = _vDataCount; + while (vBytes < byteOffset) { _vDataCount *= 2; @@ -146,6 +167,8 @@ bool MeshBuffer::requestStatic(uint32_t vertexCount, uint32_t indexCount, Offset if (indexOffset > _iDataCount) { + _oldIDataCount = _iDataCount; + while (_iDataCount < indexOffset) { _iDataCount *= 2; @@ -181,20 +204,4 @@ void MeshBuffer::reset() _dirty = false; } -void MeshBuffer::destroy() -{ - _vb->destroy(); - _ib->destroy(); - if (iData) - { - delete[] iData; - iData = nullptr; - } - if (vData) - { - delete[] vData; - vData = nullptr; - } -} - RENDERER_END diff --git a/native/cocos/renderer/scene/MeshBuffer.hpp b/native/cocos/renderer/scene/MeshBuffer.hpp index 3332a7d3ba..bf6c0bdbfa 100644 --- a/native/cocos/renderer/scene/MeshBuffer.hpp +++ b/native/cocos/renderer/scene/MeshBuffer.hpp @@ -89,10 +89,6 @@ public: * @brief Reset all states. */ void reset(); - /** - * @brief Destroy the mesh buffer. - */ - void destroy(); /** * @brief Gets the current byte offset which indicates the start of empty range @@ -166,8 +162,13 @@ private: uint32_t _vertexStart = 0; uint32_t _vertexOffset = 0; uint32_t _bytesPerVertex = 0; + uint32_t _vDataCount = 0; uint32_t _iDataCount = 0; + + uint32_t _oldVDataCount = 0; + uint32_t _oldIDataCount = 0; + bool _dirty = false; ModelBatcher* _batcher = nullptr; diff --git a/native/cocos/renderer/scene/ModelBatcher.cpp b/native/cocos/renderer/scene/ModelBatcher.cpp index 074d697ce0..b959778cdc 100644 --- a/native/cocos/renderer/scene/ModelBatcher.cpp +++ b/native/cocos/renderer/scene/ModelBatcher.cpp @@ -74,7 +74,6 @@ ModelBatcher::~ModelBatcher() for (auto iter = _buffers.begin(); iter != _buffers.end(); ++iter) { MeshBuffer *buffer = iter->second; - buffer->destroy(); delete buffer; } _buffers.clear(); diff --git a/native/cocos/renderer/scene/NodeMemPool.cpp b/native/cocos/renderer/scene/NodeMemPool.cpp index 073beafa87..6752701423 100644 --- a/native/cocos/renderer/scene/NodeMemPool.cpp +++ b/native/cocos/renderer/scene/NodeMemPool.cpp @@ -98,15 +98,44 @@ void UnitNode::setNode(se::Object *jsData) NodeMemPool* NodeMemPool::_instance = nullptr; +NodeMemPool::NodeMemPool() +{ + _instance = this; +} + +NodeMemPool::~NodeMemPool() +{ + for(auto it = _nodePool.begin(); it != _nodePool.end(); it++) + { + if (*it) + { + delete (*it); + } + } + _nodePool.clear(); + _instance = nullptr; +} + const std::vector& NodeMemPool::getNodePool() const { return _nodePool; } -UnitNode& NodeMemPool::getUnit(std::size_t unitID) const +void NodeMemPool::removeNodeData(std::size_t unitID) +{ + CCASSERT(unitID < _nodePool.size(), "NodeMemPool removeNodeData unitID can not be rather than pool size"); + auto unit = _nodePool[unitID]; + if (unit) + { + delete unit; + _nodePool[unitID] = nullptr; + } +} + +UnitNode* NodeMemPool::getUnit(std::size_t unitID) const { CCASSERT(unitID < _nodePool.size(), "NodeMemPool getUnit unitID can not be rather than pool size"); - return *_nodePool[unitID]; + return _nodePool[unitID]; } void NodeMemPool::updateNodeData(std::size_t unitID, se_object_ptr dirty, se_object_ptr trs, se_object_ptr localMat, se_object_ptr worldMat, se_object_ptr parent, se_object_ptr zOrder, se_object_ptr cullingMask, se_object_ptr opacity, se_object_ptr is3D, se_object_ptr node) @@ -123,12 +152,18 @@ void NodeMemPool::updateNodeData(std::size_t unitID, se_object_ptr dirty, se_obj else if (unitID < _nodePool.size()) { unit = _nodePool[unitID]; + if(!unit) + { + unit = new UnitNode; + _nodePool[unitID] = unit; + } } else { return; } + unit->unitID = unitID; unit->setDirty(dirty); unit->setTRS(trs); unit->setLocalMat(localMat); diff --git a/native/cocos/renderer/scene/NodeMemPool.hpp b/native/cocos/renderer/scene/NodeMemPool.hpp index 5d43330f35..433d8f6635 100644 --- a/native/cocos/renderer/scene/NodeMemPool.hpp +++ b/native/cocos/renderer/scene/NodeMemPool.hpp @@ -158,24 +158,19 @@ protected: class NodeMemPool: public MemPool { public: - NodeMemPool() - { - _instance = this; - } - - virtual ~NodeMemPool() - { - _instance = nullptr; - } + NodeMemPool(); + virtual ~NodeMemPool(); static NodeMemPool* getInstance() { return _instance; } + void removeNodeData(std::size_t unitID); + void updateNodeData(std::size_t unitID, se_object_ptr dirty, se_object_ptr trs, se_object_ptr localMat, se_object_ptr worldMat, se_object_ptr parent, se_object_ptr zOrder, se_object_ptr cullingMask, se_object_ptr opacity, se_object_ptr is3D, se_object_ptr node); - UnitNode& getUnit(std::size_t unitID) const; + UnitNode* getUnit(std::size_t unitID) const; const std::vector& getNodePool() const; private: static NodeMemPool* _instance; diff --git a/native/cocos/renderer/scene/NodeProxy.cpp b/native/cocos/renderer/scene/NodeProxy.cpp index a72b7e454d..4e340a5866 100644 --- a/native/cocos/renderer/scene/NodeProxy.cpp +++ b/native/cocos/renderer/scene/NodeProxy.cpp @@ -49,21 +49,22 @@ NodeProxy::NodeProxy(std::size_t unitID, std::size_t index, std::string id) NodeMemPool* pool = NodeMemPool::getInstance(); CCASSERT(pool, "NodeProxy constructor NodeMemPool is null"); - UnitNode& unit = pool->getUnit(unitID); - - _dirty = unit.getDirty(index); - _trs = unit.getTRS(index); - _localMat = unit.getLocalMat(index); - _worldMat = unit.getWorldMat(index); - _parentInfo = unit.getParent(index); + UnitNode* unit = pool->getUnit(unitID); + CCASSERT(unit, "NodeProxy constructor unit is null"); + + _dirty = unit->getDirty(index); + _trs = unit->getTRS(index); + _localMat = unit->getLocalMat(index); + _worldMat = unit->getWorldMat(index); + _parentInfo = unit->getParent(index); _parentInfo->unitID = 0xffffffff; _parentInfo->index = 0xffffffff; - _localZOrder = unit.getZOrder(index); - _cullingMask = unit.getCullingMask(index); - _opacity = unit.getOpacity(index); - _is3DNode = unit.getOpacity(index); + _localZOrder = unit->getZOrder(index); + _cullingMask = unit->getCullingMask(index); + _opacity = unit->getOpacity(index); + _is3DNode = unit->getOpacity(index); - uint64_t* self = unit.getNode(index); + uint64_t* self = unit->getNode(index); *self = (uint64_t)this; } @@ -211,8 +212,9 @@ void NodeProxy::notifyUpdateParent() NodeMemPool* pool = NodeMemPool::getInstance(); CCASSERT(pool, "NodeProxy updateParent NodeMemPool is null"); - UnitNode& unit = pool->getUnit(_parentInfo->unitID); - uint64_t* parentAddrs = unit.getNode(_parentInfo->index); + UnitNode* unit = pool->getUnit(_parentInfo->unitID); + CCASSERT(unit, "NodeProxy updateParent unit is null"); + uint64_t* parentAddrs = unit->getNode(_parentInfo->index); NodeProxy* parent = (NodeProxy*)*parentAddrs; CCASSERT(parent, "NodeProxy updateParent parent is null"); diff --git a/native/cocos/renderer/scene/NodeProxy.hpp b/native/cocos/renderer/scene/NodeProxy.hpp index 43d096279b..ad2ad0beb9 100644 --- a/native/cocos/renderer/scene/NodeProxy.hpp +++ b/native/cocos/renderer/scene/NodeProxy.hpp @@ -308,7 +308,7 @@ private: uint8_t _realOpacity = 255; std::string _id = ""; std::string _name = ""; - uint32_t _level = 0; + std::size_t _level = 0; uint32_t* _dirty = nullptr; TRS* _trs = nullptr; diff --git a/native/cocos/renderer/scene/ParallelTask.cpp b/native/cocos/renderer/scene/ParallelTask.cpp new file mode 100644 index 0000000000..1b2c36be9c --- /dev/null +++ b/native/cocos/renderer/scene/ParallelTask.cpp @@ -0,0 +1,155 @@ +/**************************************************************************** + Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#include "ParallelTask.hpp" + +RENDERER_BEGIN + +ParallelTask::ParallelTask() +{ + +} + +ParallelTask::~ParallelTask() +{ + destroy(); +} + +void ParallelTask::init(int threadNum) +{ + _finished = false; + _threadNum = threadNum; + + _tasks.resize(_threadNum); + _threads.resize(_threadNum); + _runFlags = new uint8_t[_threadNum]; + memset(_runFlags, RunFlag::Wait, sizeof(uint8_t) * _threadNum); + + for(auto i = 0; i < _threadNum; i++) + { + setThread(i); + } +} + +void ParallelTask::pushTask(int tid, const Task& task) +{ + if (tid >= 0 && tid < _tasks.size()) + { + _tasks[tid].push_back(task); + } +} + +void ParallelTask::clearTasks() +{ + for(std::size_t i = 0, n = _tasks.size(); i < n; i++) + { + _tasks[i].clear(); + } +} + +uint8_t* ParallelTask::getRunFlag() +{ + return _runFlags; +} + +void ParallelTask::destroy() +{ + _finished = true; + begin(); + for (int i = 0, n = (int)_threads.size(); i < n; ++i) + { + joinThread(i); + } + _tasks.clear(); + _threads.clear(); + delete _runFlags; + _runFlags = nullptr; + _threadNum = 0; +} + +void ParallelTask::stop() +{ + if (!_runFlags) return; + memset(_runFlags, RunFlag::Wait, sizeof(uint8_t) * _threadNum); +} + +void ParallelTask::begin() +{ + if (!_runFlags) return; + memset(_runFlags, RunFlag::ToProcess, sizeof(uint8_t) * _threadNum); + + { + std::unique_lock lock(_mutex); + _cv.notify_all(); + } +} + +void ParallelTask::joinThread(int tid) +{ + if (tid < 0 || tid >= (int)_threads.size()) + { + return; + } + + if (_threads[tid]->joinable()) + { + _threads[tid]->join(); + } +} + +void ParallelTask::setThread(int tid) +{ + auto f = [this, tid]() { + uint8_t& runFlag = _runFlags[tid]; + if (!runFlag) return; + + auto& taskQueue = _tasks[tid]; + std::size_t idx = 0; + std::size_t taskCount = 0; + + while (!_finished) + { + while (runFlag == RunFlag::ToProcess) + { + for (idx = 0, taskCount = taskQueue.size(); idx < taskCount; idx++) + { + Task task = taskQueue[idx]; + task(tid); + } + runFlag = RunFlag::ProcessFinished; + } + + if (runFlag == RunFlag::Wait) + { + std::unique_lock lock(_mutex); + _cv.wait(lock, [this, &runFlag]() { + return runFlag == RunFlag::ToProcess || _finished; + }); + } + } + }; + _threads[tid].reset(new(std::nothrow) std::thread(f)); +} + +RENDERER_END diff --git a/native/cocos/renderer/scene/ParallelTask.hpp b/native/cocos/renderer/scene/ParallelTask.hpp new file mode 100644 index 0000000000..f7cde79af4 --- /dev/null +++ b/native/cocos/renderer/scene/ParallelTask.hpp @@ -0,0 +1,78 @@ +/**************************************************************************** + Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#pragma once + +#include "../Macro.h" +#include +#include +#include +#include +#include +#include +#include + +RENDERER_BEGIN + +class ParallelTask +{ +public: + + enum RunFlag{ + ToProcess = 0x00, + ProcessFinished = 0x01, + Wait = 0x02, + }; + + typedef std::function Task; + + ParallelTask(); + virtual ~ParallelTask(); + + void pushTask(int tid, const Task& task); + void clearTasks(); + + uint8_t* getRunFlag(); + + void init(int threadNum); + void destroy(); + + void stop(); + void begin(); +private: + void joinThread(int tid); + void setThread(int tid); +private: + std::vector> _tasks; + std::vector> _threads; + + uint8_t* _runFlags = nullptr; + bool _finished = false; + int _threadNum = 0; + + std::mutex _mutex; + std::condition_variable _cv; +}; + +RENDERER_END diff --git a/native/cocos/renderer/scene/RenderFlow.cpp b/native/cocos/renderer/scene/RenderFlow.cpp index e92f4aa514..fa0ae08a23 100644 --- a/native/cocos/renderer/scene/RenderFlow.cpp +++ b/native/cocos/renderer/scene/RenderFlow.cpp @@ -30,6 +30,9 @@ RENDERER_BEGIN const uint32_t InitLevelCount = 3; const uint32_t InitLevelNodeCount = 100; +const uint32_t LocalMat_Use_Thread_Unit_Count = 5; +const uint32_t WorldMat_Use_Thread_Node_count = 500; + RenderFlow* RenderFlow::_instance = nullptr; RenderFlow::RenderFlow(DeviceGraphics* device, Scene* scene, ForwardRenderer* forward) @@ -40,6 +43,30 @@ RenderFlow::RenderFlow(DeviceGraphics* device, Scene* scene, ForwardRenderer* fo _instance = this; _batcher = new ModelBatcher(this); + +#if SUB_RENDER_THREAD_COUNT > 0 + _paralleTask = new ParallelTask(); + _paralleTask->init(SUB_RENDER_THREAD_COUNT); + + _runFlag = &_paralleTask->getRunFlag()[0]; + + for (uint32_t i = 0; i < SUB_RENDER_THREAD_COUNT; i++) + { + _paralleTask->pushTask(i, [&](int tid){ + switch(_parallelStage) + { + case ParallelStage::LOCAL_MAT: + calculateLocalMatrix(tid); + break; + case ParallelStage::WORLD_MAT: + calculateLevelWorldMatrix(tid); + break; + default: + break; + } + }); + } +#endif _levelInfoArr.resize(InitLevelCount); for (auto i = 0; i < InitLevelCount; i++) @@ -50,10 +77,11 @@ RenderFlow::RenderFlow(DeviceGraphics* device, Scene* scene, ForwardRenderer* fo RenderFlow::~RenderFlow() { + delete _paralleTask; CC_SAFE_DELETE(_batcher); } -void RenderFlow::removeNodeLevel(uint32_t level, cocos2d::Mat4* worldMat) +void RenderFlow::removeNodeLevel(std::size_t level, cocos2d::Mat4* worldMat) { if (level >= _levelInfoArr.size()) return; auto& levelInfos = _levelInfoArr[level]; @@ -67,7 +95,7 @@ void RenderFlow::removeNodeLevel(uint32_t level, cocos2d::Mat4* worldMat) } } -void RenderFlow::insertNodeLevel(uint32_t level, const LevelInfo& levelInfo) +void RenderFlow::insertNodeLevel(std::size_t level, const LevelInfo& levelInfo) { if (level >= _levelInfoArr.size()) { @@ -77,14 +105,14 @@ void RenderFlow::insertNodeLevel(uint32_t level, const LevelInfo& levelInfo) levelInfos.push_back(levelInfo); } -void RenderFlow::calculateLocalMatrix() +void RenderFlow::calculateLocalMatrix(int tid) { const uint16_t SPACE_FREE_FLAG = 0x0; - static cocos2d::Mat4 matTemp; + cocos2d::Mat4 matTemp; NodeMemPool* instance = NodeMemPool::getInstance(); CCASSERT(instance, "RenderFlow calculateLocalMatrix NodeMemPool is null"); - auto& commonPool = instance->getCommonPool(); + auto& commonList = instance->getCommonList(); auto& nodePool = instance->getNodePool(); UnitCommon* commonUnit = nullptr; @@ -99,16 +127,29 @@ void RenderFlow::calculateLocalMatrix() cocos2d::Quaternion* quat = nullptr; float trsZ = 0.0f, trsSZ = 0.0f; - for(auto i = 0; i < commonPool.size(); i++) + std::size_t begin = 0, end = commonList.size(); + std::size_t fieldSize = end / RENDER_THREAD_COUNT; + if (tid >= 0) { - commonUnit = commonPool[i]; + begin = tid * fieldSize; + if (tid < RENDER_THREAD_COUNT - 1) + { + end = (tid + 1) * fieldSize; + } + } + + for(auto i = begin; i < end; i++) + { + commonUnit = commonList[i]; + if (!commonUnit) continue; usingNum = commonUnit->getUsingNum(); if (usingNum == 0) continue; contentNum = commonUnit->getContentNum(); signData = commonUnit->getSignData(0); - nodeUnit = nodePool[i]; + nodeUnit = nodePool[commonUnit->unitID]; + dirty = nodeUnit->getDirty(0); localMat = nodeUnit->getLocalMat(0); trs = nodeUnit->getTRS(0); @@ -139,6 +180,40 @@ void RenderFlow::calculateLocalMatrix() } } +void RenderFlow::calculateLevelWorldMatrix(int tid) +{ + auto& levelInfos = _levelInfoArr[_curLevel]; + + std::size_t begin = 0, end = levelInfos.size(); + std::size_t fieldSize = end / RENDER_THREAD_COUNT; + if (tid >= 0) + { + begin = tid * fieldSize; + if (tid < RENDER_THREAD_COUNT - 1) + { + end = (tid + 1) * fieldSize; + } + } + + for(std::size_t index = begin; index < end; index++) + { + auto& info = levelInfos[index]; + auto selfDirty = *info.dirty & WORLD_TRANSFORM; + if (info.parentDirty != nullptr && ((*info.parentDirty & WORLD_TRANSFORM_CHANGED) || selfDirty)) + { + info.worldMat->multiply(*info.parentWorldMat, *info.localMat, info.worldMat); + *info.dirty |= WORLD_TRANSFORM_CHANGED; + *info.dirty &= ~WORLD_TRANSFORM; + } + else if (selfDirty) + { + *info.worldMat = *info.localMat; + *info.dirty |= WORLD_TRANSFORM_CHANGED; + *info.dirty &= ~WORLD_TRANSFORM; + } + } +} + void RenderFlow::calculateWorldMatrix() { for(std::size_t level = 0, n = _levelInfoArr.size(); level < n; level++) @@ -168,8 +243,48 @@ void RenderFlow::render(NodeProxy* scene) { if (scene != nullptr) { + +#if SUB_RENDER_THREAD_COUNT > 0 + + int mainThreadTid = RENDER_THREAD_COUNT - 1; + + NodeMemPool* instance = NodeMemPool::getInstance(); + auto& commonList = instance->getCommonList(); + if (commonList.size() < LocalMat_Use_Thread_Unit_Count) + { + calculateLocalMatrix(); + } + else + { + _parallelStage = ParallelStage::LOCAL_MAT; + _paralleTask->begin(); + + calculateLocalMatrix(mainThreadTid); + while(*_runFlag != ParallelTask::RunFlag::ProcessFinished) std::this_thread::yield(); + } + + _parallelStage = ParallelStage::WORLD_MAT; + _curLevel = 0; + for(auto count = _levelInfoArr.size(); _curLevel < count; _curLevel++) + { + auto& levelInfos = _levelInfoArr[_curLevel]; + if (levelInfos.size() < WorldMat_Use_Thread_Node_count) + { + calculateLevelWorldMatrix(); + } + else + { + *_runFlag = ParallelTask::RunFlag::ToProcess; + calculateLevelWorldMatrix(mainThreadTid); + while(*_runFlag != ParallelTask::RunFlag::ProcessFinished) std::this_thread::yield(); + } + } + + _paralleTask->stop(); +#else calculateLocalMatrix(); calculateWorldMatrix(); +#endif _batcher->startBatch(); scene->visitAsRoot(_batcher, _scene); diff --git a/native/cocos/renderer/scene/RenderFlow.hpp b/native/cocos/renderer/scene/RenderFlow.hpp index 8708f4ac36..da11cad83e 100644 --- a/native/cocos/renderer/scene/RenderFlow.hpp +++ b/native/cocos/renderer/scene/RenderFlow.hpp @@ -30,6 +30,7 @@ #include "../renderer/Scene.h" #include "../renderer/ForwardRenderer.h" #include "../gfx/DeviceGraphics.h" +#include "ParallelTask.hpp" RENDERER_BEGIN @@ -47,6 +48,10 @@ RENDERER_BEGIN let renderFlow = cc.RenderFlow._nativeFlow; @endcode */ + +#define SUB_RENDER_THREAD_COUNT 1 +#define RENDER_THREAD_COUNT (SUB_RENDER_THREAD_COUNT + 1) + class RenderFlow { public: @@ -72,6 +77,12 @@ public: // world matrix changed WORLD_TRANSFORM_CHANGED = 1 << 12 }; + + enum ParallelStage { + NONE, + LOCAL_MAT, + WORLD_MAT, + }; struct LevelInfo{ uint32_t* dirty = nullptr; @@ -121,29 +132,43 @@ public: void visit(NodeProxy* rootNode); /** * @brief Calculate local matrix. + * @param[in] tid It must rather than -1 if enable multiple thread. */ - void calculateLocalMatrix(); + void calculateLocalMatrix(int tid = -1); /** * @brief Calculate world matrix. */ void calculateWorldMatrix(); + /** + * @brief Calculate world matrix by level. + * @param[in] tid Thread id. + * @param[level] level Node level. + */ + void calculateLevelWorldMatrix(int tid = -1); /** * @brief remove node level */ - void removeNodeLevel(uint32_t level, cocos2d::Mat4* worldMat); + void removeNodeLevel(std::size_t level, cocos2d::Mat4* worldMat); /** * @brief insert node level */ - void insertNodeLevel(uint32_t level, const LevelInfo& levelInfo); + void insertNodeLevel(std::size_t level, const LevelInfo& levelInfo); private: static RenderFlow *_instance; - ModelBatcher* _batcher; - Scene* _scene; - DeviceGraphics* _device; - ForwardRenderer* _forward; + ModelBatcher* _batcher = nullptr; + Scene* _scene = nullptr; + DeviceGraphics* _device = nullptr; + ForwardRenderer* _forward = nullptr; + std::size_t _curLevel = 0; std::vector> _levelInfoArr; + +#if SUB_RENDER_THREAD_COUNT > 0 + ParallelStage _parallelStage = ParallelStage::NONE; + ParallelTask* _paralleTask = nullptr; + uint8_t* _runFlag = nullptr; +#endif }; // end of scene group diff --git a/native/cocos/renderer/scene/assembler/Assembler.cpp b/native/cocos/renderer/scene/assembler/Assembler.cpp index d134c84b96..28ca79633d 100644 --- a/native/cocos/renderer/scene/assembler/Assembler.cpp +++ b/native/cocos/renderer/scene/assembler/Assembler.cpp @@ -37,6 +37,39 @@ RENDERER_BEGIN static MeshBuffer::OffsetInfo s_offsets; +Assembler::IARenderData::IARenderData() +{ + +} + +Assembler::IARenderData::IARenderData(const IARenderData& o) +{ + meshIndex = o.meshIndex; + verticesStart = o.verticesStart; + verticesCount = o.verticesCount; + indicesStart = o.indicesStart; + indicesCount = o.indicesCount; + setEffect(o.getEffect()); +} + +Assembler::IARenderData::~IARenderData() +{ + CC_SAFE_RELEASE(_effect); +} + +void Assembler::IARenderData::setEffect(Effect* effect) +{ + if (effect == _effect) return; + CC_SAFE_RELEASE(_effect); + _effect = effect; + CC_SAFE_RETAIN(_effect); +} + +Effect* Assembler::IARenderData::getEffect() const +{ + return _effect; +} + Assembler::Assembler() { diff --git a/native/cocos/renderer/scene/assembler/Assembler.hpp b/native/cocos/renderer/scene/assembler/Assembler.hpp index e9a61c3306..bef269f8a4 100644 --- a/native/cocos/renderer/scene/assembler/Assembler.hpp +++ b/native/cocos/renderer/scene/assembler/Assembler.hpp @@ -66,40 +66,13 @@ class Assembler : public AssemblerBase { public: - struct IARenderData { + class IARenderData { public: - IARenderData() - { - - } - - IARenderData(const IARenderData& o) - { - meshIndex = o.meshIndex; - verticesStart = o.verticesStart; - verticesCount = o.verticesCount; - indicesStart = o.indicesStart; - indicesCount = o.indicesCount; - setEffect(o.getEffect()); - } - - ~IARenderData() - { - CC_SAFE_RELEASE(_effect); - } - - void setEffect(Effect* effect) - { - if (effect == _effect) return; - CC_SAFE_RELEASE(_effect); - _effect = effect; - CC_SAFE_RETAIN(_effect); - } - - Effect* getEffect() const - { - return _effect; - } + IARenderData(); + IARenderData(const IARenderData& o); + ~IARenderData(); + void setEffect(Effect* effect); + Effect* getEffect() const; private: Effect* _effect = nullptr; public: diff --git a/native/cocos/scripting/js-bindings/auto/api/jsb_renderer_auto_api.js b/native/cocos/scripting/js-bindings/auto/api/jsb_renderer_auto_api.js index 4159ececa6..10cb7a1589 100644 --- a/native/cocos/scripting/js-bindings/auto/api/jsb_renderer_auto_api.js +++ b/native/cocos/scripting/js-bindings/auto/api/jsb_renderer_auto_api.js @@ -1680,6 +1680,16 @@ object { }, +/** + * @method removeCommonData + * @param {unsigned int} arg0 + */ +removeCommonData : function ( +int +) +{ +}, + /** * @method MemPool * @constructor @@ -1696,6 +1706,16 @@ MemPool : function ( */ renderer.NodeMemPool = { +/** + * @method removeNodeData + * @param {unsigned int} arg0 + */ +removeNodeData : function ( +int +) +{ +}, + /** * @method updateNodeData * @param {unsigned int} arg0 diff --git a/native/cocos/scripting/js-bindings/auto/jsb_renderer_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_renderer_auto.cpp index 04a2acb5bb..88d2909c1c 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_renderer_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_renderer_auto.cpp @@ -3861,6 +3861,25 @@ static bool js_renderer_MemPool_updateCommonData(se::State& s) } SE_BIND_FUNC(js_renderer_MemPool_updateCommonData) +static bool js_renderer_MemPool_removeCommonData(se::State& s) +{ + cocos2d::renderer::MemPool* cobj = (cocos2d::renderer::MemPool*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_renderer_MemPool_removeCommonData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_renderer_MemPool_removeCommonData : Error processing arguments"); + cobj->removeCommonData(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_renderer_MemPool_removeCommonData) + SE_DECLARE_FINALIZE_FUNC(js_cocos2d_renderer_MemPool_finalize) static bool js_renderer_MemPool_constructor(se::State& s) @@ -3894,6 +3913,7 @@ bool js_register_renderer_MemPool(se::Object* obj) auto cls = se::Class::create("MemPool", obj, nullptr, _SE(js_renderer_MemPool_constructor)); cls->defineFunction("updateCommonData", _SE(js_renderer_MemPool_updateCommonData)); + cls->defineFunction("removeCommonData", _SE(js_renderer_MemPool_removeCommonData)); cls->defineFinalizeFunction(_SE(js_cocos2d_renderer_MemPool_finalize)); cls->install(); JSBClassType::registerClass(cls); @@ -3908,6 +3928,25 @@ bool js_register_renderer_MemPool(se::Object* obj) se::Object* __jsb_cocos2d_renderer_NodeMemPool_proto = nullptr; se::Class* __jsb_cocos2d_renderer_NodeMemPool_class = nullptr; +static bool js_renderer_NodeMemPool_removeNodeData(se::State& s) +{ + cocos2d::renderer::NodeMemPool* cobj = (cocos2d::renderer::NodeMemPool*)s.nativeThisObject(); + SE_PRECONDITION2(cobj, false, "js_renderer_NodeMemPool_removeNodeData : Invalid Native Object"); + const auto& args = s.args(); + size_t argc = args.size(); + CC_UNUSED bool ok = true; + if (argc == 1) { + size_t arg0 = 0; + ok &= seval_to_size(args[0], &arg0); + SE_PRECONDITION2(ok, false, "js_renderer_NodeMemPool_removeNodeData : Error processing arguments"); + cobj->removeNodeData(arg0); + return true; + } + SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1); + return false; +} +SE_BIND_FUNC(js_renderer_NodeMemPool_removeNodeData) + static bool js_renderer_NodeMemPool_updateNodeData(se::State& s) { cocos2d::renderer::NodeMemPool* cobj = (cocos2d::renderer::NodeMemPool*)s.nativeThisObject(); @@ -3996,6 +4035,7 @@ bool js_register_renderer_NodeMemPool(se::Object* obj) { auto cls = se::Class::create("NodeMemPool", obj, __jsb_cocos2d_renderer_MemPool_proto, _SE(js_renderer_NodeMemPool_constructor)); + cls->defineFunction("removeNodeData", _SE(js_renderer_NodeMemPool_removeNodeData)); cls->defineFunction("updateNodeData", _SE(js_renderer_NodeMemPool_updateNodeData)); cls->defineStaticFunction("getInstance", _SE(js_renderer_NodeMemPool_getInstance)); cls->defineFinalizeFunction(_SE(js_cocos2d_renderer_NodeMemPool_finalize)); diff --git a/native/cocos/scripting/js-bindings/auto/jsb_renderer_auto.hpp b/native/cocos/scripting/js-bindings/auto/jsb_renderer_auto.hpp index 5c3953c5ee..81b7961a94 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_renderer_auto.hpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_renderer_auto.hpp @@ -231,6 +231,7 @@ extern se::Class* __jsb_cocos2d_renderer_MemPool_class; bool js_register_cocos2d_renderer_MemPool(se::Object* obj); bool register_all_renderer(se::Object* obj); SE_DECLARE_FUNC(js_renderer_MemPool_updateCommonData); +SE_DECLARE_FUNC(js_renderer_MemPool_removeCommonData); SE_DECLARE_FUNC(js_renderer_MemPool_MemPool); extern se::Object* __jsb_cocos2d_renderer_NodeMemPool_proto; @@ -238,6 +239,7 @@ extern se::Class* __jsb_cocos2d_renderer_NodeMemPool_class; bool js_register_cocos2d_renderer_NodeMemPool(se::Object* obj); bool register_all_renderer(se::Object* obj); +SE_DECLARE_FUNC(js_renderer_NodeMemPool_removeNodeData); SE_DECLARE_FUNC(js_renderer_NodeMemPool_updateNodeData); SE_DECLARE_FUNC(js_renderer_NodeMemPool_getInstance); SE_DECLARE_FUNC(js_renderer_NodeMemPool_NodeMemPool);