summaryrefslogtreecommitdiff
path: root/indra/llrender/llimagegl.cpp
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-02-07 09:18:09 -0800
committerGraham Madarasz <graham@lindenlab.com>2013-02-07 09:18:09 -0800
commit019c7566fb431a9bacfa6d1b778a3a7ec9f8fbf2 (patch)
treeff50b1f5b6d93debb4f75ca25ef91f6220c7e799 /indra/llrender/llimagegl.cpp
parentb4dba269dc5e45992ba1e6126da0c01519c51f08 (diff)
For MAINT-1291 Code Review: DaveP
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rw-r--r--indra/llrender/llimagegl.cpp57
1 files changed, 41 insertions, 16 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index a4d7872ec2..552dac518a 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -726,6 +726,12 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
stop_glerror();
}
+
+ if (LLRender::sGLCoreProfile)
+ {
+ glGenerateMipmap(mTarget);
+ }
+ stop_glerror();
}
}
else
@@ -1084,27 +1090,46 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip
{
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
+ switch (format)
{
- 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]);
+ 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;
- glTexImage2D(LLTexUnit::getInternalType(type), j, format, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ 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());
+ llassert(std::find(sDeadTextureList[type][format].begin(),
+ sDeadTextureList[type][format].end(), textures[i]) ==
+ sDeadTextureList[type][format].end());
- sDeadTextureList[type][format].push_back(textures[i]);
- }
+ sDeadTextureList[type][format].push_back(textures[i]);
+ }
+ }
+ }
+ break;
}
}