diff options
author | maksymsproductengine <maksymsproductengine@lindenlab.com> | 2014-03-20 19:21:52 +0200 |
---|---|---|
committer | maksymsproductengine <maksymsproductengine@lindenlab.com> | 2014-03-20 19:21:52 +0200 |
commit | 6f33f9090b554a32f039e46d8177650ccbf94536 (patch) | |
tree | 3d518c0a2ec73a88c5cd0c99d900e98c035b8756 /indra | |
parent | 2f606a36f63979af73bad76d883646b2d3f8a727 (diff) |
MAINT-3827 FIXED crash in KDU texture decoding, likely out of memory
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llappearance/lltexlayer.cpp | 5 | ||||
-rw-r--r-- | indra/llappearance/llwearable.cpp | 11 | ||||
-rwxr-xr-x | indra/llimage/llimage.cpp | 30 | ||||
-rwxr-xr-x | indra/llimage/llimagepng.cpp | 7 | ||||
-rwxr-xr-x | indra/llimage/llimageworker.cpp | 16 | ||||
-rwxr-xr-x | indra/llrender/llcubemap.cpp | 5 | ||||
-rwxr-xr-x | indra/llrender/llfontfreetype.cpp | 15 | ||||
-rwxr-xr-x | indra/llrender/llimagegl.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/lldrawpoolbump.cpp | 1 | ||||
-rwxr-xr-x | indra/newview/lldrawpoolterrain.cpp | 18 | ||||
-rwxr-xr-x | indra/newview/llnetmap.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llstartup.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llsurface.cpp | 12 | ||||
-rwxr-xr-x | indra/newview/lltexturecache.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llviewerparceloverlay.cpp | 20 | ||||
-rwxr-xr-x | indra/newview/llviewertexture.cpp | 15 | ||||
-rwxr-xr-x | indra/newview/llvoavatarself.cpp | 9 | ||||
-rwxr-xr-x | indra/newview/llvosky.cpp | 41 | ||||
-rwxr-xr-x | indra/newview/llworld.cpp | 22 | ||||
-rwxr-xr-x | indra/newview/pipeline.cpp | 8 |
20 files changed, 188 insertions, 61 deletions
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 63d01999f0..4cf82a3740 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -1973,7 +1973,10 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, } else { - llassert(gTextureManagerBridgep); + if (!gTextureManagerBridgep) + { + return LLPointer<LLGLTexture>(); + } tex = gTextureManagerBridgep->getLocalTexture( FALSE ); LLPointer<LLImageRaw> image_raw = new LLImageRaw; if( loadImageRaw( file_name, image_raw ) ) diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index d86a460511..61cd995cea 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -420,6 +420,12 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, return LLWearable::FAILURE; } LLUUID id = LLUUID(uuid_buffer); + + if (!gTextureManagerBridgep) + { + continue; + } + LLGLTexture* image = gTextureManagerBridgep->getFetchedTexture( id ); if( mTEMap.find(te) != mTEMap.end() ) { @@ -592,7 +598,10 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst) { // there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map. image_id = getDefaultTextureImageID((ETextureIndex) te); - image = gTextureManagerBridgep->getFetchedTexture( image_id ); + if (gTextureManagerBridgep) + { + image = gTextureManagerBridgep->getFetchedTexture( image_id ); + } } if( dst.find(te) != dst.end() ) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index c8a05e1fae..55609deb2b 100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -230,7 +230,7 @@ const U8* LLImageBase::getData() const { if(mBadBufferAllocation) { - llerrs << "Bad memory allocation for the image buffer!" << llendl ; + llwarns << "Bad memory allocation for the image buffer!" << llendl ; } return mData; @@ -240,7 +240,7 @@ U8* LLImageBase::getData() { if(mBadBufferAllocation) { - llerrs << "Bad memory allocation for the image buffer!" << llendl ; + llwarns << "Bad memory allocation for the image buffer!" << llendl ; } return mData; @@ -293,7 +293,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_c { setDataAndSize(data, width, height, components); } - else if(allocateDataSize(width, height, components)) + else if(allocateDataSize(width, height, components) && getData()) { memcpy(getData(), data, width*height*components); } @@ -431,6 +431,11 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) // Reverses the order of the rows in the image void LLImageRaw::verticalFlip() { + if (!getData()) + { + return; + } + S32 row_bytes = getWidth() * getComponents(); llassert(row_bytes > 0); std::vector<U8> line_buffer(row_bytes); @@ -666,6 +671,11 @@ void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill) // Fill the buffer with a constant color void LLImageRaw::fill( const LLColor4U& color ) { + if (!getData()) + { + return; + } + S32 pixels = getWidth() * getHeight(); if( 4 == getComponents() ) { @@ -867,6 +877,11 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) { + if (!getData()) + { + return FALSE; + } + llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) ); S32 old_width = getWidth(); @@ -901,7 +916,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) copyLineScaled( &temp_buffer[0] + (getComponents() * old_width * row), new_buffer + (getComponents() * new_width * row), old_width, new_width, 1, 1 ); } } - else + else if (getData()) { // copy out existing image data S32 temp_data_size = old_width * old_height * getComponents(); @@ -1478,7 +1493,7 @@ void LLImageFormatted::sanityCheck() BOOL LLImageFormatted::copyData(U8 *data, S32 size) { - if ( data && ((data != getData()) || (size != getDataSize())) ) + if ( data && getData() && ((data != getData()) || (size != getDataSize())) ) { deleteData(); allocateData(size); @@ -1564,6 +1579,11 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) BOOL LLImageFormatted::save(const std::string &filename) { + if (!getData()) + { + return FALSE; + } + resetLastError(); LLAPRFile outfile ; diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index 294f68b122..525aa8d78c 100755 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -94,6 +94,13 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) return FALSE; } + // Check to make sure that this instance has been initialized with data + if (!raw_image->getData()) + { + setLastError("LLImagePNG trying to decode an image into unallocated LLImageRaw!"); + return FALSE; + } + // Decode the PNG data into the raw image LLPngWrapper pngWrapper; if (!pngWrapper.isValidPng(getData())) diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index ad2eb0f69c..148cf4fa55 100755 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -142,8 +142,12 @@ bool LLImageDecodeThread::ImageRequest::processRequest() mFormattedImage->getHeight(), mFormattedImage->getComponents()); } - done = mFormattedImage->decode(mDecodedImageRaw, decode_time_slice); // 1ms - mDecodedRaw = done; + + if (mDecodedImageRaw->getData()) + { + done = mFormattedImage->decode(mDecodedImageRaw, decode_time_slice); // 1ms + mDecodedRaw = done; + } } if (done && mNeedsAux && !mDecodedAux && mFormattedImage.notNull()) { @@ -154,8 +158,12 @@ bool LLImageDecodeThread::ImageRequest::processRequest() mFormattedImage->getHeight(), 1); } - done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms - mDecodedAux = done; + + if (mDecodedImageAux->getData()) + { + done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms + mDecodedAux = done; + } } return done; diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 45a3b18179..0dad4285d9 100755 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -116,6 +116,11 @@ void LLCubeMap::initRawData(const std::vector<LLPointer<LLImageRaw> >& rawimages const U8 *sd = rawimages[i]->getData(); U8 *td = mRawImages[i]->getData(); + if (!sd || !td) + { + continue; + } + S32 offset = 0; S32 sx, sy, so; for (int y = 0; y < 64; y++) diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 84c782e958..7ab4e93da5 100755 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -448,7 +448,11 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_num); LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num); - image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight()); + + if (image_gl) + { + image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight()); + } return gi; } @@ -560,13 +564,18 @@ void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32 { LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num); + if (!image_raw) + { + return; + } + llassert(!mIsFallback); - llassert(image_raw && (image_raw->getComponents() == 2)); + llassert(image_raw->getComponents() == 2); U8 *target = image_raw->getData(); - if (!data) + if (!data || !target) { return; } diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index ab875141c5..315cc57e51 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1251,6 +1251,11 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S return FALSE; } + if (!imageraw->getData()) + { + return FALSE; + } + mGLTextureCreated = false ; llassert(gGLManager.mInited); stop_glerror(); 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); + } ////////////////////////////////////////////// // |