summaryrefslogtreecommitdiff
path: root/indra/llimage/llimageworker.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-04-12 00:12:30 +0300
committerGitHub <noreply@github.com>2024-04-12 00:12:30 +0300
commitdfbbad813f3a1b9a151db7b25d3657590324ca4c (patch)
treee31cee85f651a874c4b6edc7491efa0cb2ec93d5 /indra/llimage/llimageworker.cpp
parent17e1f3692c5c1e9cbc6ba6895b312a8baae9aec2 (diff)
parentd0102af56d3b1d5b1d9bf3c8eb9aeea77028b70e (diff)
Merge pull request #1204 from Ansariel/DRTVWR-600-maint-A
Merge main into maint-A
Diffstat (limited to 'indra/llimage/llimageworker.cpp')
-rw-r--r--indra/llimage/llimageworker.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp
index dc99b34c57..f97d991ca6 100644
--- a/indra/llimage/llimageworker.cpp
+++ b/indra/llimage/llimageworker.cpp
@@ -35,8 +35,10 @@ class ImageRequest
{
public:
ImageRequest(const LLPointer<LLImageFormatted>& image,
- S32 discard, bool needs_aux,
- const LLPointer<LLImageDecodeThread::Responder>& responder);
+ S32 discard,
+ bool needs_aux,
+ const LLPointer<LLImageDecodeThread::Responder>& responder,
+ U32 request_id);
virtual ~ImageRequest();
/*virtual*/ bool processRequest();
@@ -48,6 +50,7 @@ private:
// input
LLPointer<LLImageFormatted> mFormattedImage;
S32 mDiscardLevel;
+ U32 mRequestId;
bool mNeedsAux;
// output
LLPointer<LLImageRaw> mDecodedImageRaw;
@@ -62,6 +65,7 @@ private:
// MAIN THREAD
LLImageDecodeThread::LLImageDecodeThread(bool /*threaded*/)
+ : mDecodeCount(0)
{
mThreadPool.reset(new LL::ThreadPool("ImageDecode", 8));
mThreadPool->start();
@@ -92,9 +96,10 @@ LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
+ U32 decode_id = ++mDecodeCount;
// Instantiate the ImageRequest right in the lambda, why not?
bool posted = mThreadPool->getQueue().post(
- [req = ImageRequest(image, discard, needs_aux, responder)]
+ [req = ImageRequest(image, discard, needs_aux, responder, decode_id)]
() mutable
{
auto done = req.processRequest();
@@ -103,13 +108,10 @@ LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(
if (! posted)
{
LL_DEBUGS() << "Tried to start decoding on shutdown" << LL_ENDL;
- // should this return 0?
+ return 0;
}
- // It's important to our consumer (LLTextureFetchWorker) that we return a
- // nonzero handle. It is NOT important that the nonzero handle be unique:
- // nothing is ever done with it except to compare it to zero, or zero it.
- return 17;
+ return decode_id;
}
void LLImageDecodeThread::shutdown()
@@ -123,15 +125,18 @@ LLImageDecodeThread::Responder::~Responder()
//----------------------------------------------------------------------------
-ImageRequest::ImageRequest(const LLPointer<LLImageFormatted>& image,
- S32 discard, bool needs_aux,
- const LLPointer<LLImageDecodeThread::Responder>& responder)
+ImageRequest::ImageRequest(const LLPointer<LLImageFormatted>& image,
+ S32 discard,
+ bool needs_aux,
+ const LLPointer<LLImageDecodeThread::Responder>& responder,
+ U32 request_id)
: mFormattedImage(image),
mDiscardLevel(discard),
mNeedsAux(needs_aux),
mDecodedRaw(false),
mDecodedAux(false),
- mResponder(responder)
+ mResponder(responder),
+ mRequestId(request_id)
{
}
@@ -208,7 +213,7 @@ void ImageRequest::finishRequest(bool completed)
if (mResponder.notNull())
{
bool success = completed && mDecodedRaw && (!mNeedsAux || mDecodedAux);
- mResponder->completed(success, mDecodedImageRaw, mDecodedImageAux);
+ mResponder->completed(success, mDecodedImageRaw, mDecodedImageAux, mRequestId);
}
// Will automatically be deleted
}