summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorMark Palange <palange@lindenlab.com>2008-12-23 19:39:58 +0000
committerMark Palange <palange@lindenlab.com>2008-12-23 19:39:58 +0000
commitfb793870fe95f1951d7c30ea6068e187b9dededd (patch)
tree6d11632353ff4fb07133625ec5031b135b1e2882 /indra/llrender
parentd182b9fb82b9c63f41d81bc80dbbfe627475facf (diff)
QAR-1142 merging 1.22 RC0-RC4 changes.
svn merge -c 106471 svn+ssh://svn.lindenlab.com/svn/linden/qa/viewer_1-22-106055_merge
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llgl.cpp35
-rw-r--r--indra/llrender/llgl.h2
-rw-r--r--indra/llrender/llimagegl.cpp4
-rw-r--r--indra/llrender/llrender.cpp26
-rw-r--r--indra/llrender/llrender.h11
5 files changed, 25 insertions, 53 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index fa763bf2f8..aced88f1a2 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -263,7 +263,6 @@ LLGLManager::LLGLManager() :
mHasMultitexture(FALSE),
mNumTextureUnits(1),
mHasMipMapGeneration(FALSE),
- mHasPalettedTextures(FALSE),
mHasCompressedTextures(FALSE),
mHasFramebufferObject(FALSE),
@@ -566,7 +565,6 @@ void LLGLManager::initExtensions()
mHasFramebufferObject = FALSE;
# endif
mHasMipMapGeneration = FALSE;
- mHasPalettedTextures = FALSE;
mHasSeparateSpecularColor = FALSE;
mHasAnisotropic = FALSE;
mHasCubeMap = FALSE;
@@ -578,7 +576,6 @@ void LLGLManager::initExtensions()
#else // LL_MESA_HEADLESS
mHasMultitexture = glh_init_extensions("GL_ARB_multitexture");
mHasMipMapGeneration = glh_init_extensions("GL_SGIS_generate_mipmap");
- mHasPalettedTextures = glh_init_extension("GL_EXT_paletted_texture");
mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color");
mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic");
glh_init_extensions("GL_ARB_texture_cube_map");
@@ -610,7 +607,6 @@ void LLGLManager::initExtensions()
mHasVertexBufferObject = FALSE;
mHasFramebufferObject = FALSE;
mHasMipMapGeneration = FALSE;
- mHasPalettedTextures = FALSE;
mHasSeparateSpecularColor = FALSE;
mHasAnisotropic = FALSE;
mHasCubeMap = FALSE;
@@ -628,7 +624,6 @@ void LLGLManager::initExtensions()
// bug reports. This should be the default until we get a
// proper blacklist/whitelist on Linux.
mHasMipMapGeneration = FALSE;
- mHasPalettedTextures = FALSE;
mHasAnisotropic = FALSE;
//mHasCubeMap = FALSE; // apparently fatal on Intel 915 & similar
//mHasOcclusionQuery = FALSE; // source of many ATI system hangs
@@ -648,7 +643,6 @@ void LLGLManager::initExtensions()
if (strchr(blacklist,'b')) mHasCompressedTextures = FALSE;
if (strchr(blacklist,'c')) mHasVertexBufferObject = FALSE;
if (strchr(blacklist,'d')) mHasMipMapGeneration = FALSE;//S
- if (strchr(blacklist,'e')) mHasPalettedTextures = FALSE;//S
// if (strchr(blacklist,'f')) mHasNVVertexArrayRange = FALSE;//S
// if (strchr(blacklist,'g')) mHasNVFence = FALSE;//S
if (strchr(blacklist,'h')) mHasSeparateSpecularColor = FALSE;
@@ -663,13 +657,6 @@ void LLGLManager::initExtensions()
if (strchr(blacklist,'q')) mHasFramebufferObject = FALSE;//S
}
#endif // LL_LINUX
-
-#if LL_DARWIN || LL_LINUX
- // MBW -- 12/4/2003 -- Using paletted textures causes a bunch of avatar rendering problems on the Mac.
- // Not sure if this is due to driver problems or incorrect use of the extension, but I'm disabling it for now.
- // Tofu - 2006-10-03 -- Same problem on Linux.
- mHasPalettedTextures = false;
-#endif
if (!mHasMultitexture)
{
@@ -683,10 +670,6 @@ void LLGLManager::initExtensions()
{
LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_texture_env_combine" << LL_ENDL;
}
- if (!mHasPalettedTextures)
- {
- LL_INFOS("RenderInit") << "Couldn't initialize GL_EXT_paletted_texture" << LL_ENDL;
- }
if (!mHasSeparateSpecularColor)
{
LL_INFOS("RenderInit") << "Couldn't initialize separate specular color" << LL_ENDL;
@@ -788,13 +771,7 @@ void LLGLManager::initExtensions()
mGLMaxIndexRange = 0;
}
#endif // !LL_LINUX
-#if LL_LINUX
- // On Linux we need to get glColorTableEXT dynamically.
- if (mHasPalettedTextures)
- {
- glColorTableEXT = (PFNGLCOLORTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableEXT");
- }
-#endif // LL_LINUX
+
if (mHasOcclusionQuery)
{
glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB");
@@ -1442,16 +1419,6 @@ void set_binormals(const S32 index, const U32 stride,const LLVector3 *binormals)
#endif
}
-
-void set_palette(U8 *palette_data)
-{
- if (gGLManager.mHasPalettedTextures)
- {
- glColorTableEXT(GL_TEXTURE_2D, GL_RGBA8, 256, GL_RGBA, GL_UNSIGNED_BYTE, palette_data);
- }
-}
-
-
void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific )
{
// GL_VERSION returns a null-terminated string with the format:
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index bab5e5245f..96a03e63ac 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -74,7 +74,6 @@ public:
BOOL mHasMultitexture;
S32 mNumTextureUnits;
BOOL mHasMipMapGeneration;
- BOOL mHasPalettedTextures;
BOOL mHasCompressedTextures;
BOOL mHasFramebufferObject;
@@ -370,7 +369,6 @@ void disable_cloth_weights(const S32 index);
void set_vertex_weights(const S32 index, const U32 stride, const F32 *weights);
void set_vertex_clothing_weights(const S32 index, const U32 stride, const LLVector4 *weights);
void set_binormals(const S32 index, const U32 stride, const LLVector3 *binormals);
-void set_palette(U8* palette_data);
void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor_specific );
extern BOOL gClothRipple;
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 2ef2bae1ab..9efadbd030 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -154,7 +154,7 @@ void LLImageGL::destroyGL(BOOL save_state)
LLImageGL* glimage = *iter;
if (glimage->mTexName && glimage->mComponents)
{
- if (save_state)
+ if (save_state && glimage->isInitialized())
{
glimage->mSaveData = new LLImageRaw;
glimage->readBackRaw(glimage->mCurrentDiscardLevel, glimage->mSaveData, false);
@@ -748,7 +748,7 @@ BOOL LLImageGL::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S3
// Copy sub image from frame buffer
BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height)
{
- if (gGL.getTexUnit(0)->bind(this))
+ if (gGL.getTexUnit(0)->bind(this, true))
{
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height);
mInitialized = true;
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 969bfe608e..76762a1967 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -175,7 +175,7 @@ void LLTexUnit::disable(void)
}
}
-bool LLTexUnit::bind(const LLImageGL* texture)
+bool LLTexUnit::bind(const LLImageGL* texture, bool forceBind)
{
if (mIndex < 0) return false;
@@ -183,25 +183,27 @@ bool LLTexUnit::bind(const LLImageGL* texture)
if (texture == NULL)
{
- return texture->bindError(mIndex);
+ llwarns << "NULL LLTexUnit::bind texture" << llendl;
+ return false;
}
- if (!texture->isInitialized())
+ if (!texture->isInitialized() && !forceBind)
{
return texture->bindDefaultImage(mIndex);
}
- // Disabled caching of binding state.
- if (texture != NULL)
+ if (!texture->getTexName()) //if texture does not exist
{
- activate();
- enable(texture->getTarget());
- mCurrTexture = texture->getTexName();
- glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture);
- texture->updateBindStats();
- return true;
+ return texture->bindDefaultImage(mIndex);
}
- return false;
+
+ // Disabled caching of binding state.
+ activate();
+ enable(texture->getTarget());
+ mCurrTexture = texture->getTexName();
+ glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture);
+ texture->updateBindStats();
+ return true;
}
bool LLTexUnit::bind(LLCubeMap* cubeMap)
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index e604bbb84c..a9eca70744 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -135,12 +135,17 @@ public:
// Disables the current texture unit
void disable(void);
- // Binds the LLImageGL to this texture unit (automatically enables the unit for the LLImageGL's texture type)
- bool bind(const LLImageGL* texture);
- // Binds a cubemap to this texture unit (automatically enables the texture unit for cubemaps)
+ // Binds the LLImageGL to this texture unit
+ // (automatically enables the unit for the LLImageGL's texture type)
+ bool bind(const LLImageGL* texture, bool forceBind = false);
+
+ // Binds a cubemap to this texture unit
+ // (automatically enables the texture unit for cubemaps)
bool bind(LLCubeMap* cubeMap);
+
// Binds a render target to this texture unit (automatically enables the texture unit for the RT's texture type)
bool bind(LLRenderTarget * renderTarget, bool bindDepth = false);
+
// Manually binds a texture to the texture unit (automatically enables the tex unit for the given texture type)
bool bindManual(eTextureType type, U32 texture);