Permalink
Browse files

move deleting gl textures to TextureManager, fixes asic hang on AMD

  • Loading branch information...
1 parent 8278a6c commit c28fc84054464e853ca61d224f448255fbb3f53f @FernetMenta committed with fritsch Jul 26, 2012
Showing with 19 additions and 3 deletions.
  1. +2 −2 xbmc/Application.cpp
  2. +2 −1 xbmc/guilib/GUIFontTTFGL.cpp
  3. +13 −0 xbmc/guilib/TextureManager.cpp
  4. +2 −0 xbmc/guilib/TextureManager.h
View
@@ -2124,8 +2124,6 @@ void CApplication::Render()
g_Windowing.EndRender();
- g_TextureManager.FreeUnusedTextures();
-
// reset our info cache - we do this at the end of Render so that it is
// fresh for the next process(), or after a windowclose animation (where process()
// isn't called)
@@ -2164,6 +2162,8 @@ void CApplication::Render()
}
CTimeUtils::UpdateFrameTime(flip);
+ g_TextureManager.FreeUnusedTextures();
+
g_renderManager.UpdateResolution();
g_renderManager.ManageCaptures();
}
@@ -24,6 +24,7 @@
#include "GUIFontTTFGL.h"
#include "GUIFontManager.h"
#include "Texture.h"
+#include "TextureManager.h"
#include "GraphicContext.h"
#include "gui3d.h"
#include "utils/log.h"
@@ -234,7 +235,7 @@ void CGUIFontTTFGL::DeleteHardwareTexture()
if (m_bTextureLoaded)
{
if (glIsTexture(m_nTexture))
- glDeleteTextures(1, (GLuint*) &m_nTexture);
+ g_TextureManager.ReleaseHwTexture(m_nTexture);
m_bTextureLoaded = false;
}
}
@@ -457,6 +457,19 @@ void CGUITextureManager::FreeUnusedTextures()
for (ivecTextures i = m_unusedTextures.begin(); i != m_unusedTextures.end(); ++i)
delete *i;
m_unusedTextures.clear();
+
+#if defined(HAS_GL) || defined(HAS_GLES)
+ for (unsigned int i = 0; i < m_unusedHwTextures.size(); ++i)
+ {
+ glDeleteTextures(1, (GLuint*) &m_unusedHwTextures[i]);
+ }
+#endif
+ m_unusedHwTextures.clear();
+}
+
+void CGUITextureManager::ReleaseHwTexture(unsigned int texture)
+{
+ m_unusedHwTextures.push_back(texture);
}
void CGUITextureManager::Cleanup()
@@ -124,9 +124,11 @@ class CGUITextureManager
void RemoveTexturePath(const CStdString &texturePath); ///< Remove a path from the paths to check when loading media
void FreeUnusedTextures(); ///< Free textures (called from app thread only)
+ void ReleaseHwTexture(unsigned int texture);
protected:
std::vector<CTextureMap*> m_vecTextures;
std::vector<CTextureMap*> m_unusedTextures;
+ std::vector<unsigned int> m_unusedHwTextures;
typedef std::vector<CTextureMap*>::iterator ivecTextures;
// we have 2 texture bundles (one for the base textures, one for the theme)
CTextureBundle m_TexBundle[2];

0 comments on commit c28fc84

Please sign in to comment.