MAINT-2968 disable client GL namegen, go spec

This commit is contained in:
Siana Gearz
2013-10-13 17:07:45 +02:00
parent aa077032b7
commit 19625ea6b8
12 changed files with 47 additions and 161 deletions

View File

@@ -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;
@@ -791,8 +789,13 @@ 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,
@@ -1055,66 +1058,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)
{
if (format == 0 || 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]);
glTexImage2D(LLTexUnit::getInternalType(type), j, format, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}
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);
}
/*if (immediate)
{
LLImageGL::deleteDeadTextures();
}*/
}
// static
@@ -1242,11 +1198,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)
{
@@ -1363,7 +1319,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));
@@ -1413,7 +1369,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
decTextureCounter(mTextureMemory, mComponents, mCategory) ;
}
LLImageGL::deleteTextures(mBindTarget, mFormatInternal, mMipLevels, 1, &old_name);
LLImageGL::deleteTextures(1, &old_name);
stop_glerror();
}
@@ -1548,34 +1504,6 @@ void LLImageGL::deleteDeadTextures()
{
bool reset = false;
/*for(U32 i=0;i<LLTexUnit::TT_NONE;++i)
{
for(dead_texturelist_t::iterator it=sDeadTextureList[i].begin();it!=sDeadTextureList[i].end();++it)
{
while(!it->second.empty())
{
GLuint tex = it->second.front();
it->second.pop_front();
for (int j = 0; j < gGLManager.mNumTextureImageUnits; j++)
{
LLTexUnit* tex_unit = gGL.getTexUnit(j);
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();
@@ -1596,7 +1524,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 ;