Skip to content

Commit

Permalink
#3093 #3055 World Map tiles are blurry #2
Browse files Browse the repository at this point in the history
  • Loading branch information
akleshchev committed Nov 29, 2024
1 parent 2cdf67c commit f91715c
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 127 deletions.
46 changes: 42 additions & 4 deletions indra/newview/lltexturefetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2481,7 +2481,7 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L
LL_PROFILE_ZONE_SCOPED;
if (mDebugPause)
{
return -1;
return CREATE_REQUEST_ERROR_DEFAULT;
}

if (f_type == FTT_SERVER_BAKE)
Expand All @@ -2497,7 +2497,7 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L
<< host << " != " << worker->mHost << LL_ENDL;
removeRequest(worker, true);
worker = NULL;
return -1;
return CREATE_REQUEST_ERROR_MHOSTS;
}
}

Expand Down Expand Up @@ -2550,13 +2550,13 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L
{
if (worker->wasAborted())
{
return -1; // need to wait for previous aborted request to complete
return CREATE_REQUEST_ERROR_ABORTED; // need to wait for previous aborted request to complete
}
worker->lockWorkMutex(); // +Mw
if (worker->mState == LLTextureFetchWorker::DONE && worker->mDesiredSize == llmax(desired_size, TEXTURE_CACHE_ENTRY_SIZE) && worker->mDesiredDiscard == desired_discard) {
worker->unlockWorkMutex(); // -Mw

return -1; // similar request has failed or is in a transitional state
return CREATE_REQUEST_ERROR_TRANSITION; // similar request has finished, failed or is in a transitional state
}
worker->mActiveCount++;
worker->mNeedsAux = needs_aux;
Expand Down Expand Up @@ -3149,6 +3149,44 @@ S32 LLTextureFetch::getFetchState(const LLUUID& id, F32& data_progress_p, F32& r
return state;
}

// Threads: T*
S32 LLTextureFetch::getLastFetchState(const LLUUID& id, S32& requested_discard, S32& decoded_discard, bool& decoded)
{
LL_PROFILE_ZONE_SCOPED;
S32 state = LLTextureFetchWorker::INVALID;

LLTextureFetchWorker* worker = getWorker(id);
if (worker) // Don't check haveWork, intent is to get whatever is in the worker
{
worker->lockWorkMutex(); // +Mw
state = worker->mState;
requested_discard = worker->mDesiredDiscard;
decoded_discard = worker->mDecodedDiscard;
decoded = worker->mDecoded;
worker->unlockWorkMutex(); // -Mw
}
return state;
}

// Threads: T*
S32 LLTextureFetch::getLastRawImage(const LLUUID& id,
LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux)
{
LL_PROFILE_ZONE_SCOPED;
bool res = false;
S32 decoded_discard = -1;
LLTextureFetchWorker* worker = getWorker(id);
if (worker && !worker->haveWork() && worker->mDecodedDiscard >= 0)
{
worker->lockWorkMutex(); // +Mw
raw = worker->mRawImage;
aux = worker->mAuxImage;
decoded_discard = worker->mDecodedDiscard;
worker->unlockWorkMutex(); // -Mw
}
return decoded_discard;
}

void LLTextureFetch::dump()
{
LL_INFOS(LOG_TXT) << "LLTextureFetch ACTIVE_HTTP:" << LL_ENDL;
Expand Down
18 changes: 17 additions & 1 deletion indra/newview/lltexturefetch.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ class LLTextureFetch : public LLWorkerThread
// Threads: Tmain
void shutDownImageDecodeThread();

enum e_crete_request_errors
{
CREATE_REQUEST_ERROR_DEFAULT = -1,
CREATE_REQUEST_ERROR_MHOSTS = -2,
CREATE_REQUEST_ERROR_ABORTED = -3,
CREATE_REQUEST_ERROR_TRANSITION = -4,
};

// Threads: T* (but Tmain mostly)
S32 createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority,
S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool can_use_http);
Expand Down Expand Up @@ -114,12 +122,20 @@ class LLTextureFetch : public LLWorkerThread
// get the current fetch state, if any, from the given UUID
S32 getFetchState(const LLUUID& id);

// @return Fetch state of given image and associates statistics
// @return Fetch state of an active given image and associates statistics
// See also getStateString
// Threads: T*
S32 getFetchState(const LLUUID& id, F32& decode_progress_p, F32& requested_priority_p,
U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p, bool& can_use_http);

// @return Fetch last state of given image
// Threads: T*
S32 getLastFetchState(const LLUUID& id, S32& requested_discard, S32 &decoded_discard, bool &decoded);

// @return Fetch last raw image
// Threads: T*
S32 getLastRawImage(const LLUUID& id, LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux);

// Debug utility - generally not safe
void dump();

Expand Down
Loading

0 comments on commit f91715c

Please sign in to comment.