Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 330 vs 331 for /trunk/Source Code/Managers/RenderPassManager.cpp

Diff revisions: vs.
  @@ -4,6 +4,25 @@
4 4
5 5 namespace Divide {
6 6
7 + RenderPassItem::RenderPassItem(const stringImpl& renderPassName, U8 sortKey) : _sortKey(sortKey)
8 + {
9 + _renderPass = std::make_unique<RenderPass>(renderPassName);
10 + }
11 +
12 + RenderPassItem::RenderPassItem(RenderPassItem &&other) : _renderPass(std::move(other._renderPass))
13 + {
14 + }
15 +
16 + RenderPassItem& RenderPassItem::operator=(RenderPassItem &&other)
17 + {
18 + _renderPass = std::move(other._renderPass);
19 + return *this;
20 + }
21 +
22 + RenderPassItem::~RenderPassItem()
23 + {
24 + }
25 +
7 26 RenderPassManager::RenderPassManager() : _renderPassesLocked(false), _renderPassesResetQueued(false)
8 27 {
9 28 RenderQueue::createInstance();
  @@ -11,9 +30,6 @@
11 30
12 31 RenderPassManager::~RenderPassManager()
13 32 {
14 - for ( RenderPassItem& rpi : _renderPasses ) {
15 - MemoryManager::SAFE_DELETE( rpi._rp );
16 - }
17 33 _renderPasses.clear();
18 34 RenderQueue::destroyInstance();
19 35 }
  @@ -30,34 +46,24 @@
30 46 }
31 47
32 48 void RenderPassManager::render(const SceneRenderState& sceneRenderState, SceneGraph* activeSceneGraph) {
33 - for(RenderPassItem& rpi : _renderPasses)
34 - rpi._rp->render(sceneRenderState, activeSceneGraph);
49 + for (RenderPassItem& rpi : _renderPasses) {
50 + rpi.renderPass().render(sceneRenderState, activeSceneGraph);
51 + }
35 52 }
36 53
37 - void RenderPassManager::addRenderPass(RenderPass* const renderPass, U8 orderKey) {
38 - assert(renderPass != nullptr);
39 - _renderPasses.push_back(RenderPassItem(orderKey,renderPass));
40 - std::sort(_renderPasses.begin(), _renderPasses.end(), [](const RenderPassItem& a, const RenderPassItem& b) -> bool { return a._sortKey < b._sortKey; });
41 - }
42 -
43 - void RenderPassManager::removeRenderPass(RenderPass* const renderPass,bool deleteRP) {
44 - for(vectorImpl<RenderPassItem >::iterator it = _renderPasses.begin(); it != _renderPasses.end(); it++){
45 - if(it->_rp->getName().compare(renderPass->getName()) == 0){
46 - if(deleteRP){
47 - MemoryManager::SAFE_DELETE( it->_rp );
48 - }
49 - _renderPasses.erase(it);
50 - break;
51 - }
52 - }
54 + void RenderPassManager::addRenderPass(const stringImpl& renderPassName, U8 orderKey) {
55 + assert(!renderPassName.empty());
56 +
57 + _renderPasses.push_back(RenderPassItem(renderPassName, orderKey));
58 + std::sort(_renderPasses.begin(), _renderPasses.end(),
59 + [](const RenderPassItem& a, const RenderPassItem& b) -> bool {
60 + return a.sortKey() < b.sortKey();
61 + });
53 62 }
54 63
55 - void RenderPassManager::removeRenderPass( const stringImpl& name, bool deleteRP ) {
56 - for ( vectorImpl<RenderPassItem >::iterator it = _renderPasses.begin(); it != _renderPasses.end(); it++ ) {
57 - if ( it->_rp->getName().compare( name ) == 0 ) {
58 - if ( deleteRP ) {
59 - MemoryManager::SAFE_DELETE( it->_rp );
60 - }
64 + void RenderPassManager::removeRenderPass( const stringImpl& name) {
65 + for (std::vector<RenderPassItem >::iterator it = _renderPasses.begin(); it != _renderPasses.end(); it++ ) {
66 + if ( it->renderPass().getName().compare( name ) == 0 ) {
61 67 _renderPasses.erase( it );
62 68 break;
63 69 }
  @@ -65,8 +71,9 @@
65 71 }
66 72
67 73 U16 RenderPassManager::getLastTotalBinSize(U8 renderPassId) const {
68 - if(renderPassId < _renderPasses.size())
69 - return _renderPasses[renderPassId]._rp->getLasTotalBinSize();
74 + if (renderPassId < _renderPasses.size()) {
75 + return _renderPasses[renderPassId].renderPass().getLasTotalBinSize();
76 + }
70 77
71 78 return 0;
72 79 }