Nux

Merge lp:~vanvugt/nux/fix-888039-nux1.0 into lp:nux/1.0

Proposed by Daniel van Vugt
Status: Merged
Approved by: Tim Penhey
Approved revision: 499
Merged at revision: 499
Proposed branch: lp:~vanvugt/nux/fix-888039-nux1.0
Merge into: lp:nux/1.0
Diff against target: 53 lines (+10/-12)
1 file modified
NuxGraphics/RunTimeStats.cpp (+10/-12)
To merge this branch: bzr merge lp:~vanvugt/nux/fix-888039-nux1.0
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Jay Taoko (community) Approve
Review via email: mp+91973@code.launchpad.net

Commit message

Fix gradual degradation in desktop performance caused by an ever-growing vector<int> filling with zeros. (LP: #888039)

This is a backport of Jason Smith's fix that is already upstream in Nux 2.0.

To post a comment you must log in.
Revision history for this message
Omer Akram (om26er) wrote :

I would happily work on the SRU when this gets approved and merged :)

Revision history for this message
Jay Taoko (jaytaoko) :
review: Approve
Revision history for this message
Tim Penhey (thumper) wrote :

Approving to take the team review from pending :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NuxGraphics/RunTimeStats.cpp'
2--- NuxGraphics/RunTimeStats.cpp 2011-09-20 06:03:43 +0000
3+++ NuxGraphics/RunTimeStats.cpp 2012-02-08 04:01:18 +0000
4@@ -114,7 +114,9 @@
5 }
6 case RTTEXTURE:
7 {
8- _texture_2d_array.push_back (NUX_STATIC_CAST (IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID() );
9+ int id = NUX_STATIC_CAST(IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID();
10+ if (id)
11+ _texture_2d_array.push_back(NUX_STATIC_CAST(IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID());
12 m_NumTex2D++;
13 m_GPUSizeTex2D += GetTextureSize (NUX_REINTERPRET_CAST (IOpenGLBaseTexture *, GraphicsObject) );
14 m_TotalGPUSize += m_GPUSizeTex2D;
15@@ -122,7 +124,9 @@
16 }
17 case RTTEXTURERECTANGLE:
18 {
19- _texture_rect_array.push_back (NUX_STATIC_CAST (IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID() );
20+ int id = NUX_STATIC_CAST(IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID();
21+ if (id)
22+ _texture_rect_array.push_back(NUX_STATIC_CAST(IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID());
23 m_NumTexRectangle++;
24 m_GPUSizeTexRectangle += GetTextureSize (NUX_REINTERPRET_CAST (IOpenGLBaseTexture *, GraphicsObject) );
25 m_TotalGPUSize += m_GPUSizeTexRectangle;
26@@ -183,11 +187,8 @@
27 }
28 case RTTEXTURE:
29 {
30- std::vector<int>::iterator it;
31- it = std::find (_texture_2d_array.begin(), _texture_2d_array.end(), NUX_STATIC_CAST (IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID() );
32-
33- if (it != _texture_2d_array.end() )
34- _texture_2d_array.erase (it);
35+ int id = NUX_STATIC_CAST(IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID();
36+ _texture_2d_array.erase(std::remove(_texture_2d_array.begin(), _texture_2d_array.end(), id), _texture_2d_array.end());
37
38 m_NumTex2D--;
39 m_GPUSizeTex2D -= GetTextureSize (NUX_REINTERPRET_CAST (IOpenGLBaseTexture *, GraphicsObject) );
40@@ -196,11 +197,8 @@
41 }
42 case RTTEXTURERECTANGLE:
43 {
44- std::vector<int>::iterator it;
45- it = std::find (_texture_rect_array.begin(), _texture_rect_array.end(), NUX_STATIC_CAST (IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID() );
46-
47- if (it != _texture_rect_array.end() )
48- _texture_rect_array.erase (it);
49+ int id = NUX_STATIC_CAST(IOpenGLBaseTexture *, GraphicsObject)->GetOpenGLID();
50+ _texture_rect_array.erase(std::remove(_texture_rect_array.begin(), _texture_rect_array.end(), id), _texture_rect_array.end());
51
52 m_NumTexRectangle--;
53 m_GPUSizeTexRectangle -= GetTextureSize (NUX_REINTERPRET_CAST (IOpenGLBaseTexture *, GraphicsObject) );

Subscribers

People subscribed via source and target branches

to all changes: