summaryrefslogtreecommitdiff
path: root/indra/llrender/llimagegl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rwxr-xr-xindra/llrender/llimagegl.cpp121
1 files changed, 17 insertions, 104 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 38764eba23..ab875141c5 100755
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -54,8 +54,6 @@ S32 LLImageGL::sGlobalTextureMemoryInBytes = 0;
S32 LLImageGL::sBoundTextureMemoryInBytes = 0;
S32 LLImageGL::sCurBoundTextureMemory = 0;
S32 LLImageGL::sCount = 0;
-LLImageGL::dead_texturelist_t LLImageGL::sDeadTextureList[LLTexUnit::TT_NONE];
-U32 LLImageGL::sCurTexName = 1;
BOOL LLImageGL::sGlobalUseAnisotropic = FALSE;
F32 LLImageGL::sLastFrameTime = 0.f;
@@ -715,9 +713,14 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
mMipLevels = wpo2(llmax(w, h));
- //use legacy mipmap generation mode
- glTexParameteri(mTarget, GL_GENERATE_MIPMAP, GL_TRUE);
-
+ //use legacy mipmap generation mode (note: making this condional can cause rendering issues)
+ // -- but making it not conditional triggers deprecation warnings when core profile is enabled
+ // (some rendering issues while core profile is enabled are acceptable at this point in time)
+ if (!LLRender::sGLCoreProfile)
+ {
+ glTexParameteri(mTarget, GL_GENERATE_MIPMAP, GL_TRUE);
+ }
+
LLImageGL::setManualImage(mTarget, 0, mFormatInternal,
w, h,
mFormatPrimary, mFormatType,
@@ -1084,85 +1087,19 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_
// static
static LLFastTimer::DeclareTimer FTM_GENERATE_TEXTURES("generate textures");
-void LLImageGL::generateTextures(LLTexUnit::eTextureType type, U32 format, S32 numTextures, U32 *textures)
+void LLImageGL::generateTextures(S32 numTextures, U32 *textures)
{
LLFastTimer t(FTM_GENERATE_TEXTURES);
- bool empty = true;
-
- dead_texturelist_t::iterator iter = sDeadTextureList[type].find(format);
-
- if (iter != sDeadTextureList[type].end())
- {
- empty = iter->second.empty();
- }
-
- for (S32 i = 0; i < numTextures; ++i)
- {
- if (!empty)
- {
- textures[i] = iter->second.front();
- iter->second.pop_front();
- empty = iter->second.empty();
- }
- else
- {
- textures[i] = sCurTexName++;
- }
- }
+ glGenTextures(numTextures, textures);
}
// static
-void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip_levels, S32 numTextures, U32 *textures, bool immediate)
+void LLImageGL::deleteTextures(S32 numTextures, U32 *textures)
{
if (gGLManager.mInited)
{
- switch (format)
- {
- case 0:
-
- // We get ARB errors in debug when attempting to use glTexImage2D with these deprecated pix formats
- //
- case GL_LUMINANCE8:
- case GL_INTENSITY8:
- case GL_ALPHA8:
- glDeleteTextures(numTextures, textures);
- break;
-
- default:
- {
- if (type == LLTexUnit::TT_CUBE_MAP || mip_levels == -1)
- { //unknown internal format or unknown number of mip levels, not safe to reuse
- glDeleteTextures(numTextures, textures);
- }
- else
- {
- for (S32 i = 0; i < numTextures; ++i)
- { //remove texture from VRAM by setting its size to zero
-
- for (S32 j = 0; j <= mip_levels; j++)
- {
- gGL.getTexUnit(0)->bindManual(type, textures[i]);
- U32 internal_type = LLTexUnit::getInternalType(type);
- glTexImage2D(internal_type, j, format, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- stop_glerror();
- }
-
- llassert(std::find(sDeadTextureList[type][format].begin(),
- sDeadTextureList[type][format].end(), textures[i]) ==
- sDeadTextureList[type][format].end());
-
- sDeadTextureList[type][format].push_back(textures[i]);
- }
- }
+ glDeleteTextures(numTextures, textures);
}
- break;
- }
- }
-
- /*if (immediate)
- {
- LLImageGL::deleteDeadTextures();
- }*/
}
// static
@@ -1290,11 +1227,11 @@ BOOL LLImageGL::createGLTexture()
if(mTexName)
{
- LLImageGL::deleteTextures(mBindTarget, mFormatInternal, mMipLevels, 1, (reinterpret_cast<GLuint*>(&mTexName))) ;
+ LLImageGL::deleteTextures(1, (reinterpret_cast<GLuint*>(&mTexName))) ;
}
- LLImageGL::generateTextures(mBindTarget, mFormatInternal, 1, &mTexName);
+ LLImageGL::generateTextures(1, &mTexName);
stop_glerror();
if (!mTexName)
{
@@ -1409,7 +1346,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
}
else
{
- LLImageGL::generateTextures(mBindTarget, mFormatInternal, 1, &mTexName);
+ LLImageGL::generateTextures(1, &mTexName);
stop_glerror();
{
llverify(gGL.getTexUnit(0)->bind(this));
@@ -1454,7 +1391,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
{
sGlobalTextureMemoryInBytes -= mTextureMemory;
- LLImageGL::deleteTextures(mBindTarget, mFormatInternal, mMipLevels, 1, &old_name);
+ LLImageGL::deleteTextures(1, &old_name);
stop_glerror();
}
@@ -1583,30 +1520,6 @@ void LLImageGL::deleteDeadTextures()
{
bool reset = false;
- /*while (!sDeadTextureList.empty())
- {
- GLuint tex = sDeadTextureList.front();
- sDeadTextureList.pop_front();
- for (int i = 0; i < gGLManager.mNumTextureImageUnits; i++)
- {
- LLTexUnit* tex_unit = gGL.getTexUnit(i);
-
- if (tex_unit && tex_unit->getCurrTexture() == tex)
- {
- tex_unit->unbind(tex_unit->getCurrType());
- stop_glerror();
-
- if (i > 0)
- {
- reset = true;
- }
- }
- }
-
- glDeleteTextures(1, &tex);
- stop_glerror();
- }*/
-
if (reset)
{
gGL.getTexUnit(0)->activate();
@@ -1623,7 +1536,7 @@ void LLImageGL::destroyGLTexture()
mTextureMemory = 0;
}
- LLImageGL::deleteTextures(mBindTarget, mFormatInternal, mMipLevels, 1, &mTexName);
+ LLImageGL::deleteTextures(1, &mTexName);
mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel.
mTexName = 0;
mGLTextureCreated = FALSE ;