aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage/llimageworker.h
diff options
context:
space:
mode:
authorJacek Antonelli2010-02-09 21:11:42 -0600
committerJacek Antonelli2010-02-16 18:50:15 -0600
commite6247fbe78c4d3dacb74f3b2359aba2b6538133b (patch)
tree10c42d670a2c635b4339f7f68809c221756774f8 /linden/indra/llimage/llimageworker.h
parentPorted some cURL and HTTP-related changes from Snowglobe. (diff)
downloadmeta-impy-e6247fbe78c4d3dacb74f3b2359aba2b6538133b.zip
meta-impy-e6247fbe78c4d3dacb74f3b2359aba2b6538133b.tar.gz
meta-impy-e6247fbe78c4d3dacb74f3b2359aba2b6538133b.tar.bz2
meta-impy-e6247fbe78c4d3dacb74f3b2359aba2b6538133b.tar.xz
Ported many texture engine changes from Snowglobe.
Diffstat (limited to 'linden/indra/llimage/llimageworker.h')
-rw-r--r--linden/indra/llimage/llimageworker.h97
1 files changed, 60 insertions, 37 deletions
diff --git a/linden/indra/llimage/llimageworker.h b/linden/indra/llimage/llimageworker.h
index 879fcf5..fcd3039 100644
--- a/linden/indra/llimage/llimageworker.h
+++ b/linden/indra/llimage/llimageworker.h
@@ -34,51 +34,74 @@
34#define LL_LLIMAGEWORKER_H 34#define LL_LLIMAGEWORKER_H
35 35
36#include "llimage.h" 36#include "llimage.h"
37#include "llworkerthread.h" 37#include "llqueuedthread.h"
38 38
39class LLImageWorker : public LLWorkerClass 39class LLImageDecodeThread : public LLQueuedThread
40{ 40{
41public: 41public:
42 static void initImageWorker(LLWorkerThread* workerthread); 42 class Responder : public LLThreadSafeRefCount
43 static void cleanupImageWorker(); 43 {
44 44 protected:
45public: 45 virtual ~Responder();
46 static LLWorkerThread* getWorkerThread() { return sWorkerThread; } 46 public:
47 47 virtual void completed(bool success, LLImageRaw* raw, LLImageRaw* aux) = 0;
48 // LLWorkerThread 48 };
49public:
50 LLImageWorker(LLImageFormatted* image, U32 priority, S32 discard,
51 LLPointer<LLResponder> responder);
52 ~LLImageWorker();
53
54 // called from WORKER THREAD, returns TRUE if done
55 /*virtual*/ bool doWork(S32 param);
56
57 BOOL requestDecodedData(LLPointer<LLImageRaw>& raw, S32 discard = -1);
58 BOOL requestDecodedAuxData(LLPointer<LLImageRaw>& raw, S32 channel, S32 discard = -1);
59 void releaseDecodedData();
60 void cancelDecode();
61 49
62private: 50 class ImageRequest : public LLQueuedThread::QueuedRequest
63 // called from MAIN THREAD 51 {
64 /*virtual*/ void startWork(S32 param); // called from addWork() 52 protected:
65 /*virtual*/ void endWork(S32 param, bool aborted); // called from doWork() 53 virtual ~ImageRequest(); // use deleteRequest()
54
55 public:
56 ImageRequest(handle_t handle, LLImageFormatted* image,
57 U32 priority, S32 discard, BOOL needs_aux,
58 LLImageDecodeThread::Responder* responder);
66 59
67protected: 60 /*virtual*/ bool processRequest();
68 LLPointer<LLImageFormatted> mFormattedImage; 61 /*virtual*/ void finishRequest(bool completed);
69 LLPointer<LLImageRaw> mDecodedImage;
70 S32 mDecodedType;
71 S32 mDiscardLevel;
72 62
73private: 63 // Used by unit tests to check the consitency of the request instance
74 U32 mPriority; 64 bool tut_isOK();
75 LLPointer<LLResponder> mResponder; 65
66 private:
67 // input
68 LLPointer<LLImageFormatted> mFormattedImage;
69 S32 mDiscardLevel;
70 BOOL mNeedsAux;
71 // output
72 LLPointer<LLImageRaw> mDecodedImageRaw;
73 LLPointer<LLImageRaw> mDecodedImageAux;
74 BOOL mDecodedRaw;
75 BOOL mDecodedAux;
76 LLPointer<LLImageDecodeThread::Responder> mResponder;
77 };
76 78
77protected:
78 static LLWorkerThread* sWorkerThread;
79
80public: 79public:
81 static S32 sCount; 80 LLImageDecodeThread(bool threaded = true);
81 handle_t decodeImage(LLImageFormatted* image,
82 U32 priority, S32 discard, BOOL needs_aux,
83 Responder* responder);
84 S32 update(U32 max_time_ms);
85
86 // Used by unit tests to check the consistency of the thread instance
87 S32 tut_size();
88
89private:
90 struct creation_info
91 {
92 handle_t handle;
93 LLImageFormatted* image;
94 U32 priority;
95 S32 discard;
96 BOOL needs_aux;
97 LLPointer<Responder> responder;
98 creation_info(handle_t h, LLImageFormatted* i, U32 p, S32 d, BOOL aux, Responder* r)
99 : handle(h), image(i), priority(p), discard(d), needs_aux(aux), responder(r)
100 {}
101 };
102 typedef std::list<creation_info> creation_list_t;
103 creation_list_t mCreationList;
104 LLMutex* mCreationMutex;
82}; 105};
83 106
84#endif 107#endif