Now letting LLRenderTarget delete bound textures immediately instead of having them hang around until next frame.

This commit is contained in:
Shyotl
2011-07-17 19:48:37 -05:00
parent 330bf08c9b
commit 66336e8151
3 changed files with 9 additions and 4 deletions

View File

@@ -1015,12 +1015,17 @@ void LLImageGL::generateTextures(S32 numTextures, U32 *textures)
} }
// static // static
void LLImageGL::deleteTextures(S32 numTextures, U32 *textures) void LLImageGL::deleteTextures(S32 numTextures, U32 *textures, bool immediate)
{ {
for (S32 i = 0; i < numTextures; i++) for (S32 i = 0; i < numTextures; i++)
{ {
sDeadTextureList.push_back(textures[i]); sDeadTextureList.push_back(textures[i]);
} }
if (immediate)
{
LLImageGL::deleteDeadTextures();
}
} }
// static // static

View File

@@ -102,7 +102,7 @@ public:
// These 3 functions currently wrap glGenTextures(), glDeleteTextures(), and glTexImage2D() // These 3 functions currently wrap glGenTextures(), glDeleteTextures(), and glTexImage2D()
// for tracking purposes and will be deprecated in the future // for tracking purposes and will be deprecated in the future
static void generateTextures(S32 numTextures, U32 *textures); static void generateTextures(S32 numTextures, U32 *textures);
static void deleteTextures(S32 numTextures, U32 *textures); static void deleteTextures(S32 numTextures, U32 *textures, bool immediate = false);
static void setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels); static void setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels);
BOOL createGLTexture() ; BOOL createGLTexture() ;

View File

@@ -261,7 +261,7 @@ void LLRenderTarget::release()
} }
else else
{ {
LLImageGL::deleteTextures(1, &mDepth); LLImageGL::deleteTextures(1, &mDepth, true);
stop_glerror(); stop_glerror();
} }
mDepth = 0; mDepth = 0;
@@ -290,7 +290,7 @@ void LLRenderTarget::release()
if (mTex.size() > 0) if (mTex.size() > 0)
{ {
LLImageGL::deleteTextures(mTex.size(), &mTex[0]); LLImageGL::deleteTextures(mTex.size(), &mTex[0], true);
mTex.clear(); mTex.clear();
} }