summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/lldrawpoolbump.cpp1
-rwxr-xr-xindra/newview/lldrawpoolterrain.cpp18
-rwxr-xr-xindra/newview/llnetmap.cpp5
-rwxr-xr-xindra/newview/llstartup.cpp2
-rwxr-xr-xindra/newview/llsurface.cpp12
-rwxr-xr-xindra/newview/lltexturecache.cpp2
-rwxr-xr-xindra/newview/llviewerparceloverlay.cpp20
-rwxr-xr-xindra/newview/llviewertexture.cpp15
-rwxr-xr-xindra/newview/llvoavatarself.cpp9
-rwxr-xr-xindra/newview/llvosky.cpp41
-rwxr-xr-xindra/newview/llworld.cpp22
-rwxr-xr-xindra/newview/pipeline.cpp8
12 files changed, 108 insertions, 47 deletions
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 6b4c5cfca1..49ac82e786 100755
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -1232,6 +1232,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
//if (iter->second->getWidth() != src->getWidth() ||
// iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
+ if (src->getData())
{
LLPointer<LLImageRaw> dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1);
U8* dst_data = dst_image->getData();
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index c3ec234223..d7ecacf2e6 100755
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -88,8 +88,11 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
//gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
- mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
-
+ if (mTexturep)
+ {
+ mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
+ }
+
//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
@@ -851,11 +854,18 @@ void LLDrawPoolTerrain::renderSimple()
// Pass 1/1
// Stage 0: Base terrain texture pass
- mTexturep->addTextureStats(1024.f*1024.f);
+ if (mTexturep)
+ {
+ mTexturep->addTextureStats(1024.f*1024.f);
+ }
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(0)->bind(mTexturep);
+
+ if (mTexturep)
+ {
+ gGL.getTexUnit(0)->bind(mTexturep);
+ }
LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
F32 tscale = 1.f/256.f;
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 08b5eaedbb..193e2ea678 100755
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -798,7 +798,10 @@ void LLNetMap::createObjectImage()
{
mObjectRawImagep = new LLImageRaw(img_size, img_size, 4);
U8* data = mObjectRawImagep->getData();
- memset( data, 0, img_size * img_size * 4 );
+ if (data)
+ {
+ memset( data, 0, img_size * img_size * 4 );
+ }
mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE);
}
setScale(mScale);
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index c86e8df4b6..6361c18c9f 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2684,7 +2684,7 @@ void init_start_screen(S32 location_id)
}
}
- if(gStartTexture.isNull())
+ if(gStartTexture && gStartTexture.isNull())
{
gStartTexture = LLViewerTexture::sBlackImagep ;
gStartImageWidth = gStartTexture->getWidth() ;
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp
index 93c7f54101..f1b27279e3 100755
--- a/indra/newview/llsurface.cpp
+++ b/indra/newview/llsurface.cpp
@@ -233,6 +233,12 @@ void LLSurface::createSTexture()
// GL NOT ACTIVE HERE
LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize, sTextureSize, 3);
U8 *default_texture = raw->getData();
+
+ if (!default_texture)
+ {
+ return;
+ }
+
for (S32 i = 0; i < sTextureSize; i++)
{
for (S32 j = 0; j < sTextureSize; j++)
@@ -257,6 +263,12 @@ void LLSurface::createWaterTexture()
// Create the water texture
LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize/2, sTextureSize/2, 4);
U8 *default_texture = raw->getData();
+
+ if (!default_texture)
+ {
+ return;
+ }
+
for (S32 i = 0; i < sTextureSize/2; i++)
{
for (S32 j = 0; j < sTextureSize/2; j++)
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 5bc2e971eb..8d9d2421da 100755
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1937,7 +1937,7 @@ bool LLTextureCache::writeToFastCache(S32 id, LLPointer<LLImageRaw> raw, S32 dis
memcpy(mFastCachePadBuffer + sizeof(S32) * 3, &discardlevel, sizeof(S32));
S32 copy_size = w * h * c;
- if(copy_size > 0) //valid
+ if(copy_size > 0 && raw->getData()) //valid
{
copy_size = llmin(copy_size, TEXTURE_FAST_CACHE_ENTRY_SIZE - TEXTURE_FAST_CACHE_ENTRY_OVERHEAD);
memcpy(mFastCachePadBuffer + TEXTURE_FAST_CACHE_ENTRY_OVERHEAD, raw->getData(), copy_size);
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index a1c12c5cd6..fad77bce25 100755
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -76,10 +76,13 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_
//
// Create the base texture.
U8 *raw = mImageRaw->getData();
- const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS;
- for (S32 i = 0; i < COUNT; i++)
+ if (raw)
{
- raw[i] = 0;
+ const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS;
+ for (S32 i = 0; i < COUNT; i++)
+ {
+ raw[i] = 0;
+ }
}
//mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge);
@@ -380,10 +383,13 @@ void LLViewerParcelOverlay::updateOverlayTexture()
break;
}
- raw[pixel_index + 0] = (U8)r;
- raw[pixel_index + 1] = (U8)g;
- raw[pixel_index + 2] = (U8)b;
- raw[pixel_index + 3] = (U8)a;
+ if (raw)
+ {
+ raw[pixel_index + 0] = (U8)r;
+ raw[pixel_index + 1] = (U8)g;
+ raw[pixel_index + 2] = (U8)b;
+ raw[pixel_index + 3] = (U8)a;
+ }
pixel_index += OVERLAY_IMG_COMPONENTS;
}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 3da6d33d72..6364eee3ec 100755
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -337,6 +337,11 @@ void LLViewerTextureManager::init()
const S32 dim = 128;
LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3);
U8* data = image_raw->getData();
+
+ if (!data)
+ {
+ return;
+ }
memset(data, 0, dim * dim * 3) ;
LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE) ;
@@ -373,8 +378,12 @@ void LLViewerTextureManager::init()
#else
LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
#endif
- LLViewerFetchedTexture::sDefaultImagep->dontDiscard();
- LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ;
+
+ if (LLViewerFetchedTexture::sDefaultImagep)
+ {
+ LLViewerFetchedTexture::sDefaultImagep->dontDiscard();
+ LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ;
+ }
LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
LLViewerFetchedTexture::sSmokeImagep->setNoDelete() ;
@@ -690,7 +699,7 @@ bool LLViewerTexture::bindDefaultImage(S32 stage)
if (stage < 0) return false;
bool res = true;
- if (LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get()))
+ if (LLViewerFetchedTexture::sDefaultImagep && LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get()))
{
// use default if we've got it
res = gGL.getTexUnit(stage)->bind(LLViewerFetchedTexture::sDefaultImagep);
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 082a85e217..ca004962d5 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -818,7 +818,8 @@ void LLVOAvatarSelf::setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index)
return;
}
- if (getTEImage(te)->getID() == image->getID())
+ LLViewerTexture * tx = getTEImage(te);
+ if (!tx || tx->getID() == image->getID())
{
return;
}
@@ -1698,6 +1699,7 @@ S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 wearable_index)
const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
if (type >= 0
&& local_tex_obj->getID() != IMG_DEFAULT_AVATAR
+ && image
&& !image->isMissingAsset())
{
return image->getDiscardLevel();
@@ -2036,7 +2038,10 @@ BOOL LLVOAvatarSelf::getIsCloud() const
/*static*/
void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
{
- gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
+ if (gAgentAvatarp)
+ {
+ gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
+ }
}
void LLVOAvatarSelf::debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 93f0e50336..467152881e 100755
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -257,18 +257,21 @@ LLSkyTex::~LLSkyTex()
void LLSkyTex::initEmpty(const S32 tex)
{
U8* data = mImageRaw[tex]->getData();
- for (S32 i = 0; i < sResolution; ++i)
+ if (data)
{
- for (S32 j = 0; j < sResolution; ++j)
+ for (S32 i = 0; i < sResolution; ++i)
{
- const S32 basic_offset = (i * sResolution + j);
- S32 offset = basic_offset * sComponents;
- data[offset] = 0;
- data[offset+1] = 0;
- data[offset+2] = 0;
- data[offset+3] = 255;
-
- mSkyData[basic_offset].setToBlack();
+ for (S32 j = 0; j < sResolution; ++j)
+ {
+ const S32 basic_offset = (i * sResolution + j);
+ S32 offset = basic_offset * sComponents;
+ data[offset] = 0;
+ data[offset+1] = 0;
+ data[offset+2] = 0;
+ data[offset+3] = 255;
+
+ mSkyData[basic_offset].setToBlack();
+ }
}
}
@@ -279,17 +282,21 @@ void LLSkyTex::create(const F32 brightness)
{
/// Brightness ignored for now.
U8* data = mImageRaw[sCurrent]->getData();
- for (S32 i = 0; i < sResolution; ++i)
+ if (data)
{
- for (S32 j = 0; j < sResolution; ++j)
+ for (S32 i = 0; i < sResolution; ++i)
{
- const S32 basic_offset = (i * sResolution + j);
- S32 offset = basic_offset * sComponents;
- U32* pix = (U32*)(data + offset);
- LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
- *pix = temp.mAll;
+ for (S32 j = 0; j < sResolution; ++j)
+ {
+ const S32 basic_offset = (i * sResolution + j);
+ S32 offset = basic_offset * sComponents;
+ U32* pix = (U32*)(data + offset);
+ LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
+ *pix = temp.mAll;
+ }
}
}
+
createGLImage(sCurrent);
}
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 85614f397c..27256af97a 100755
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -101,15 +101,21 @@ LLWorld::LLWorld() :
LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,4);
U8 *default_texture = raw->getData();
- *(default_texture++) = MAX_WATER_COLOR.mV[0];
- *(default_texture++) = MAX_WATER_COLOR.mV[1];
- *(default_texture++) = MAX_WATER_COLOR.mV[2];
- *(default_texture++) = MAX_WATER_COLOR.mV[3];
-
- mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
- gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
- mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
+ if (default_texture)
+ {
+ *(default_texture++) = MAX_WATER_COLOR.mV[0];
+ *(default_texture++) = MAX_WATER_COLOR.mV[1];
+ *(default_texture++) = MAX_WATER_COLOR.mV[2];
+ *(default_texture++) = MAX_WATER_COLOR.mV[3];
+ }
+
+ if (mDefaultWaterTexturep)
+ {
+ mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
+ gGL.getTexUnit(0)->bind(mDefaultWaterTexturep);
+ mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
+ }
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 5da8a78b1b..0af1143ae8 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4410,9 +4410,11 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
sUnderWaterRender = FALSE;
}
- gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep);
- LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP);
-
+ if (LLViewerFetchedTexture::sDefaultImagep)
+ {
+ gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep);
+ LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP);
+ }
//////////////////////////////////////////////
//