From 3e80fa3dbc943de9b784fedc202ba38cf238f46d Mon Sep 17 00:00:00 2001 From: David Parks Date: Mon, 2 Nov 2009 19:55:37 +0000 Subject: Sync up with render-pipeline-7 ignore-dead-branch --- indra/newview/llviewertexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a0ab4cb1e6..32baa29afb 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -583,7 +583,7 @@ BOOL LLViewerTexture::createGLTexture(S32 discard_level, const LLImageRaw* image llassert_always(mGLTexturep.notNull()) ; BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename) ; - + if(ret) { mFullWidth = mGLTexturep->getCurrentWidth() ; -- cgit v1.2.3 From edb67a898c4d20a1d4f18ad0db9ad02d6157b2ed Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 16 Dec 2009 11:20:44 -0600 Subject: Convert ll_face_list_t in llviewertexture to a std::set to improve performance on face deletion. --- indra/newview/llviewertexture.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index faf7a93281..c9558860db 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -614,13 +614,13 @@ void LLViewerTexture::setKnownDrawSize(S32 width, S32 height) //virtual void LLViewerTexture::addFace(LLFace* facep) { - mFaceList.push_back(facep) ; + mFaceList.insert(facep) ; } //virtual void LLViewerTexture::removeFace(LLFace* facep) { - mFaceList.remove(facep) ; + mFaceList.erase(facep); } //virtual @@ -1519,7 +1519,7 @@ void LLViewerFetchedTexture::updateVirtualSize() } if(mFaceList.size() > 0) { - for(std::list::iterator iter = mFaceList.begin(); iter != mFaceList.end(); ++iter) + for(ll_face_list_t::iterator iter = mFaceList.begin(); iter != mFaceList.end(); ++iter) { LLFace* facep = *iter ; if(facep->getDrawable()->isRecentlyVisible()) @@ -2391,7 +2391,7 @@ BOOL LLViewerFetchedTexture::insertToAtlas() LLFace* facep; //if the atlas slot pointers for some faces are null, process them later. - ll_face_list_t waiting_list ; + std::vector waiting_list ; for(ll_face_list_t::iterator iter = mFaceList.begin(); iter != mFaceList.end(); ++iter) { @@ -2475,7 +2475,7 @@ BOOL LLViewerFetchedTexture::insertToAtlas() } //process the waiting_list - for(ll_face_list_t::iterator iter = waiting_list.begin(); iter != waiting_list.end(); ++iter) + for(std::vector::iterator iter = waiting_list.begin(); iter != waiting_list.end(); ++iter) { facep = (LLFace*)*iter ; groupp = facep->getDrawable()->getSpatialGroup() ; @@ -3153,7 +3153,7 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() { if(mFaceList.size() > 0) { - for(std::list::iterator iter = mFaceList.begin(); iter != mFaceList.end(); ++iter) + for(ll_face_list_t::iterator iter = mFaceList.begin(); iter != mFaceList.end(); ++iter) { LLFace* facep = *iter ; if(facep->getDrawable()->isRecentlyVisible()) -- cgit v1.2.3 From 5f9591535138d782f0f9666b39534149de0562a1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 2 Mar 2010 17:06:08 -0600 Subject: Can upload textures from model preview now. Fix for bad region crossing. --- indra/newview/llviewertexture.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 0f0fd5da30..d0c3768b34 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1367,8 +1367,15 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) mOrigWidth = mRawImage->getWidth(); mOrigHeight = mRawImage->getHeight(); - // leave black border, do not scale image content - mRawImage->expandToPowerOfTwo(MAX_IMAGE_SIZE, FALSE); + + if (mBoostLevel == BOOST_PREVIEW) + { + mRawImage->biasedScaleToPowerOfTwo(1024); + } + else + { // leave black border, do not scale image content + mRawImage->expandToPowerOfTwo(MAX_IMAGE_SIZE, FALSE); + } mFullWidth = mRawImage->getWidth(); mFullHeight = mRawImage->getHeight(); -- cgit v1.2.3 From c96caed698afb38c50db229fff35fa8b91e40f83 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Jul 2010 14:44:17 -0700 Subject: Merge from dessie/viewer-release --- indra/newview/llviewertexture.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index e38608bcfc..9d4f6fdd0c 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2131,7 +2131,7 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { if(!callback_list) - { +{ mPauseLoadedCallBacks = FALSE ; return ; } @@ -2160,7 +2160,7 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry: void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { if(!callback_list) - { +{ return ; } -- cgit v1.2.3 From 32dfebb348ddb39ffd7900b96d200d471bf9655d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 12 Aug 2010 21:52:22 -0600 Subject: Fix for EXT-8578: Blurry image in profile never resolves - texture queue problem? --- indra/newview/llviewertexture.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9d4f6fdd0c..9b3243a1bc 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -814,7 +814,7 @@ void LLViewerTexture::generateGLTexture() LLImageGL* LLViewerTexture::getGLTexture() const { llassert(mGLTexturep.notNull()) ; - + return mGLTexturep ; } @@ -1489,8 +1489,13 @@ void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height) //virtual void LLViewerFetchedTexture::processTextureStats() { - if(mFullyLoaded) + if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) //force to refetch the texture. { + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel) ; + } + + if(mFullyLoaded) + { if(mDesiredDiscardLevel <= mMinDesiredDiscardLevel)//already loaded { return ; @@ -2131,7 +2136,7 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { if(!callback_list) -{ + { mPauseLoadedCallBacks = FALSE ; return ; } @@ -2160,7 +2165,7 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry: void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { if(!callback_list) -{ + { return ; } -- cgit v1.2.3 From 247ca1660bf4029d4e5bb701654433f14c785ab5 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 18 Aug 2010 11:33:01 -0600 Subject: EXT-8673: FIXED: UDP texture loading is slower in 2.x viewers than 1.23.5 Improved the following: 1, make sure the texture callback queue is properly handled and cleaned in time; 2, estimate the LLVOTree pixel area more accurately; 3, eliminate the possibility of back and forth stopping/restarting a texture fetching --- indra/newview/llviewertexture.cpp | 136 ++++++++++++++++++++++++++------------ 1 file changed, 93 insertions(+), 43 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9b3243a1bc..7a0f77a7e4 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1489,59 +1489,63 @@ void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height) //virtual void LLViewerFetchedTexture::processTextureStats() { - if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) //force to refetch the texture. - { - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel) ; - } - if(mFullyLoaded) { - if(mDesiredDiscardLevel <= mMinDesiredDiscardLevel)//already loaded + if(mDesiredDiscardLevel > mMinDesiredDiscardLevel)//need to load more { - return ; + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ; + mFullyLoaded = FALSE ; } - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ; - mFullyLoaded = FALSE ; - return ; - } - - updateVirtualSize() ; - - static LLCachedControl textures_fullres(gSavedSettings,"TextureLoadFullRes"); - - if (textures_fullres) - { - mDesiredDiscardLevel = 0; - } - else if(!mFullWidth || !mFullHeight) - { - mDesiredDiscardLevel = getMaxDiscardLevel() ; } else - { - if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight) + { + updateVirtualSize() ; + + static LLCachedControl textures_fullres(gSavedSettings,"TextureLoadFullRes"); + + if (textures_fullres) { - if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT) + mDesiredDiscardLevel = 0; + } + else if(!mFullWidth || !mFullHeight) + { + mDesiredDiscardLevel = getMaxDiscardLevel() ; + } + else + { + if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight) { - mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048 + if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT) + { + mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048 + } + else + { + mDesiredDiscardLevel = 0; + } } - else + else if(mKnownDrawSizeChanged)//known draw size is set + { + mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2, + log((F32)mFullHeight / mKnownDrawHeight) / log_2) ; + mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()) ; + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ; + } + mKnownDrawSizeChanged = FALSE ; + + if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel)) { - mDesiredDiscardLevel = 0; + mFullyLoaded = TRUE ; } } - else if(mKnownDrawSizeChanged)//known draw size is set - { - mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2, - log((F32)mFullHeight / mKnownDrawHeight) / log_2) ; - mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()) ; - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ; - } - mKnownDrawSizeChanged = FALSE ; - - if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel)) + } + + if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) //force to refetch the texture. + { + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel) ; + if(getDiscardLevel() < 0 || getDiscardLevel() > mDesiredDiscardLevel) { - mFullyLoaded = TRUE ; + mFullyLoaded = FALSE ; } } } @@ -1724,6 +1728,11 @@ void LLViewerFetchedTexture::setDecodePriority(F32 priority) llassert(!mInImageList); mDecodePriority = priority; + + if(mDecodePriority < F_ALMOST_ZERO) + { + mStopFetchingTimer.reset() ; + } } void LLViewerFetchedTexture::setAdditionalDecodePriority(F32 priority) @@ -1915,7 +1924,12 @@ bool LLViewerFetchedTexture::updateFetch() // llinfos << "Calling updateRequestPriority() with decode_priority = 0.0f" << llendl; // calcDecodePriority(); // } - LLAppViewer::getTextureFetch()->updateRequestPriority(mID, decode_priority); + static const F32 MAX_HOLD_TIME = 5.0f ; //seconds to wait before canceling fecthing if decode_priority is 0.f. + if(decode_priority > 0.0f || mStopFetchingTimer.getElapsedTimeF32() > MAX_HOLD_TIME) + { + mStopFetchingTimer.reset() ; + LLAppViewer::getTextureFetch()->updateRequestPriority(mID, decode_priority); + } } } @@ -2075,6 +2089,36 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call } } +void LLViewerFetchedTexture::clearCallbackEntryList() +{ + if(mLoadedCallbackList.empty()) + { + return ; + } + + for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); + iter != mLoadedCallbackList.end(); ) + { + LLLoadedCallbackEntry *entryp = *iter; + + // We never finished loading the image. Indicate failure. + // Note: this allows mLoadedCallbackUserData to be cleaned up. + entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData); + iter = mLoadedCallbackList.erase(iter) ; + delete entryp; + } + gTextureList.mCallbackList.erase(this); + + mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1; + mLoadedCallbackDesiredDiscardLevel = S8_MAX ; + if(mForceToSaveRawImage) + { + destroySavedRawImage() ; + } + + return ; +} + void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { if(mLoadedCallbackList.empty() || !callback_list) @@ -2082,7 +2126,7 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so return ; } - S32 desired_discard = INVALID_DISCARD_LEVEL ; + S32 desired_discard = S8_MAX ; S32 desired_raw_discard = INVALID_DISCARD_LEVEL ; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) @@ -2652,6 +2696,12 @@ void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, bool from_ } void LLViewerFetchedTexture::destroySavedRawImage() { + clearCallbackEntryList() ; + //if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0 && mDesiredSavedRawDiscardLevel < getDiscardLevel()) + //{ + // return ; //can not destroy the saved raw image before it is fully fetched, otherwise causing callbacks hanging there. + //} + mSavedRawImage = NULL ; mForceToSaveRawImage = FALSE ; mSavedRawDiscardLevel = -1 ; @@ -2902,7 +2952,7 @@ BOOL LLViewerLODTexture::isUpdateFrozen() void LLViewerLODTexture::processTextureStats() { updateVirtualSize() ; - + static LLCachedControl textures_fullres(gSavedSettings,"TextureLoadFullRes"); if (textures_fullres) -- cgit v1.2.3 From 2fea1d5d33ec1b41a3cfa4307a1bfa58d8014f88 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 19 Aug 2010 12:25:15 -0500 Subject: Integrate SIMD API from oreh/server-trunk-oreh --- indra/newview/llviewertexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 719c5b0da5..d50efe89dd 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1580,7 +1580,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() S32 cur_discard = getCurrentDiscardLevelForFetching(); bool have_all_data = (cur_discard >= 0 && (cur_discard <= mDesiredDiscardLevel)); - F32 pixel_priority = fsqrtf(mMaxVirtualSize); + F32 pixel_priority = (F32) sqrt(mMaxVirtualSize); F32 priority = 0.f; -- cgit v1.2.3 From 90e3d83a5cb35e98a02a3017dd79ebc272bbfe85 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 21 Sep 2010 13:26:52 -0400 Subject: Fix for build failures - disabling tcmalloc for now --- indra/newview/llviewertexture.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 indra/newview/llviewertexture.cpp (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp old mode 100644 new mode 100755 -- cgit v1.2.3 From a5619d16f74863168f45b04b37cc6383e1a92263 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 13 Oct 2010 07:24:37 -0400 Subject: correct licenses (fix problem with license change merge) --- indra/newview/llviewertexture.cpp | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 093c37cdb0..ef0bcbb38f 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2,31 +2,25 @@ * @file llviewertexture.cpp * @brief Object which handles a received image (and associated texture(s)) * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -- cgit v1.2.3 From fbab245e487650d6420c9fe33cf07123af12f422 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 13 Dec 2010 15:28:15 -0500 Subject: SH-646 FIX --- indra/newview/llviewertexture.cpp | 3 +++ 1 file changed, 3 insertions(+) mode change 100644 => 100755 indra/newview/llviewertexture.cpp (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp old mode 100644 new mode 100755 index 91c99c15a5..a2a0c8f371 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2720,6 +2720,9 @@ void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, bool from_ } void LLViewerFetchedTexture::destroySavedRawImage() { + mForceToSaveRawImage = FALSE ; + mSaveRawImage = FALSE ; + clearCallbackEntryList() ; mSavedRawImage = NULL ; -- cgit v1.2.3 From 774405e92bec6bdfa9e2be28e04b4b47fd71615e Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 18 Feb 2011 23:16:38 +0000 Subject: Cleanup of headless client (was: DisableRendering mode) * Now called 'HeadlessClient' instead of 'DisableRendering' * Removed most cases where we skipped certain behaviors in the client when in this mode. This gets us closer to a 'true' client, for testing purposes. --- indra/newview/llviewertexture.cpp | 100 +++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 51 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index cd16b15e3e..16e73da79b 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1415,61 +1415,59 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) // mRawImage->getWidth(), mRawImage->getHeight(),mRawImage->getDataSize()) // << mID.getString() << llendl; BOOL res = TRUE; - if (!gNoRender) - { - // store original size only for locally-sourced images - if (mUrl.compare(0, 7, "file://") == 0) - { - mOrigWidth = mRawImage->getWidth(); - mOrigHeight = mRawImage->getHeight(); - // leave black border, do not scale image content - mRawImage->expandToPowerOfTwo(MAX_IMAGE_SIZE, FALSE); - - mFullWidth = mRawImage->getWidth(); - mFullHeight = mRawImage->getHeight(); - setTexelsPerImage(); - } - else - { - mOrigWidth = mFullWidth; - mOrigHeight = mFullHeight; - } + // store original size only for locally-sourced images + if (mUrl.compare(0, 7, "file://") == 0) + { + mOrigWidth = mRawImage->getWidth(); + mOrigHeight = mRawImage->getHeight(); - bool size_okay = true; + // leave black border, do not scale image content + mRawImage->expandToPowerOfTwo(MAX_IMAGE_SIZE, FALSE); - U32 raw_width = mRawImage->getWidth() << mRawDiscardLevel; - U32 raw_height = mRawImage->getHeight() << mRawDiscardLevel; - if( raw_width > MAX_IMAGE_SIZE || raw_height > MAX_IMAGE_SIZE ) - { - llinfos << "Width or height is greater than " << MAX_IMAGE_SIZE << ": (" << raw_width << "," << raw_height << ")" << llendl; - size_okay = false; - } - - if (!LLImageGL::checkSize(mRawImage->getWidth(), mRawImage->getHeight())) - { - // A non power-of-two image was uploaded (through a non standard client) - llinfos << "Non power of two width or height: (" << mRawImage->getWidth() << "," << mRawImage->getHeight() << ")" << llendl; - size_okay = false; - } - - if( !size_okay ) - { - // An inappropriately-sized image was uploaded (through a non standard client) - // We treat these images as missing assets which causes them to - // be renderd as 'missing image' and to stop requesting data - setIsMissingAsset(); - destroyRawImage(); - return FALSE; - } - - if(!(res = insertToAtlas())) - { - res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel); - resetFaceAtlas() ; - } - setActive() ; + mFullWidth = mRawImage->getWidth(); + mFullHeight = mRawImage->getHeight(); + setTexelsPerImage(); + } + else + { + mOrigWidth = mFullWidth; + mOrigHeight = mFullHeight; + } + + bool size_okay = true; + + U32 raw_width = mRawImage->getWidth() << mRawDiscardLevel; + U32 raw_height = mRawImage->getHeight() << mRawDiscardLevel; + if( raw_width > MAX_IMAGE_SIZE || raw_height > MAX_IMAGE_SIZE ) + { + llinfos << "Width or height is greater than " << MAX_IMAGE_SIZE << ": (" << raw_width << "," << raw_height << ")" << llendl; + size_okay = false; + } + + if (!LLImageGL::checkSize(mRawImage->getWidth(), mRawImage->getHeight())) + { + // A non power-of-two image was uploaded (through a non standard client) + llinfos << "Non power of two width or height: (" << mRawImage->getWidth() << "," << mRawImage->getHeight() << ")" << llendl; + size_okay = false; + } + + if( !size_okay ) + { + // An inappropriately-sized image was uploaded (through a non standard client) + // We treat these images as missing assets which causes them to + // be renderd as 'missing image' and to stop requesting data + setIsMissingAsset(); + destroyRawImage(); + return FALSE; + } + + if(!(res = insertToAtlas())) + { + res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel); + resetFaceAtlas() ; } + setActive() ; if (!mForceToSaveRawImage) { -- cgit v1.2.3 From 913f927fc8e7b10588bcda7356ec33798ad82452 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 8 Mar 2011 11:52:28 -0700 Subject: fix for STORM-1049: [crashhunters] crash at LLViewerFetchedTexture::forceToSaveRawImage(int,bool) --- indra/newview/llviewertexture.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index cd16b15e3e..cf7f3f80ad 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2691,12 +2691,10 @@ void LLViewerFetchedTexture::saveRawImage() mLastReferencedSavedRawImageTime = sCurrentTime ; } -void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, bool from_callback) +void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard) { if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard) { - llassert_always(from_callback || mBoostLevel == LLViewerTexture::BOOST_PREVIEW) ; - mForceToSaveRawImage = TRUE ; mDesiredSavedRawDiscardLevel = desired_discard ; -- cgit v1.2.3 From ab483c6e7c3cbee72dc9cf85c48e5ee48cc57e2c Mon Sep 17 00:00:00 2001 From: Thickbrick Sleaford Date: Sat, 9 Apr 2011 17:10:09 -0400 Subject: STORM-1147: fix skin-tight clothing --- indra/newview/llviewertexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index cc635f71f9..f5fb074992 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1469,7 +1469,7 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) } setActive() ; - if (!mForceToSaveRawImage) + if (!needsToSaveRawImage()) { mNeedsAux = FALSE; destroyRawImage(); -- cgit v1.2.3 From 0bb7bcc96cfea7b5d56f083d0afcbc1fce7e9f21 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 15 Jun 2011 16:20:33 -0600 Subject: fix for SH-1788: Assert in texture load when uploading textured mesh model and beyond: fixed the thread-safe and highest texture resolution flaws in the mesh texture uploading flow. --- indra/newview/llviewertexture.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index af06421bf9..4da0f80a00 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1168,6 +1168,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mSavedRawDiscardLevel = -1 ; mDesiredSavedRawDiscardLevel = -1 ; mLastReferencedSavedRawImageTime = 0.0f ; + mKeptSavedRawImageTime = 0.f ; mLastCallBackActiveTime = 0.f; } @@ -2696,8 +2697,16 @@ void LLViewerFetchedTexture::saveRawImage() mLastReferencedSavedRawImageTime = sCurrentTime ; } -void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard) +void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, F32 kept_time) { + mKeptSavedRawImageTime = kept_time ; + mLastReferencedSavedRawImageTime = sCurrentTime ; + + if(mSavedRawDiscardLevel > -1 && mSavedRawDiscardLevel <= desired_discard) + { + return ; //raw imge is ready. + } + if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard) { mForceToSaveRawImage = TRUE ; @@ -2713,11 +2722,16 @@ void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard) mRawImage = NULL ; mRawDiscardLevel = INVALID_DISCARD_LEVEL ; - } + } } } void LLViewerFetchedTexture::destroySavedRawImage() { + if(mLastReferencedSavedRawImageTime < mKeptSavedRawImageTime) + { + return ; //keep the saved raw image. + } + mForceToSaveRawImage = FALSE ; mSaveRawImage = FALSE ; @@ -2729,6 +2743,7 @@ void LLViewerFetchedTexture::destroySavedRawImage() mSavedRawDiscardLevel = -1 ; mDesiredSavedRawDiscardLevel = -1 ; mLastReferencedSavedRawImageTime = 0.0f ; + mKeptSavedRawImageTime = 0.f ; } LLImageRaw* LLViewerFetchedTexture::getSavedRawImage() -- cgit v1.2.3