aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimagelist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewerimagelist.cpp')
-rw-r--r--linden/indra/newview/llviewerimagelist.cpp201
1 files changed, 107 insertions, 94 deletions
diff --git a/linden/indra/newview/llviewerimagelist.cpp b/linden/indra/newview/llviewerimagelist.cpp
index 890629e..aa9c2c0 100644
--- a/linden/indra/newview/llviewerimagelist.cpp
+++ b/linden/indra/newview/llviewerimagelist.cpp
@@ -2,6 +2,8 @@
2 * @file llviewerimagelist.cpp 2 * @file llviewerimagelist.cpp
3 * @brief Object for managing the list of images within a region 3 * @brief Object for managing the list of images within a region
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 *
5 * Copyright (c) 2000-2007, Linden Research, Inc. 7 * Copyright (c) 2000-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#include "llviewerprecompiledheaders.h" 32#include "llviewerprecompiledheaders.h"
@@ -111,8 +114,6 @@ void LLViewerImageList::init()
111 mMovieImageHasMips = FALSE; 114 mMovieImageHasMips = FALSE;
112 115
113 doPreloadImages(); 116 doPreloadImages();
114
115 decodeAllImages(5.f); // decode preloaded images
116} 117}
117 118
118void LLViewerImageList::doPreloadImages() 119void LLViewerImageList::doPreloadImages()
@@ -123,19 +124,14 @@ void LLViewerImageList::doPreloadImages()
123 LLViewerImage::sMissingAssetImagep = preloadImage("missing_asset.tga" , LLUUID::null, TRUE); 124 LLViewerImage::sMissingAssetImagep = preloadImage("missing_asset.tga" , LLUUID::null, TRUE);
124 125
125 // Set the "white" image 126 // Set the "white" image
126 LLViewerImage::sWhiteImagep = preloadImage("white.tga", LLUUID::null, TRUE);; 127 LLViewerImage::sWhiteImagep = preloadImage("white.tga", LLUUID::null, TRUE);
127 128
128 // Speeds up startup by 4-5 seconds. JC 129 // Speeds up startup by 4-5 seconds. JC
129 if (!gPreloadImages) return; 130 if (!gPreloadImages) return;
130 131
131 // Preload some images 132 // Images listed here are immediately decoded, before the login screen.
132 preloadImage("active_voice_tab.tga", LLUUID::null, FALSE); 133 // Since this slows down perceived viewer startup time, only include
133 preloadImage("button_anim_pause.tga", LLUUID::null, FALSE); 134 // images here for buttons/checkboxes/etc. that are immediately visible.
134 preloadImage("button_anim_pause_selected.tga", LLUUID::null, FALSE);
135 preloadImage("button_anim_play.tga", LLUUID::null, FALSE);
136 preloadImage("button_anim_play_selected.tga", LLUUID::null, FALSE);
137 preloadImage("button_anim_stop.tga", LLUUID::null, FALSE);
138 preloadImage("button_anim_stop_selected.tga", LLUUID::null, FALSE);
139 preloadImage("button_disabled_32x128.tga", LLUUID::null, FALSE); 135 preloadImage("button_disabled_32x128.tga", LLUUID::null, FALSE);
140 preloadImage("button_enabled_32x128.tga", LLUUID::null, FALSE); 136 preloadImage("button_enabled_32x128.tga", LLUUID::null, FALSE);
141 preloadImage("button_enabled_selected_32x128.tga", LLUUID::null, FALSE); 137 preloadImage("button_enabled_selected_32x128.tga", LLUUID::null, FALSE);
@@ -145,6 +141,48 @@ void LLViewerImageList::doPreloadImages()
145 preloadImage("checkbox_enabled_true.tga", LLUUID::null, FALSE); 141 preloadImage("checkbox_enabled_true.tga", LLUUID::null, FALSE);
146 preloadImage("close_in_blue.tga", LLUUID::null, FALSE); 142 preloadImage("close_in_blue.tga", LLUUID::null, FALSE);
147 preloadImage("combobox_arrow.tga", LLUUID::null, FALSE); 143 preloadImage("combobox_arrow.tga", LLUUID::null, FALSE);
144 preloadImage("minimize.tga", LLUUID::null, FALSE);
145 preloadImage("minimize_pressed.tga", LLUUID::null, FALSE);
146 preloadImage("radio_active_false.tga", LLUUID::null, FALSE);
147 preloadImage("radio_active_true.tga", LLUUID::null, FALSE);
148 preloadImage("radio_inactive_false.tga", LLUUID::null, FALSE);
149 preloadImage("radio_inactive_true.tga", LLUUID::null, FALSE);
150 preloadImage("resize_handle_bottom_right_blue.tga", LLUUID::null, FALSE);
151 preloadImage("rounded_square.tga", LLUUID::null, FALSE);
152 preloadImage("rounded_square_soft.tga", LLUUID::null, FALSE);
153 preloadImage("scrollbutton_down_in_blue.tga", LLUUID::null, FALSE);
154 preloadImage("scrollbutton_down_out_blue.tga", LLUUID::null, FALSE);
155 preloadImage("scrollbutton_left_in_blue.tga", LLUUID::null, FALSE);
156 preloadImage("scrollbutton_left_out_blue.tga", LLUUID::null, FALSE);
157 preloadImage("scrollbutton_right_in_blue.tga", LLUUID::null, FALSE);
158 preloadImage("scrollbutton_right_out_blue.tga", LLUUID::null, FALSE);
159 preloadImage("scrollbutton_up_in_blue.tga", LLUUID::null, FALSE);
160 preloadImage("scrollbutton_up_out_blue.tga", LLUUID::null, FALSE);
161 preloadImage("spin_down_in_blue.tga", LLUUID::null, FALSE);
162 preloadImage("spin_down_out_blue.tga", LLUUID::null, FALSE);
163 preloadImage("spin_up_in_blue.tga", LLUUID::null, FALSE);
164 preloadImage("spin_up_out_blue.tga", LLUUID::null, FALSE);
165 preloadImage("square_btn_32x128.tga", LLUUID::null, FALSE);
166 preloadImage("square_btn_selected_32x128.tga", LLUUID::null, FALSE);
167 preloadImage("startup_logo.tga", LLUUID::null, FALSE); // <<<<<<< --- needed?
168 preloadImage("tab_bottom_blue.tga", LLUUID::null, FALSE);
169 preloadImage("tab_bottom_selected_blue.tga", LLUUID::null, FALSE);
170 preloadImage("tab_left.tga", LLUUID::null, FALSE);
171 preloadImage("tab_left_selected.tga", LLUUID::null, FALSE);
172 preloadImage("tab_top_blue.tga", LLUUID::null, FALSE);
173 preloadImage("tab_top_selected_blue.tga", LLUUID::null, FALSE);
174
175 decodeAllImages(2.f); // decode preloaded images
176
177 // These images are queued for decode during the login sequence, when
178 // we have a progress bar.
179 preloadImage("active_voice_tab.tga", LLUUID::null, FALSE);
180 preloadImage("button_anim_pause.tga", LLUUID::null, FALSE);
181 preloadImage("button_anim_pause_selected.tga", LLUUID::null, FALSE);
182 preloadImage("button_anim_play.tga", LLUUID::null, FALSE);
183 preloadImage("button_anim_play_selected.tga", LLUUID::null, FALSE);
184 preloadImage("button_anim_stop.tga", LLUUID::null, FALSE);
185 preloadImage("button_anim_stop_selected.tga", LLUUID::null, FALSE);
148 preloadImage("crosshairs.tga", LLUUID::null, FALSE); 186 preloadImage("crosshairs.tga", LLUUID::null, FALSE);
149 preloadImage("direction_arrow.tga", LLUUID::null, FALSE); 187 preloadImage("direction_arrow.tga", LLUUID::null, FALSE);
150 preloadImage("eyes.tga", LLUUID::null, TRUE); 188 preloadImage("eyes.tga", LLUUID::null, TRUE);
@@ -196,9 +234,14 @@ void LLViewerImageList::doPreloadImages()
196 preloadImage("inv_item_texture.tga", LLUUID::null, FALSE); 234 preloadImage("inv_item_texture.tga", LLUUID::null, FALSE);
197 preloadImage("inv_item_underpants.tga", LLUUID::null, FALSE); 235 preloadImage("inv_item_underpants.tga", LLUUID::null, FALSE);
198 preloadImage("inv_item_undershirt.tga", LLUUID::null, FALSE); 236 preloadImage("inv_item_undershirt.tga", LLUUID::null, FALSE);
237 preloadImage("lag_status_critical.tga", LLUUID::null, FALSE);
238 preloadImage("lag_status_good.tga", LLUUID::null, FALSE);
239 preloadImage("lag_status_warning.tga", LLUUID::null, FALSE);
199 preloadImage("legend.tga", LLUUID::null, FALSE); 240 preloadImage("legend.tga", LLUUID::null, FALSE);
200 preloadImage("map_avatar_16.tga", LLUUID::null, FALSE); 241 preloadImage("map_avatar_16.tga", LLUUID::null, FALSE);
201 preloadImage("map_avatar_8.tga", LLUUID::null, FALSE); 242 preloadImage("map_avatar_8.tga", LLUUID::null, FALSE);
243 preloadImage("map_avatar_above_8.tga", LLUUID::null, FALSE);
244 preloadImage("map_avatar_below_8.tga", LLUUID::null, FALSE);
202 preloadImage("map_avatar_you_8.tga", LLUUID::null, FALSE); 245 preloadImage("map_avatar_you_8.tga", LLUUID::null, FALSE);
203 preloadImage("map_event.tga", LLUUID::null, FALSE); 246 preloadImage("map_event.tga", LLUUID::null, FALSE);
204 preloadImage("map_event_mature.tga", LLUUID::null, FALSE); 247 preloadImage("map_event_mature.tga", LLUUID::null, FALSE);
@@ -207,8 +250,6 @@ void LLViewerImageList::doPreloadImages()
207 preloadImage("map_telehub.tga", LLUUID::null, FALSE); 250 preloadImage("map_telehub.tga", LLUUID::null, FALSE);
208 preloadImage("map_track_16.tga", LLUUID::null, FALSE); 251 preloadImage("map_track_16.tga", LLUUID::null, FALSE);
209 preloadImage("media_icon.tga", LLUUID::null, FALSE); 252 preloadImage("media_icon.tga", LLUUID::null, FALSE);
210 preloadImage("minimize.tga", LLUUID::null, FALSE);
211 preloadImage("minimize_pressed.tga", LLUUID::null, FALSE);
212 preloadImage("music_icon.tga", LLUUID::null, FALSE); 253 preloadImage("music_icon.tga", LLUUID::null, FALSE);
213 preloadImage("noentrylines.tga", LLUUID::null, TRUE); 254 preloadImage("noentrylines.tga", LLUUID::null, TRUE);
214 preloadImage("noentrypasslines.tga", LLUUID::null, TRUE); 255 preloadImage("noentrypasslines.tga", LLUUID::null, TRUE);
@@ -245,31 +286,9 @@ void LLViewerImageList::doPreloadImages()
245 preloadImage("object_tree_active.tga", LLUUID::null, FALSE); 286 preloadImage("object_tree_active.tga", LLUUID::null, FALSE);
246 preloadImage("object_tube.tga", LLUUID::null, FALSE); 287 preloadImage("object_tube.tga", LLUUID::null, FALSE);
247 preloadImage("object_tube_active.tga", LLUUID::null, FALSE); 288 preloadImage("object_tube_active.tga", LLUUID::null, FALSE);
248 preloadImage("pixiesmall.tga", LLUUID::null, TRUE); 289 preloadImage("pixiesmall.tga", LLUUID::null, TRUE); // particle systems
249 preloadImage("radio_active_false.tga", LLUUID::null, FALSE);
250 preloadImage("radio_active_true.tga", LLUUID::null, FALSE);
251 preloadImage("radio_inactive_false.tga", LLUUID::null, FALSE);
252 preloadImage("radio_inactive_true.tga", LLUUID::null, FALSE);
253 preloadImage("resize_handle_bottom_right_blue.tga", LLUUID::null, FALSE);
254 preloadImage("rounded_square.tga", LLUUID::null, FALSE);
255 preloadImage("rounded_square_soft.tga", LLUUID::null, FALSE);
256 preloadImage("script_error.tga", LLUUID::null, TRUE); 290 preloadImage("script_error.tga", LLUUID::null, TRUE);
257 preloadImage("scrollbutton_down_in_blue.tga", LLUUID::null, FALSE);
258 preloadImage("scrollbutton_down_out_blue.tga", LLUUID::null, FALSE);
259 preloadImage("scrollbutton_left_in_blue.tga", LLUUID::null, FALSE);
260 preloadImage("scrollbutton_left_out_blue.tga", LLUUID::null, FALSE);
261 preloadImage("scrollbutton_right_in_blue.tga", LLUUID::null, FALSE);
262 preloadImage("scrollbutton_right_out_blue.tga", LLUUID::null, FALSE);
263 preloadImage("scrollbutton_up_in_blue.tga", LLUUID::null, FALSE);
264 preloadImage("scrollbutton_up_out_blue.tga", LLUUID::null, FALSE);
265 preloadImage("silhouette.tga", LLUUID::null, TRUE); 291 preloadImage("silhouette.tga", LLUUID::null, TRUE);
266 preloadImage("spin_down_in_blue.tga", LLUUID::null, FALSE);
267 preloadImage("spin_down_out_blue.tga", LLUUID::null, FALSE);
268 preloadImage("spin_up_in_blue.tga", LLUUID::null, FALSE);
269 preloadImage("spin_up_out_blue.tga", LLUUID::null, FALSE);
270 preloadImage("square_btn_32x128.tga", LLUUID::null, FALSE);
271 preloadImage("square_btn_selected_32x128.tga", LLUUID::null, FALSE);
272 preloadImage("startup_logo.tga", LLUUID::null, FALSE);
273 preloadImage("status_build.tga", LLUUID::null, FALSE); 292 preloadImage("status_build.tga", LLUUID::null, FALSE);
274 preloadImage("status_buy_currency.tga", LLUUID::null, FALSE); 293 preloadImage("status_buy_currency.tga", LLUUID::null, FALSE);
275 preloadImage("status_buy_currency_pressed.tga", LLUUID::null, FALSE); 294 preloadImage("status_buy_currency_pressed.tga", LLUUID::null, FALSE);
@@ -278,18 +297,11 @@ void LLViewerImageList::doPreloadImages()
278 preloadImage("status_fly.tga", LLUUID::null, FALSE); 297 preloadImage("status_fly.tga", LLUUID::null, FALSE);
279 preloadImage("status_health.tga", LLUUID::null, FALSE); 298 preloadImage("status_health.tga", LLUUID::null, FALSE);
280 preloadImage("status_scripts.tga", LLUUID::null, FALSE); 299 preloadImage("status_scripts.tga", LLUUID::null, FALSE);
281 preloadImage("tab_bottom_blue.tga", LLUUID::null, FALSE);
282 preloadImage("tab_bottom_selected_blue.tga", LLUUID::null, FALSE);
283 preloadImage("tab_left.tga", LLUUID::null, FALSE);
284 preloadImage("tab_left_selected.tga", LLUUID::null, FALSE);
285 preloadImage("tab_top_blue.tga", LLUUID::null, FALSE);
286 preloadImage("tab_top_selected_blue.tga", LLUUID::null, FALSE);
287 preloadImage("tool_dozer.tga", LLUUID::null, FALSE); 300 preloadImage("tool_dozer.tga", LLUUID::null, FALSE);
288 preloadImage("tool_dozer_active.tga", LLUUID::null, FALSE); 301 preloadImage("tool_dozer_active.tga", LLUUID::null, FALSE);
289 preloadImage("tool_zoom.tga", LLUUID::null, FALSE); 302 preloadImage("tool_zoom.tga", LLUUID::null, FALSE);
290 preloadImage("tool_zoom_active.tga", LLUUID::null, FALSE); 303 preloadImage("tool_zoom_active.tga", LLUUID::null, FALSE);
291 preloadImage("volume_icon.tga", LLUUID::null, FALSE); 304 preloadImage("volume_icon.tga", LLUUID::null, FALSE);
292 preloadImage("white.tga", LLUUID::null, TRUE);
293 preloadImage("icn_active-speakers-dot-lvl0.tga", LLUUID::null, FALSE); 305 preloadImage("icn_active-speakers-dot-lvl0.tga", LLUUID::null, FALSE);
294 preloadImage("icn_active-speakers-dot-lvl1.tga", LLUUID::null, FALSE); 306 preloadImage("icn_active-speakers-dot-lvl1.tga", LLUUID::null, FALSE);
295 preloadImage("icn_active-speakers-dot-lvl2.tga", LLUUID::null, FALSE); 307 preloadImage("icn_active-speakers-dot-lvl2.tga", LLUUID::null, FALSE);
@@ -977,63 +989,64 @@ void LLViewerImageList::updateImagesUpdateStats()
977void LLViewerImageList::decodeAllImages(F32 max_time) 989void LLViewerImageList::decodeAllImages(F32 max_time)
978{ 990{
979 LLTimer timer; 991 LLTimer timer;
980 if(!gNoRender) 992 if(gNoRender) return;
993
994 // Update texture stats and priorities
995 std::vector<LLPointer<LLViewerImage> > image_list;
996 for (image_priority_list_t::iterator iter = mImageList.begin();
997 iter != mImageList.end(); )
981 { 998 {
982 // Update texture stats and priorities 999 LLViewerImage* imagep = *iter++;
983 std::vector<LLPointer<LLViewerImage> > image_list; 1000 image_list.push_back(imagep);
984 for (image_priority_list_t::iterator iter = mImageList.begin(); 1001 imagep->mInImageList = FALSE;
985 iter != mImageList.end(); ) 1002 }
986 { 1003 mImageList.clear();
987 LLViewerImage* imagep = *iter++; 1004 for (std::vector<LLPointer<LLViewerImage> >::iterator iter = image_list.begin();
988 image_list.push_back(imagep); 1005 iter != image_list.end(); ++iter)
989 imagep->mInImageList = FALSE; 1006 {
990 } 1007 LLViewerImage* imagep = *iter;
991 mImageList.clear(); 1008 imagep->processTextureStats();
992 for (std::vector<LLPointer<LLViewerImage> >::iterator iter = image_list.begin(); 1009 F32 decode_priority = imagep->calcDecodePriority();
993 iter != image_list.end(); ++iter) 1010 imagep->setDecodePriority(decode_priority);
994 { 1011 mImageList.insert(imagep);
995 LLViewerImage* imagep = *iter; 1012 imagep->mInImageList = TRUE;
996 imagep->processTextureStats(); 1013 }
997 F32 decode_priority = imagep->calcDecodePriority(); 1014 image_list.clear();
998 imagep->setDecodePriority(decode_priority); 1015
999 mImageList.insert(imagep); 1016 // Update fetch (decode)
1000 imagep->mInImageList = TRUE; 1017 for (image_priority_list_t::iterator iter = mImageList.begin();
1001 } 1018 iter != mImageList.end(); )
1002 image_list.clear(); 1019 {
1003 1020 LLViewerImage* imagep = *iter++;
1004 // Update fetch (decode) 1021 imagep->updateFetch();
1005 for (image_priority_list_t::iterator iter = mImageList.begin(); 1022 }
1006 iter != mImageList.end(); ) 1023 // Run threads
1007 { 1024 S32 fetch_pending = 0;
1008 LLViewerImage* imagep = *iter++; 1025 while (1)
1009 imagep->updateFetch(); 1026 {
1010 } 1027 gTextureCache->update(1); // unpauses the texture cache thread
1011 // Run threads 1028 gImageDecodeThread->update(1); // unpauses the image thread
1012 while (1) 1029 fetch_pending = gTextureFetch->update(1); // unpauses the texture fetch thread
1013 { 1030 if (fetch_pending == 0 || timer.getElapsedTimeF32() > max_time)
1014 gTextureCache->update(1); // unpauses the texture cache thread
1015 gImageDecodeThread->update(1); // unpauses the image thread
1016 S32 fetch_pending = gTextureFetch->update(1); // unpauses the texture fetch thread
1017 if (fetch_pending == 0 || timer.getElapsedTimeF32() > max_time)
1018 {
1019 break;
1020 }
1021 }
1022 // Update fetch again
1023 for (image_priority_list_t::iterator iter = mImageList.begin();
1024 iter != mImageList.end(); )
1025 { 1031 {
1026 LLViewerImage* imagep = *iter++; 1032 break;
1027 imagep->updateFetch();
1028 } 1033 }
1029 max_time -= timer.getElapsedTimeF32();
1030 max_time = llmax(max_time, .01f);
1031 updateImagesCreateTextures(max_time);
1032 } 1034 }
1033 if (timer.getElapsedTimeF32() > .5f) // seconds 1035 // Update fetch again
1036 for (image_priority_list_t::iterator iter = mImageList.begin();
1037 iter != mImageList.end(); )
1034 { 1038 {
1035 llinfos << "decodeAllImages() took " << timer.getElapsedTimeF32() << " seconds. " << llendl; 1039 LLViewerImage* imagep = *iter++;
1040 imagep->updateFetch();
1036 } 1041 }
1042 max_time -= timer.getElapsedTimeF32();
1043 max_time = llmax(max_time, .01f);
1044 F32 create_time = updateImagesCreateTextures(max_time);
1045
1046 llinfos << "decodeAllImages() took " << timer.getElapsedTimeF32() << " seconds. "
1047 << " fetch_pending " << fetch_pending
1048 << " create_time " << create_time
1049 << llendl;
1037} 1050}
1038 1051
1039 1052