aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimagelist.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:27 -0500
committerJacek Antonelli2008-08-15 23:45:27 -0500
commita8a62201ba762e98dff92cf49033e577fc34d8d4 (patch)
tree11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/newview/llviewerimagelist.cpp
parentSecond Life viewer sources 1.18.6.4-RC (diff)
downloadmeta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2
meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz
Second Life viewer sources 1.19.0.0
Diffstat (limited to 'linden/indra/newview/llviewerimagelist.cpp')
-rw-r--r--linden/indra/newview/llviewerimagelist.cpp902
1 files changed, 474 insertions, 428 deletions
diff --git a/linden/indra/newview/llviewerimagelist.cpp b/linden/indra/newview/llviewerimagelist.cpp
index ff3faae..9c74b4a 100644
--- a/linden/indra/newview/llviewerimagelist.cpp
+++ b/linden/indra/newview/llviewerimagelist.cpp
@@ -12,12 +12,12 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2 15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 * 16 *
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception 20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 21 *
22 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -85,12 +85,12 @@ LLStat LLViewerImageList::sFormattedMemStat(32, TRUE);
85/////////////////////////////////////////////////////////////////////////////// 85///////////////////////////////////////////////////////////////////////////////
86 86
87LLViewerImageList::LLViewerImageList() 87LLViewerImageList::LLViewerImageList()
88 : LLImageProviderInterface(), 88: LLImageProviderInterface(),
89 mForceResetTextureStats(FALSE), 89mForceResetTextureStats(FALSE),
90 mUpdateStats(FALSE), 90mUpdateStats(FALSE),
91 mMaxResidentTexMem(0), 91mMaxResidentTexMem(0),
92 mVideoMemorySetting(0), 92mVideoMemorySetting(0),
93 mMovieImageHasMips(FALSE) 93mMovieImageHasMips(FALSE)
94{ 94{
95} 95}
96 96
@@ -99,20 +99,20 @@ void LLViewerImageList::init()
99 sNumImages = 0; 99 sNumImages = 0;
100 mMaxResidentTexMem = 0; 100 mMaxResidentTexMem = 0;
101 mVideoMemorySetting = 0; 101 mVideoMemorySetting = 0;
102 102
103 if (gNoRender) 103 if (gNoRender)
104 { 104 {
105 // Don't initialize GL stuff if we're not rendering. 105 // Don't initialize GL stuff if we're not rendering.
106 return; 106 return;
107 } 107 }
108 108
109 mUpdateStats = TRUE; 109 mUpdateStats = TRUE;
110 110
111 // Update how much texture RAM we're allowed to use. 111 // Update how much texture RAM we're allowed to use.
112 updateMaxResidentTexMem(); 112 updateMaxResidentTexMem();
113 113
114 mMovieImageHasMips = FALSE; 114 mMovieImageHasMips = FALSE;
115 115
116 doPreloadImages(); 116 doPreloadImages();
117} 117}
118 118
@@ -120,203 +120,228 @@ void LLViewerImageList::init()
120void LLViewerImageList::doPreloadImages() 120void LLViewerImageList::doPreloadImages()
121{ 121{
122 llinfos << "Preloading images..." << llendl; 122 llinfos << "Preloading images..." << llendl;
123 123
124 // Set the "missing asset" image 124 // Set the "missing asset" image
125 LLViewerImage::sMissingAssetImagep = preloadImage("missing_asset.tga" , LLUUID::null, TRUE); 125 LLViewerImage::sMissingAssetImagep = preloadUIImage("missing_asset.tga" , LLUUID::null, TRUE);
126 126
127 // Set the "white" image 127 // Set the "white" image
128 LLViewerImage::sWhiteImagep = preloadImage("white.tga", LLUUID::null, TRUE); 128 LLViewerImage::sWhiteImagep = preloadUIImage("white.tga", LLUUID::null, TRUE);;
129 129
130 // Speeds up startup by 4-5 seconds. JC 130 // Speeds up startup by 4-5 seconds. JC
131 if (!gPreloadImages) return; 131 if (!gPreloadImages) return;
132 132
133 // Images listed here are immediately decoded, before the login screen. 133 // Images listed here are immediately decoded, before the login screen.
134 // Since this slows down perceived viewer startup time, only include 134 // Since this slows down perceived viewer startup time, only include
135 // images here for buttons/checkboxes/etc. that are immediately visible. 135 // images here for buttons/checkboxes/etc. that are immediately visible.
136 preloadImage("button_disabled_32x128.tga", LLUUID::null, FALSE); 136 preloadUIImage("button_disabled_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f ));
137 preloadImage("button_enabled_32x128.tga", LLUUID::null, FALSE); 137 preloadUIImage("button_enabled_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f ));
138 preloadImage("button_enabled_selected_32x128.tga", LLUUID::null, FALSE); 138 preloadUIImage("button_enabled_selected_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f ));
139 preloadImage("checkbox_disabled_false.tga", LLUUID::null, FALSE); 139 preloadUIImage("checkbox_disabled_false.tga", LLUUID::null, FALSE);
140 preloadImage("checkbox_disabled_true.tga", LLUUID::null, FALSE); 140 preloadUIImage("checkbox_disabled_true.tga", LLUUID::null, FALSE);
141 preloadImage("checkbox_enabled_false.tga", LLUUID::null, FALSE); 141 preloadUIImage("checkbox_enabled_false.tga", LLUUID::null, FALSE);
142 preloadImage("checkbox_enabled_true.tga", LLUUID::null, FALSE); 142 preloadUIImage("checkbox_enabled_true.tga", LLUUID::null, FALSE);
143 preloadImage("close_in_blue.tga", LLUUID::null, FALSE); 143 preloadUIImage("close_in_blue.tga", LLUUID::null, FALSE);
144 preloadImage("combobox_arrow.tga", LLUUID::null, FALSE); 144 preloadUIImage("combobox_arrow.tga", LLUUID::null, FALSE);
145 preloadImage("minimize.tga", LLUUID::null, FALSE); 145 preloadUIImage("minimize.tga", LLUUID::null, FALSE);
146 preloadImage("minimize_pressed.tga", LLUUID::null, FALSE); 146 preloadUIImage("minimize_pressed.tga", LLUUID::null, FALSE);
147 preloadImage("radio_active_false.tga", LLUUID::null, FALSE); 147 preloadUIImage("radio_active_false.tga", LLUUID::null, FALSE);
148 preloadImage("radio_active_true.tga", LLUUID::null, FALSE); 148 preloadUIImage("radio_active_true.tga", LLUUID::null, FALSE);
149 preloadImage("radio_inactive_false.tga", LLUUID::null, FALSE); 149 preloadUIImage("radio_inactive_false.tga", LLUUID::null, FALSE);
150 preloadImage("radio_inactive_true.tga", LLUUID::null, FALSE); 150 preloadUIImage("radio_inactive_true.tga", LLUUID::null, FALSE);
151 preloadImage("resize_handle_bottom_right_blue.tga", LLUUID::null, FALSE); 151 preloadUIImage("resize_handle_bottom_right_blue.tga", LLUUID::null, FALSE);
152 preloadImage("rounded_square.tga", LLUUID::null, FALSE); 152 preloadUIImage("rounded_square.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f ));
153 preloadImage("rounded_square_soft.tga", LLUUID::null, FALSE); 153 preloadUIImage("rounded_square_soft.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f ));
154 preloadImage("scrollbutton_down_in_blue.tga", LLUUID::null, FALSE); 154 preloadUIImage("scrollbutton_down_in_blue.tga", LLUUID::null, FALSE);
155 preloadImage("scrollbutton_down_out_blue.tga", LLUUID::null, FALSE); 155 preloadUIImage("scrollbutton_down_out_blue.tga", LLUUID::null, FALSE);
156 preloadImage("scrollbutton_left_in_blue.tga", LLUUID::null, FALSE); 156 preloadUIImage("scrollbutton_left_in_blue.tga", LLUUID::null, FALSE);
157 preloadImage("scrollbutton_left_out_blue.tga", LLUUID::null, FALSE); 157 preloadUIImage("scrollbutton_left_out_blue.tga", LLUUID::null, FALSE);
158 preloadImage("scrollbutton_right_in_blue.tga", LLUUID::null, FALSE); 158 preloadUIImage("scrollbutton_right_in_blue.tga", LLUUID::null, FALSE);
159 preloadImage("scrollbutton_right_out_blue.tga", LLUUID::null, FALSE); 159 preloadUIImage("scrollbutton_right_out_blue.tga", LLUUID::null, FALSE);
160 preloadImage("scrollbutton_up_in_blue.tga", LLUUID::null, FALSE); 160 preloadUIImage("scrollbutton_up_in_blue.tga", LLUUID::null, FALSE);
161 preloadImage("scrollbutton_up_out_blue.tga", LLUUID::null, FALSE); 161 preloadUIImage("scrollbutton_up_out_blue.tga", LLUUID::null, FALSE);
162 preloadImage("spin_down_in_blue.tga", LLUUID::null, FALSE); 162 preloadUIImage("spin_down_in_blue.tga", LLUUID::null, FALSE);
163 preloadImage("spin_down_out_blue.tga", LLUUID::null, FALSE); 163 preloadUIImage("spin_down_out_blue.tga", LLUUID::null, FALSE);
164 preloadImage("spin_up_in_blue.tga", LLUUID::null, FALSE); 164 preloadUIImage("spin_up_in_blue.tga", LLUUID::null, FALSE);
165 preloadImage("spin_up_out_blue.tga", LLUUID::null, FALSE); 165 preloadUIImage("spin_up_out_blue.tga", LLUUID::null, FALSE);
166 preloadImage("square_btn_32x128.tga", LLUUID::null, FALSE); 166 preloadUIImage("square_btn_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f ));
167 preloadImage("square_btn_selected_32x128.tga", LLUUID::null, FALSE); 167 preloadUIImage("square_btn_selected_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f ));
168 preloadImage("startup_logo.tga", LLUUID::null, FALSE); // <<<<<<< --- needed? 168 preloadUIImage("startup_logo.tga", LLUUID::null, FALSE); // <<<<<<< --- needed?
169 preloadImage("tab_bottom_blue.tga", LLUUID::null, FALSE); 169 preloadUIImage("tab_bottom_blue.tga", LLUUID::null, FALSE, LLRectf(0.109375f, 1.f - 0.4375f, 1.f - 0.109375f, 0.4375f));
170 preloadImage("tab_bottom_selected_blue.tga", LLUUID::null, FALSE); 170 preloadUIImage("tab_bottom_selected_blue.tga", LLUUID::null, FALSE, LLRectf(0.109375f, 1.f - 0.4375f, 1.f - 0.109375f, 0.4375f));
171 preloadImage("tab_left.tga", LLUUID::null, FALSE); 171 preloadUIImage("tab_left.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f ));
172 preloadImage("tab_left_selected.tga", LLUUID::null, FALSE); 172 preloadUIImage("tab_left_selected.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f ));
173 preloadImage("tab_top_blue.tga", LLUUID::null, FALSE); 173 preloadUIImage("tab_top_blue.tga", LLUUID::null, FALSE, LLRectf(0.109375f, 1.f - 0.4375f, 1.f - 0.109375f, 0.4375f));
174 preloadImage("tab_top_selected_blue.tga", LLUUID::null, FALSE); 174 preloadUIImage("tab_top_selected_blue.tga", LLUUID::null, FALSE, LLRectf(0.109375f, 1.f - 0.4375f, 1.f - 0.109375f, 0.4375f));
175 175
176 decodeAllImages(2.f); // decode preloaded images 176 decodeAllImages(2.f); // decode preloaded images
177 177
178 // These images are queued for decode during the login sequence, when 178 // These images are queued for decode during the login sequence, when
179 // we have a progress bar. 179 // we have a progress bar.
180 preloadImage("active_voice_tab.tga", LLUUID::null, FALSE); 180 preloadUIImage("active_voice_tab.tga", LLUUID::null, FALSE);
181 preloadImage("button_anim_pause.tga", LLUUID::null, FALSE); 181 preloadUIImage("button_anim_pause.tga", LLUUID::null, FALSE);
182 preloadImage("button_anim_pause_selected.tga", LLUUID::null, FALSE); 182 preloadUIImage("button_anim_pause_selected.tga", LLUUID::null, FALSE);
183 preloadImage("button_anim_play.tga", LLUUID::null, FALSE); 183 preloadUIImage("button_anim_play.tga", LLUUID::null, FALSE);
184 preloadImage("button_anim_play_selected.tga", LLUUID::null, FALSE); 184 preloadUIImage("button_anim_play_selected.tga", LLUUID::null, FALSE);
185 preloadImage("button_anim_stop.tga", LLUUID::null, FALSE); 185 preloadUIImage("button_anim_stop.tga", LLUUID::null, FALSE);
186 preloadImage("button_anim_stop_selected.tga", LLUUID::null, FALSE); 186 preloadUIImage("button_anim_stop_selected.tga", LLUUID::null, FALSE);
187 preloadImage("crosshairs.tga", LLUUID::null, FALSE); 187 preloadUIImage("crosshairs.tga", LLUUID::null, FALSE);
188 preloadImage("direction_arrow.tga", LLUUID::null, FALSE); 188 preloadUIImage("direction_arrow.tga", LLUUID::null, FALSE);
189 preloadImage("eyes.tga", LLUUID::null, TRUE); 189 preloadUIImage("eyes.tga", LLUUID::null, TRUE);
190 preloadImage("foot_shadow.tga", LLUUID::null, TRUE); 190 preloadUIImage("foot_shadow.tga", LLUUID::null, TRUE);
191 preloadImage("hair.tga", LLUUID::null, TRUE); 191 preloadUIImage("hair.tga", LLUUID::null, TRUE);
192 preloadImage("icon_for_sale.tga", LLUUID::null, FALSE); 192 preloadUIImage("icon_for_sale.tga", LLUUID::null, FALSE);
193 preloadImage("icon_popular.tga", LLUUID::null, FALSE); 193 preloadUIImage("icon_popular.tga", LLUUID::null, FALSE);
194 preloadImage("icon_top_pick.tga", LLUUID::null, FALSE); 194 preloadUIImage("icon_top_pick.tga", LLUUID::null, FALSE);
195 preloadImage("img_shot.tga", IMG_SHOT, TRUE); 195 preloadUIImage("icon_group.tga", LLUUID::null, FALSE);
196 preloadImage("img_smoke_poof.tga", IMG_SMOKE_POOF, TRUE); 196 preloadUIImage("icon_lock.tga", LLUUID::null, FALSE);
197 preloadImage("inv_folder_animation.tga", LLUUID::null, FALSE); 197 preloadUIImage("img_shot.tga", IMG_SHOT, TRUE);
198 preloadImage("inv_folder_bodypart.tga", LLUUID::null, FALSE); 198 preloadUIImage("img_smoke_poof.tga", IMG_SMOKE_POOF, TRUE);
199 preloadImage("inv_folder_callingcard.tga", LLUUID::null, FALSE); 199 preloadUIImage("inv_folder_animation.tga", LLUUID::null, FALSE);
200 preloadImage("inv_folder_clothing.tga", LLUUID::null, FALSE); 200 preloadUIImage("inv_folder_bodypart.tga", LLUUID::null, FALSE);
201 preloadImage("inv_folder_gesture.tga", LLUUID::null, FALSE); 201 preloadUIImage("inv_folder_callingcard.tga", LLUUID::null, FALSE);
202 preloadImage("inv_folder_landmark.tga", LLUUID::null, FALSE); 202 preloadUIImage("inv_folder_clothing.tga", LLUUID::null, FALSE);
203 preloadImage("inv_folder_lostandfound.tga", LLUUID::null, FALSE); 203 preloadUIImage("inv_folder_gesture.tga", LLUUID::null, FALSE);
204 preloadImage("inv_folder_notecard.tga", LLUUID::null, FALSE); 204 preloadUIImage("inv_folder_landmark.tga", LLUUID::null, FALSE);
205 preloadImage("inv_folder_object.tga", LLUUID::null, FALSE); 205 preloadUIImage("inv_folder_lostandfound.tga", LLUUID::null, FALSE);
206 preloadImage("inv_folder_plain_closed.tga", LLUUID::null, FALSE); 206 preloadUIImage("inv_folder_notecard.tga", LLUUID::null, FALSE);
207 preloadImage("inv_folder_script.tga", LLUUID::null, FALSE); 207 preloadUIImage("inv_folder_object.tga", LLUUID::null, FALSE);
208 preloadImage("inv_folder_snapshot.tga", LLUUID::null, FALSE); 208 preloadUIImage("inv_folder_plain_closed.tga", LLUUID::null, FALSE);
209 preloadImage("inv_folder_sound.tga", LLUUID::null, FALSE); 209 preloadUIImage("inv_folder_script.tga", LLUUID::null, FALSE);
210 preloadImage("inv_folder_texture.tga", LLUUID::null, FALSE); 210 preloadUIImage("inv_folder_snapshot.tga", LLUUID::null, FALSE);
211 preloadImage("inv_folder_trash.tga", LLUUID::null, FALSE); 211 preloadUIImage("inv_folder_sound.tga", LLUUID::null, FALSE);
212 preloadImage("inv_item_animation.tga", LLUUID::null, FALSE); 212 preloadUIImage("inv_folder_texture.tga", LLUUID::null, FALSE);
213 preloadImage("inv_item_bodypart.tga", LLUUID::null, FALSE); 213 preloadUIImage("inv_folder_trash.tga", LLUUID::null, FALSE);
214 preloadImage("inv_item_callingcard_offline.tga", LLUUID::null, FALSE); 214 preloadUIImage("inv_item_animation.tga", LLUUID::null, FALSE);
215 preloadImage("inv_item_callingcard_online.tga", LLUUID::null, FALSE); 215 preloadUIImage("inv_item_bodypart.tga", LLUUID::null, FALSE);
216 preloadImage("inv_item_eyes.tga", LLUUID::null, FALSE); 216 preloadUIImage("inv_item_callingcard_offline.tga", LLUUID::null, FALSE);
217 preloadImage("inv_item_gesture.tga", LLUUID::null, FALSE); 217 preloadUIImage("inv_item_callingcard_online.tga", LLUUID::null, FALSE);
218 preloadImage("inv_item_gloves.tga", LLUUID::null, FALSE); 218 preloadUIImage("inv_item_eyes.tga", LLUUID::null, FALSE);
219 preloadImage("inv_item_hair.tga", LLUUID::null, FALSE); 219 preloadUIImage("inv_item_gesture.tga", LLUUID::null, FALSE);
220 preloadImage("inv_item_jacket.tga", LLUUID::null, FALSE); 220 preloadUIImage("inv_item_gloves.tga", LLUUID::null, FALSE);
221 preloadImage("inv_item_landmark.tga", LLUUID::null, FALSE); 221 preloadUIImage("inv_item_hair.tga", LLUUID::null, FALSE);
222 preloadImage("inv_item_landmark_visited.tga", LLUUID::null, FALSE); 222 preloadUIImage("inv_item_jacket.tga", LLUUID::null, FALSE);
223 preloadImage("inv_item_notecard.tga", LLUUID::null, FALSE); 223 preloadUIImage("inv_item_landmark.tga", LLUUID::null, FALSE);
224 preloadImage("inv_item_object.tga", LLUUID::null, FALSE); 224 preloadUIImage("inv_item_landmark_visited.tga", LLUUID::null, FALSE);
225 preloadImage("inv_item_object_multi.tga", LLUUID::null, FALSE); 225 preloadUIImage("inv_item_notecard.tga", LLUUID::null, FALSE);
226 preloadImage("inv_item_pants.tga", LLUUID::null, FALSE); 226 preloadUIImage("inv_item_object.tga", LLUUID::null, FALSE);
227 preloadImage("inv_item_script.tga", LLUUID::null, FALSE); 227 preloadUIImage("inv_item_object_multi.tga", LLUUID::null, FALSE);
228 preloadImage("inv_item_shape.tga", LLUUID::null, FALSE); 228 preloadUIImage("inv_item_pants.tga", LLUUID::null, FALSE);
229 preloadImage("inv_item_shirt.tga", LLUUID::null, FALSE); 229 preloadUIImage("inv_item_script.tga", LLUUID::null, FALSE);
230 preloadImage("inv_item_shoes.tga", LLUUID::null, FALSE); 230 preloadUIImage("inv_item_shape.tga", LLUUID::null, FALSE);
231 preloadImage("inv_item_skirt.tga", LLUUID::null, FALSE); 231 preloadUIImage("inv_item_shirt.tga", LLUUID::null, FALSE);
232 preloadImage("inv_item_snapshot.tga", LLUUID::null, FALSE); 232 preloadUIImage("inv_item_shoes.tga", LLUUID::null, FALSE);
233 preloadImage("inv_item_socks.tga", LLUUID::null, FALSE); 233 preloadUIImage("inv_item_skirt.tga", LLUUID::null, FALSE);
234 preloadImage("inv_item_sound.tga", LLUUID::null, FALSE); 234 preloadUIImage("inv_item_snapshot.tga", LLUUID::null, FALSE);
235 preloadImage("inv_item_texture.tga", LLUUID::null, FALSE); 235 preloadUIImage("inv_item_socks.tga", LLUUID::null, FALSE);
236 preloadImage("inv_item_underpants.tga", LLUUID::null, FALSE); 236 preloadUIImage("inv_item_sound.tga", LLUUID::null, FALSE);
237 preloadImage("inv_item_undershirt.tga", LLUUID::null, FALSE); 237 preloadUIImage("inv_item_texture.tga", LLUUID::null, FALSE);
238 preloadImage("lag_status_critical.tga", LLUUID::null, FALSE); 238 preloadUIImage("inv_item_underpants.tga", LLUUID::null, FALSE);
239 preloadImage("lag_status_good.tga", LLUUID::null, FALSE); 239 preloadUIImage("inv_item_undershirt.tga", LLUUID::null, FALSE);
240 preloadImage("lag_status_warning.tga", LLUUID::null, FALSE); 240 preloadUIImage("lag_status_critical.tga", LLUUID::null, FALSE);
241 preloadImage("legend.tga", LLUUID::null, FALSE); 241 preloadUIImage("lag_status_good.tga", LLUUID::null, FALSE);
242 preloadImage("map_avatar_16.tga", LLUUID::null, FALSE); 242 preloadUIImage("lag_status_warning.tga", LLUUID::null, FALSE);
243 preloadImage("map_avatar_8.tga", LLUUID::null, FALSE); 243 preloadUIImage("legend.tga", LLUUID::null, FALSE);
244 preloadImage("map_avatar_above_8.tga", LLUUID::null, FALSE); 244 preloadUIImage("map_avatar_16.tga", LLUUID::null, FALSE);
245 preloadImage("map_avatar_below_8.tga", LLUUID::null, FALSE); 245 preloadUIImage("map_avatar_8.tga", LLUUID::null, FALSE);
246 preloadImage("map_avatar_you_8.tga", LLUUID::null, FALSE); 246 preloadUIImage("map_avatar_you_8.tga", LLUUID::null, FALSE);
247 preloadImage("map_event.tga", LLUUID::null, FALSE); 247 preloadUIImage("map_event.tga", LLUUID::null, FALSE);
248 preloadImage("map_event_mature.tga", LLUUID::null, FALSE); 248 preloadUIImage("map_event_mature.tga", LLUUID::null, FALSE);
249 preloadImage("map_home.tga", LLUUID::null, FALSE); 249 preloadUIImage("map_home.tga", LLUUID::null, FALSE);
250 preloadImage("map_infohub.tga", LLUUID::null, FALSE); 250 preloadUIImage("map_infohub.tga", LLUUID::null, FALSE);
251 preloadImage("map_telehub.tga", LLUUID::null, FALSE); 251 preloadUIImage("map_telehub.tga", LLUUID::null, FALSE);
252 preloadImage("map_track_16.tga", LLUUID::null, FALSE); 252 preloadUIImage("map_track_16.tga", LLUUID::null, FALSE);
253 preloadImage("media_icon.tga", LLUUID::null, FALSE); 253 preloadUIImage("media_icon.tga", LLUUID::null, FALSE);
254 preloadImage("music_icon.tga", LLUUID::null, FALSE); 254 preloadUIImage("music_icon.tga", LLUUID::null, FALSE);
255 preloadImage("noentrylines.tga", LLUUID::null, TRUE); 255 preloadUIImage("noentrylines.tga", LLUUID::null, TRUE);
256 preloadImage("noentrypasslines.tga", LLUUID::null, TRUE); 256 preloadUIImage("noentrypasslines.tga", LLUUID::null, TRUE);
257 preloadImage("notify_tip_icon.tga", LLUUID::null, FALSE); 257 preloadUIImage("notify_tip_icon.tga", LLUUID::null, FALSE);
258 preloadImage("notify_caution_icon.tga", LLUUID::null, FALSE); 258 preloadUIImage("notify_caution_icon.tga", LLUUID::null, FALSE);
259 preloadImage("notify_box_icon.tga", LLUUID::null, FALSE); 259 preloadUIImage("notify_box_icon.tga", LLUUID::null, FALSE);
260 preloadImage("object_cone.tga", LLUUID::null, FALSE); 260 preloadUIImage("object_cone.tga", LLUUID::null, FALSE);
261 preloadImage("object_cone_active.tga", LLUUID::null, FALSE); 261 preloadUIImage("object_cone_active.tga", LLUUID::null, FALSE);
262 preloadImage("object_cube.tga", LLUUID::null, FALSE); 262 preloadUIImage("object_cube.tga", LLUUID::null, FALSE);
263 preloadImage("object_cube_active.tga", LLUUID::null, FALSE); 263 preloadUIImage("object_cube_active.tga", LLUUID::null, FALSE);
264 preloadImage("object_cylinder.tga", LLUUID::null, FALSE); 264 preloadUIImage("object_cylinder.tga", LLUUID::null, FALSE);
265 preloadImage("object_cylinder_active.tga", LLUUID::null, FALSE); 265 preloadUIImage("object_cylinder_active.tga", LLUUID::null, FALSE);
266 preloadImage("object_grass.tga", LLUUID::null, FALSE); 266 preloadUIImage("object_grass.tga", LLUUID::null, FALSE);
267 preloadImage("object_grass_active.tga", LLUUID::null, FALSE); 267 preloadUIImage("object_grass_active.tga", LLUUID::null, FALSE);
268 preloadImage("object_hemi_cone.tga", LLUUID::null, FALSE); 268 preloadUIImage("object_hemi_cone.tga", LLUUID::null, FALSE);
269 preloadImage("object_hemi_cone_active.tga", LLUUID::null, FALSE); 269 preloadUIImage("object_hemi_cone_active.tga", LLUUID::null, FALSE);
270 preloadImage("object_hemi_cylinder.tga", LLUUID::null, FALSE); 270 preloadUIImage("object_hemi_cylinder.tga", LLUUID::null, FALSE);
271 preloadImage("object_hemi_cylinder_active.tga", LLUUID::null, FALSE); 271 preloadUIImage("object_hemi_cylinder_active.tga", LLUUID::null, FALSE);
272 preloadImage("object_hemi_sphere.tga", LLUUID::null, FALSE); 272 preloadUIImage("object_hemi_sphere.tga", LLUUID::null, FALSE);
273 preloadImage("object_hemi_sphere_active.tga", LLUUID::null, FALSE); 273 preloadUIImage("object_hemi_sphere_active.tga", LLUUID::null, FALSE);
274 preloadImage("object_prism.tga", LLUUID::null, FALSE); 274 preloadUIImage("object_prism.tga", LLUUID::null, FALSE);
275 preloadImage("object_prism_active.tga", LLUUID::null, FALSE); 275 preloadUIImage("object_prism_active.tga", LLUUID::null, FALSE);
276 preloadImage("object_pyramid.tga", LLUUID::null, FALSE); 276 preloadUIImage("object_pyramid.tga", LLUUID::null, FALSE);
277 preloadImage("object_pyramid_active.tga", LLUUID::null, FALSE); 277 preloadUIImage("object_pyramid_active.tga", LLUUID::null, FALSE);
278 preloadImage("object_ring.tga", LLUUID::null, FALSE); 278 preloadUIImage("object_ring.tga", LLUUID::null, FALSE);
279 preloadImage("object_ring_active.tga", LLUUID::null, FALSE); 279 preloadUIImage("object_ring_active.tga", LLUUID::null, FALSE);
280 preloadImage("object_sphere.tga", LLUUID::null, FALSE); 280 preloadUIImage("object_sphere.tga", LLUUID::null, FALSE);
281 preloadImage("object_sphere_active.tga", LLUUID::null, FALSE); 281 preloadUIImage("object_sphere_active.tga", LLUUID::null, FALSE);
282 preloadImage("object_tetrahedron.tga", LLUUID::null, FALSE); 282 preloadUIImage("object_tetrahedron.tga", LLUUID::null, FALSE);
283 preloadImage("object_tetrahedron_active.tga", LLUUID::null, FALSE); 283 preloadUIImage("object_tetrahedron_active.tga", LLUUID::null, FALSE);
284 preloadImage("object_torus.tga", LLUUID::null, FALSE); 284 preloadUIImage("object_torus.tga", LLUUID::null, FALSE);
285 preloadImage("object_torus_active.tga", LLUUID::null, FALSE); 285 preloadUIImage("object_torus_active.tga", LLUUID::null, FALSE);
286 preloadImage("object_tree.tga", LLUUID::null, FALSE); 286 preloadUIImage("object_tree.tga", LLUUID::null, FALSE);
287 preloadImage("object_tree_active.tga", LLUUID::null, FALSE); 287 preloadUIImage("object_tree_active.tga", LLUUID::null, FALSE);
288 preloadImage("object_tube.tga", LLUUID::null, FALSE); 288 preloadUIImage("object_tube.tga", LLUUID::null, FALSE);
289 preloadImage("object_tube_active.tga", LLUUID::null, FALSE); 289 preloadUIImage("object_tube_active.tga", LLUUID::null, FALSE);
290 preloadImage("pixiesmall.tga", LLUUID::null, TRUE); // particle systems 290 preloadUIImage("pixiesmall.tga", LLUUID::null, TRUE);
291 preloadImage("script_error.tga", LLUUID::null, TRUE); 291 preloadUIImage("script_error.tga", LLUUID::null, TRUE);
292 preloadImage("silhouette.tga", LLUUID::null, TRUE); 292 preloadUIImage("silhouette.tga", LLUUID::null, TRUE);
293 preloadImage("status_build.tga", LLUUID::null, FALSE); 293 preloadUIImage("status_no_build.tga", LLUUID::null, FALSE);
294 preloadImage("status_buy_currency.tga", LLUUID::null, FALSE); 294 preloadUIImage("status_buy_currency.tga", LLUUID::null, FALSE);
295 preloadImage("status_buy_currency_pressed.tga", LLUUID::null, FALSE); 295 preloadUIImage("status_buy_currency_pressed.tga", LLUUID::null, FALSE);
296 preloadImage("status_buy_land.tga", LLUUID::null, FALSE); 296 preloadUIImage("status_buy_land.tga", LLUUID::null, FALSE);
297 preloadImage("status_buy_land_pressed.tga", LLUUID::null, FALSE); 297 preloadUIImage("status_buy_land_pressed.tga", LLUUID::null, FALSE);
298 preloadImage("status_fly.tga", LLUUID::null, FALSE); 298 preloadUIImage("status_no_fly.tga", LLUUID::null, FALSE);
299 preloadImage("status_health.tga", LLUUID::null, FALSE); 299 preloadUIImage("status_health.tga", LLUUID::null, FALSE);
300 preloadImage("status_scripts.tga", LLUUID::null, FALSE); 300 preloadUIImage("status_no_push.tga", LLUUID::null, FALSE);
301 preloadImage("tool_dozer.tga", LLUUID::null, FALSE); 301 preloadUIImage("status_no_scripts.tga", LLUUID::null, FALSE);
302 preloadImage("tool_dozer_active.tga", LLUUID::null, FALSE); 302 preloadUIImage("tool_dozer.tga", LLUUID::null, FALSE);
303 preloadImage("tool_zoom.tga", LLUUID::null, FALSE); 303 preloadUIImage("tool_dozer_active.tga", LLUUID::null, FALSE);
304 preloadImage("tool_zoom_active.tga", LLUUID::null, FALSE); 304 preloadUIImage("tool_zoom.tga", LLUUID::null, FALSE);
305 preloadImage("volume_icon.tga", LLUUID::null, FALSE); 305 preloadUIImage("tool_zoom_active.tga", LLUUID::null, FALSE);
306 preloadImage("icn_active-speakers-dot-lvl0.tga", LLUUID::null, FALSE); 306 preloadUIImage("icn-overlay_volume-panel.tga", LLUUID::null, FALSE);
307 preloadImage("icn_active-speakers-dot-lvl1.tga", LLUUID::null, FALSE); 307 preloadUIImage("icn_active-speakers-dot-lvl0.tga", LLUUID::null, FALSE);
308 preloadImage("icn_active-speakers-dot-lvl2.tga", LLUUID::null, FALSE); 308 preloadUIImage("icn_active-speakers-dot-lvl1.tga", LLUUID::null, FALSE);
309 preloadImage("icn_active-speakers-typing1.tga", LLUUID::null, FALSE); 309 preloadUIImage("icn_active-speakers-dot-lvl2.tga", LLUUID::null, FALSE);
310 preloadImage("icn_active-speakers-typing2.tga", LLUUID::null, FALSE); 310 preloadUIImage("icn_active-speakers-typing1.tga", LLUUID::null, FALSE);
311 preloadImage("icn_active-speakers-typing3.tga", LLUUID::null, FALSE); 311 preloadUIImage("icn_active-speakers-typing2.tga", LLUUID::null, FALSE);
312 preloadImage("icn_voice_ptt-off.tga", LLUUID::null, FALSE); 312 preloadUIImage("icn_active-speakers-typing3.tga", LLUUID::null, FALSE);
313 preloadImage("icn_voice_ptt-on.tga", LLUUID::null, FALSE); 313 preloadUIImage("icn_voice_ptt-off.tga", LLUUID::null, FALSE);
314 preloadImage("icn_voice_ptt-on-lvl1.tga", LLUUID::null, FALSE); 314 preloadUIImage("icn_voice_ptt-on.tga", LLUUID::null, FALSE);
315 preloadImage("icn_voice_ptt-on-lvl2.tga", LLUUID::null, FALSE); 315 preloadUIImage("icn_voice_ptt-on-lvl1.tga", LLUUID::null, FALSE);
316 preloadImage("icn_voice_ptt-on-lvl3.tga", LLUUID::null, FALSE); 316 preloadUIImage("icn_voice_ptt-on-lvl2.tga", LLUUID::null, FALSE);
317 preloadImage("lag_status_good.tga", LLUUID::null, FALSE); 317 preloadUIImage("icn_voice_ptt-on-lvl3.tga", LLUUID::null, FALSE);
318 preloadImage("lag_status_warning.tga", LLUUID::null, FALSE); 318 preloadUIImage("lag_status_good.tga", LLUUID::null, FALSE);
319 preloadImage("lag_status_critical.tga", LLUUID::null, FALSE); 319 preloadUIImage("lag_status_warning.tga", LLUUID::null, FALSE);
320 preloadUIImage("lag_status_critical.tga", LLUUID::null, FALSE);
321 preloadUIImage("icn_voice-call-end.tga", LLUUID::null, FALSE);
322 preloadUIImage("icn_voice-call-start.tga", LLUUID::null, FALSE);
323 preloadUIImage("mute_icon.tga", LLUUID::null, FALSE);
324 preloadUIImage("icn-overlay_volume-panel.tga", LLUUID::null, FALSE);
325 preloadUIImage("icn_slide-groove_dark.tga", LLUUID::null, FALSE);
326 preloadUIImage("icn_slide-highlight.tga", LLUUID::null, FALSE);
327 preloadUIImage("icn_slide-thumb_dark.tga", LLUUID::null, FALSE);
328 preloadUIImage("icn_speaker-muted_dark.tga", LLUUID::null, FALSE);
329 preloadUIImage("icn_speaker_dark.tga", LLUUID::null, FALSE);
330 preloadUIImage("icn_voice-localchat.tga", LLUUID::null, FALSE);
331 preloadUIImage("icn_voice-groupfocus.tga", LLUUID::null, FALSE);
332 preloadUIImage("icn_voice-pvtfocus.tga", LLUUID::null, FALSE);
333 preloadUIImage("icn_media-pause.tga", LLUUID::null, FALSE);
334 preloadUIImage("icn_media-play.tga", LLUUID::null, FALSE);
335 preloadUIImage("icn_music-play.tga", LLUUID::null, FALSE);
336 preloadUIImage("icn_music-pause.tga", LLUUID::null, FALSE);
337 preloadUIImage("icn_chatbar.tga", LLUUID::null, FALSE);
338 preloadUIImage("btn_chatbar.tga", LLUUID::null, FALSE, LLRectf(0.5f, 0.5f, 0.5f, 0.5f));
339 preloadUIImage("btn_chatbar_selected.tga", LLUUID::null, FALSE, LLRectf(0.5f, 0.5f, 0.5f, 0.5f));
340 preloadUIImage("icn_rounded-text-field.tga", LLUUID::null, FALSE);
341 preloadUIImage("flyout_btn_right_selected.tga", LLUUID::null, FALSE, LLRectf(0.125f, 0.5f, 0.2f, 0.5f));
342 preloadUIImage("flyout_btn_right.tga", LLUUID::null, FALSE, LLRectf(0.125f, 0.5f, 0.2f, 0.5f));
343 preloadUIImage("flyout_btn_left_selected.tga", LLUUID::null, FALSE, LLRectf(0.8f, 0.5f, 0.875f, 0.5f));
344 preloadUIImage("flyout_btn_left.tga", LLUUID::null, FALSE, LLRectf(0.8f, 0.5f, 0.875f, 0.5f));
320} 345}
321 346
322static std::string get_texture_list_name() 347static std::string get_texture_list_name()
@@ -354,7 +379,7 @@ void LLViewerImageList::doPrefetchImages()
354 image->addTextureStats((F32)pixel_area); 379 image->addTextureStats((F32)pixel_area);
355 } 380 }
356 } 381 }
357 382
358 383
359} 384}
360 385
@@ -400,7 +425,7 @@ void LLViewerImageList::shutdown()
400 if (++count >= max_count) 425 if (++count >= max_count)
401 break; 426 break;
402 } 427 }
403 428
404 if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty()) 429 if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty())
405 { 430 {
406 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); 431 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name());
@@ -416,14 +441,14 @@ void LLViewerImageList::shutdown()
416 mIRCallbackData.clear(); 441 mIRCallbackData.clear();
417 442
418 // Clean up preloaded images 443 // Clean up preloaded images
419 mPreloadedImages.clear(); 444 mUIImages.clear();
420 445
421 // Flush all of the references 446 // Flush all of the references
422 mLoadingStreamList.clear(); 447 mLoadingStreamList.clear();
423 mCreateTextureList.clear(); 448 mCreateTextureList.clear();
424 449
425 mUUIDMap.clear(); 450 mUUIDMap.clear();
426 451
427 mImageList.clear(); 452 mImageList.clear();
428} 453}
429 454
@@ -433,14 +458,14 @@ void LLViewerImageList::dump()
433 for (image_priority_list_t::iterator it = mImageList.begin(); it != mImageList.end(); ++it) 458 for (image_priority_list_t::iterator it = mImageList.begin(); it != mImageList.end(); ++it)
434 { 459 {
435 LLViewerImage* image = *it; 460 LLViewerImage* image = *it;
436 461
437 llinfos << "priority " << image->getDecodePriority() 462 llinfos << "priority " << image->getDecodePriority()
438 << " boost " << image->getBoostLevel() 463 << " boost " << image->getBoostLevel()
439 << " size " << image->getWidth() << "x" << image->getHeight() 464 << " size " << image->getWidth() << "x" << image->getHeight()
440 << " discard " << image->getDiscardLevel() 465 << " discard " << image->getDiscardLevel()
441 << " desired " << image->getDesiredDiscardLevel() 466 << " desired " << image->getDesiredDiscardLevel()
442 << " http://asset.siva.lindenlab.com/" << image->getID() << ".texture" 467 << " http://asset.siva.lindenlab.com/" << image->getID() << ".texture"
443 << llendl; 468 << llendl;
444 } 469 }
445} 470}
446 471
@@ -455,13 +480,13 @@ void LLViewerImageList::restoreGL()
455} 480}
456 481
457/* Vertical tab container button image IDs 482/* Vertical tab container button image IDs
458Seem to not decode when running app in debug. 483 Seem to not decode when running app in debug.
459 484
460const LLUUID BAD_IMG_ONE("1097dcb3-aef9-8152-f471-431d840ea89e"); 485 const LLUUID BAD_IMG_ONE("1097dcb3-aef9-8152-f471-431d840ea89e");
461const LLUUID BAD_IMG_TWO("bea77041-5835-1661-f298-47e2d32b7a70"); 486 const LLUUID BAD_IMG_TWO("bea77041-5835-1661-f298-47e2d32b7a70");
462*/ 487 */
463 488
464LLImageGL* LLViewerImageList::getUIImageByID(const LLUUID& image_id, BOOL clamped) 489LLImageGL* LLViewerImageList::getImageByID(const LLUUID& image_id, BOOL clamped)
465{ 490{
466 LLViewerImage* imagep = getImage(image_id, MIPMAP_FALSE, TRUE); 491 LLViewerImage* imagep = getImage(image_id, MIPMAP_FALSE, TRUE);
467 // force a high resolution decode for all UI images (pulled this from LLTextEditor) 492 // force a high resolution decode for all UI images (pulled this from LLTextEditor)
@@ -470,17 +495,38 @@ LLImageGL* LLViewerImageList::getUIImageByID(const LLUUID& image_id, BOOL clampe
470 LLViewerImage::bindTexture(imagep); 495 LLViewerImage::bindTexture(imagep);
471 imagep->setClamp(clamped, clamped); 496 imagep->setClamp(clamped, clamped);
472 imagep->unbindTexture(0, GL_TEXTURE_2D); 497 imagep->unbindTexture(0, GL_TEXTURE_2D);
473 498
474 return (LLImageGL*)imagep; 499 return (LLImageGL*)imagep;
475} 500}
476 501
502LLUIImage* LLViewerImageList::getUIImageByID(const LLUUID& image_id, BOOL clamped)
503{
504 uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_id);
505 if (found_it != mUIImages.end())
506 {
507 return found_it->second;
508 }
509
510 // otherwise create new ui image wrapper
511 LLImageGL* image = getImageByID(image_id, clamped);
512 image->dontDiscard();
513 LLPointer<LLUIImage> new_imagep = new LLUIImage(image);
514 mUIImages.insert(std::make_pair(image_id, new_imagep));
515
516 return new_imagep;
517}
518
519
477/////////////////////////////////////////////////////////////////////////////// 520///////////////////////////////////////////////////////////////////////////////
478 521
479LLViewerImage* LLViewerImageList::preloadImage(const LLString& filename, const LLUUID &image_set_id, BOOL use_mips) 522LLViewerImage* LLViewerImageList::preloadUIImage(const LLString& filename, const LLUUID &image_set_id, BOOL use_mips, const LLRectf& scale_rect)
480{ 523{
481 LLViewerImage* image = getImage(filename, image_set_id, use_mips, TRUE); 524 LLViewerImage* image = getImage(filename, image_set_id, use_mips, TRUE);
482 image->dontDiscard(); 525 image->dontDiscard();
483 mPreloadedImages.push_back(image); 526 image->setClamp(TRUE, TRUE);
527 LLUIImage* ui_imagep = new LLUIImage(image);
528 ui_imagep->setScaleRegion(scale_rect);
529 mUIImages.insert(std::make_pair(image->getID(), LLPointer<LLUIImage>(ui_imagep)));
484 return image; 530 return image;
485} 531}
486 532
@@ -510,7 +556,7 @@ LLViewerImage* LLViewerImageList::getImageFromFile(const LLString& filename,
510 556
511 // Try to load an image from the skins directory. 557 // Try to load an image from the skins directory.
512 // Fall back to loading from the VFS if not found. 558 // Fall back to loading from the VFS if not found.
513 559
514 // First verify that the image exists in gViewerArt 560 // First verify that the image exists in gViewerArt
515 LLUUID image_id = LLUUID( gViewerArt.getString(filename.c_str()) ); 561 LLUUID image_id = LLUUID( gViewerArt.getString(filename.c_str()) );
516 if (image_id.isNull()) 562 if (image_id.isNull())
@@ -534,7 +580,7 @@ LLViewerImage* LLViewerImageList::getImageFromFile(const LLString& filename,
534 return (getImage(IMG_DEFAULT, TRUE, TRUE)); 580 return (getImage(IMG_DEFAULT, TRUE, TRUE));
535 } 581 }
536 } 582 }
537 583
538 // Now that we have verified that filename exists, load it and assign it to 584 // Now that we have verified that filename exists, load it and assign it to
539 // the filename's UUID, or image_set_id if non null. 585 // the filename's UUID, or image_set_id if non null.
540 if (image_set_id.notNull()) 586 if (image_set_id.notNull())
@@ -545,7 +591,7 @@ LLViewerImage* LLViewerImageList::getImageFromFile(const LLString& filename,
545 // Load the image 591 // Load the image
546 LLViewerImage* imagep = getImageFromUUID(image_id, usemipmaps, level_immediate, 592 LLViewerImage* imagep = getImageFromUUID(image_id, usemipmaps, level_immediate,
547 internal_format, primary_format, LLHost()); 593 internal_format, primary_format, LLHost());
548 594
549 return imagep; 595 return imagep;
550} 596}
551 597
@@ -566,27 +612,27 @@ LLViewerImage* LLViewerImageList::getImageFromUUID(const LLUUID &image_id,
566 // Return the image with ID image_id 612 // Return the image with ID image_id
567 // If the image is not found, creates new image and 613 // If the image is not found, creates new image and
568 // enqueues a request for transmission 614 // enqueues a request for transmission
569 615
570 if ((&image_id == NULL) || image_id.isNull()) 616 if ((&image_id == NULL) || image_id.isNull())
571 { 617 {
572 return (getImage(IMG_DEFAULT, TRUE, TRUE)); 618 return (getImage(IMG_DEFAULT, TRUE, TRUE));
573 } 619 }
574 620
575 LLPointer<LLViewerImage> imagep = hasImage(image_id); 621 LLPointer<LLViewerImage> imagep = hasImage(image_id);
576 622
577 if (imagep.isNull()) 623 if (imagep.isNull())
578 { 624 {
579 imagep = new LLViewerImage(image_id, usemipmaps); 625 imagep = new LLViewerImage(image_id, usemipmaps);
580 // Might want to request from host other than where the agent is. JC 626 // Might want to request from host other than where the agent is. JC
581 imagep->setTargetHost(request_from_host); 627 imagep->setTargetHost(request_from_host);
582 628
583 if (internal_format && primary_format) 629 if (internal_format && primary_format)
584 { 630 {
585 imagep->setExplicitFormat(internal_format, primary_format); 631 imagep->setExplicitFormat(internal_format, primary_format);
586 } 632 }
587 633
588 addImage(imagep); 634 addImage(imagep);
589 635
590 if (level_immediate) 636 if (level_immediate)
591 { 637 {
592 imagep->dontDiscard(); 638 imagep->dontDiscard();
@@ -635,7 +681,7 @@ void LLViewerImageList::addImage(LLViewerImage *new_image)
635 return; 681 return;
636 } 682 }
637 LLUUID image_id = new_image->getID(); 683 LLUUID image_id = new_image->getID();
638 684
639 LLViewerImage *image = hasImage(image_id); 685 LLViewerImage *image = hasImage(image_id);
640 if (image) 686 if (image)
641 { 687 {
@@ -714,20 +760,20 @@ void LLViewerImageList::updateImages(F32 max_time)
714 sGLBoundMemStat.addValue(LLImageGL::sBoundTextureMemory/(1024.f*1024.f)); 760 sGLBoundMemStat.addValue(LLImageGL::sBoundTextureMemory/(1024.f*1024.f));
715 sRawMemStat.addValue(LLImageRaw::sGlobalRawMemory/(1024.f*1024.f)); 761 sRawMemStat.addValue(LLImageRaw::sGlobalRawMemory/(1024.f*1024.f));
716 sFormattedMemStat.addValue(LLImageFormatted::sGlobalFormattedMemory/(1024.f*1024.f)); 762 sFormattedMemStat.addValue(LLImageFormatted::sGlobalFormattedMemory/(1024.f*1024.f));
717 763
718 updateImagesDecodePriorities(); 764 updateImagesDecodePriorities();
719 max_time -= updateImagesFetchTextures(max_time); 765 max_time -= updateImagesFetchTextures(max_time);
720 max_time = llmax(max_time, 0.001f); 766 max_time = llmax(max_time, 0.001f);
721 max_time -= updateImagesCreateTextures(max_time); 767 max_time -= updateImagesCreateTextures(max_time);
722 max_time = llmax(max_time, 0.001f); 768 max_time = llmax(max_time, 0.001f);
723 769
724 if (!mDirtyTextureList.empty()) 770 if (!mDirtyTextureList.empty())
725 { 771 {
726 LLFastTimer t(LLFastTimer::FTM_IMAGE_MARK_DIRTY); 772 LLFastTimer t(LLFastTimer::FTM_IMAGE_MARK_DIRTY);
727 gPipeline.dirtyPoolObjectTextures(mDirtyTextureList); 773 gPipeline.dirtyPoolObjectTextures(mDirtyTextureList);
728 mDirtyTextureList.clear(); 774 mDirtyTextureList.clear();
729 } 775 }
730 776
731 for (image_list_t::iterator iter = mCallbackList.begin(); 777 for (image_list_t::iterator iter = mCallbackList.begin();
732 iter != mCallbackList.end(); ) 778 iter != mCallbackList.end(); )
733 { 779 {
@@ -760,7 +806,7 @@ void LLViewerImageList::updateImagesDecodePriorities()
760 mLastUpdateUUID = iter->first; 806 mLastUpdateUUID = iter->first;
761 LLPointer<LLViewerImage> imagep = iter->second; 807 LLPointer<LLViewerImage> imagep = iter->second;
762 ++iter; // safe to incrament now 808 ++iter; // safe to incrament now
763 809
764 // 810 //
765 // Flush formatted images using a lazy flush 811 // Flush formatted images using a lazy flush
766 // 812 //
@@ -802,31 +848,31 @@ void LLViewerImageList::updateImagesDecodePriorities()
802} 848}
803 849
804/* 850/*
805static U8 get_image_type(LLViewerImage* imagep, LLHost target_host) 851 static U8 get_image_type(LLViewerImage* imagep, LLHost target_host)
806{ 852 {
807 // Having a target host implies this is a baked image. I don't 853 // Having a target host implies this is a baked image. I don't
808 // believe that boost level has been set at this point. JC 854 // believe that boost level has been set at this point. JC
809 U8 type_from_host = (target_host.isOk() 855 U8 type_from_host = (target_host.isOk()
810 ? LLImageBase::TYPE_AVATAR_BAKE 856 ? LLImageBase::TYPE_AVATAR_BAKE
811 : LLImageBase::TYPE_NORMAL); 857 : LLImageBase::TYPE_NORMAL);
812 S32 boost_level = imagep->getBoostLevel(); 858 S32 boost_level = imagep->getBoostLevel();
813 U8 type_from_boost = ( (boost_level == LLViewerImage::BOOST_AVATAR_BAKED 859 U8 type_from_boost = ( (boost_level == LLViewerImage::BOOST_AVATAR_BAKED
814 || boost_level == LLViewerImage::BOOST_AVATAR_BAKED_SELF) 860 || boost_level == LLViewerImage::BOOST_AVATAR_BAKED_SELF)
815 ? LLImageBase::TYPE_AVATAR_BAKE 861 ? LLImageBase::TYPE_AVATAR_BAKE
816 : LLImageBase::TYPE_NORMAL); 862 : LLImageBase::TYPE_NORMAL);
817 if (type_from_host == LLImageBase::TYPE_NORMAL 863 if (type_from_host == LLImageBase::TYPE_NORMAL
818 && type_from_boost == LLImageBase::TYPE_AVATAR_BAKE) 864 && type_from_boost == LLImageBase::TYPE_AVATAR_BAKE)
819 { 865 {
820 llwarns << "TAT: get_image_type() type_from_host doesn't match type_from_boost" 866 llwarns << "TAT: get_image_type() type_from_host doesn't match type_from_boost"
821 << " host " << target_host 867 << " host " << target_host
822 << " boost " << imagep->getBoostLevel() 868 << " boost " << imagep->getBoostLevel()
823 << " imageid " << imagep->getID() 869 << " imageid " << imagep->getID()
824 << llendl; 870 << llendl;
825 imagep->dump(); 871 imagep->dump();
826 } 872 }
827 return type_from_host; 873 return type_from_host;
828} 874 }
829*/ 875 */
830 876
831F32 LLViewerImageList::updateImagesCreateTextures(F32 max_time) 877F32 LLViewerImageList::updateImagesCreateTextures(F32 max_time)
832{ 878{
@@ -837,7 +883,7 @@ F32 LLViewerImageList::updateImagesCreateTextures(F32 max_time)
837 // decoded, but haven't been pushed into GL). 883 // decoded, but haven't been pushed into GL).
838 // 884 //
839 LLFastTimer t(LLFastTimer::FTM_IMAGE_CREATE); 885 LLFastTimer t(LLFastTimer::FTM_IMAGE_CREATE);
840 886
841 LLTimer create_timer; 887 LLTimer create_timer;
842 image_list_t::iterator enditer = mCreateTextureList.begin(); 888 image_list_t::iterator enditer = mCreateTextureList.begin();
843 for (image_list_t::iterator iter = mCreateTextureList.begin(); 889 for (image_list_t::iterator iter = mCreateTextureList.begin();
@@ -864,7 +910,7 @@ F32 LLViewerImageList::updateImagesFetchTextures(F32 max_time)
864 // Make a list with 32 high priority entries + 256 cycled entries 910 // Make a list with 32 high priority entries + 256 cycled entries
865 const size_t max_priority_count = 32; 911 const size_t max_priority_count = 32;
866 const size_t max_update_count = 256; 912 const size_t max_update_count = 256;
867 913
868 // 32 high priority entries 914 // 32 high priority entries
869 std::set<LLViewerImage*> entries; 915 std::set<LLViewerImage*> entries;
870 size_t update_counter = llmin(max_priority_count, mImageList.size()); 916 size_t update_counter = llmin(max_priority_count, mImageList.size());
@@ -890,13 +936,13 @@ F32 LLViewerImageList::updateImagesFetchTextures(F32 max_time)
890 ++iter2; 936 ++iter2;
891 update_counter--; 937 update_counter--;
892 } 938 }
893 939
894 S32 min_count = max_priority_count + max_update_count/4; 940 S32 min_count = max_priority_count + max_update_count/4;
895 for (std::set<LLViewerImage*>::iterator iter3 = entries.begin(); 941 for (std::set<LLViewerImage*>::iterator iter3 = entries.begin();
896 iter3 != entries.end(); ) 942 iter3 != entries.end(); )
897 { 943 {
898 LLPointer<LLViewerImage> imagep = *iter3++; 944 LLPointer<LLViewerImage> imagep = *iter3++;
899 945
900 imagep->updateFetch(); 946 imagep->updateFetch();
901 if (min_count <= 0 && image_op_timer.getElapsedTimeF32() > max_time) 947 if (min_count <= 0 && image_op_timer.getElapsedTimeF32() > max_time)
902 { 948 {
@@ -911,68 +957,68 @@ void LLViewerImageList::updateImagesMediaStreams()
911{ 957{
912 if (gNoRender || gGLManager.mIsDisabled) return; 958 if (gNoRender || gGLManager.mIsDisabled) return;
913 959
914 // update media stream if required 960 // update media stream if required
915 LLMediaEngine* media_engine = LLMediaEngine::getInstance(); 961 LLMediaEngine* media_engine = LLMediaEngine::getInstance();
916 if (media_engine) 962 if (media_engine)
963 {
964 if ( media_engine->update() )
917 { 965 {
918 if ( media_engine->update() ) 966 LLUUID media_uuid = media_engine->getImageUUID();
967 updateMovieImage(media_uuid, TRUE);
968 if (!media_uuid.isNull())
919 { 969 {
920 LLUUID media_uuid = media_engine->getImageUUID(); 970 LLViewerImage* viewerImage = getImage( media_uuid );
921 updateMovieImage(media_uuid, TRUE); 971 if( viewerImage )
922 if (!media_uuid.isNull())
923 { 972 {
924 LLViewerImage* viewerImage = getImage( media_uuid ); 973 LLMediaBase* renderer = media_engine->getMediaRenderer();
925 if( viewerImage ) 974 if ((renderer->getTextureWidth() != viewerImage->getWidth()) ||
975 (renderer->getTextureHeight() != viewerImage->getHeight()) ||
976 (renderer->getTextureDepth() != viewerImage->getComponents()) ||
977 (viewerImage->getHasGLTexture() == FALSE))
926 { 978 {
927 LLMediaBase* renderer = media_engine->getMediaRenderer(); 979 // destroy existing GL image
928 if ((renderer->getTextureWidth() != viewerImage->getWidth()) || 980 viewerImage->destroyGLTexture();
929 (renderer->getTextureHeight() != viewerImage->getHeight()) || 981
930 (renderer->getTextureDepth() != viewerImage->getComponents()) || 982 // set new size
931 (viewerImage->getHasGLTexture() == FALSE)) 983 viewerImage->setSize( renderer->getTextureWidth(),
932 { 984 renderer->getTextureHeight(),
933 // destroy existing GL image 985 renderer->getTextureDepth() );
934 viewerImage->destroyGLTexture(); 986
935 987 LLPointer<LLImageRaw> raw = new LLImageRaw(renderer->getTextureWidth(),
936 // set new size 988 renderer->getTextureHeight(),
937 viewerImage->setSize( renderer->getTextureWidth(), 989 renderer->getTextureDepth());
938 renderer->getTextureHeight(), 990 raw->clear(0x7f,0x7f,0x7f,0xff);
939 renderer->getTextureDepth() ); 991 viewerImage->createGLTexture(0, raw);
940
941 LLPointer<LLImageRaw> raw = new LLImageRaw(renderer->getTextureWidth(),
942 renderer->getTextureHeight(),
943 renderer->getTextureDepth());
944 raw->clear(0x7f,0x7f,0x7f,0xff);
945 viewerImage->createGLTexture(0, raw);
946 }
947
948 // Set the explicit format the instance wants
949 viewerImage->setExplicitFormat(renderer->getTextureFormatInternal(),
950 renderer->getTextureFormatPrimary(),
951 renderer->getTextureFormatType(),
952 renderer->getTextureFormatSwapBytes());
953 // This should be redundant, but just in case:
954 viewerImage->setUseMipMaps(FALSE);
955
956 LLImageRaw* rawImage = media_engine->getImageRaw();
957 if ( rawImage )
958 {
959 viewerImage->setSubImage(rawImage, 0, 0,
960 renderer->getMediaWidth(),
961 renderer->getMediaHeight());
962 }
963 } 992 }
964 else 993
994 // Set the explicit format the instance wants
995 viewerImage->setExplicitFormat(renderer->getTextureFormatInternal(),
996 renderer->getTextureFormatPrimary(),
997 renderer->getTextureFormatType(),
998 renderer->getTextureFormatSwapBytes());
999 // This should be redundant, but just in case:
1000 viewerImage->setUseMipMaps(FALSE);
1001
1002 LLImageRaw* rawImage = media_engine->getImageRaw();
1003 if ( rawImage )
965 { 1004 {
966 llwarns << "MediaEngine update unable to get viewer image for GL texture" << llendl; 1005 viewerImage->setSubImage(rawImage, 0, 0,
1006 renderer->getMediaWidth(),
1007 renderer->getMediaHeight());
967 } 1008 }
968 } 1009 }
969 } 1010 else
970 else 1011 {
971 { 1012 llwarns << "MediaEngine update unable to get viewer image for GL texture" << llendl;
972 LLUUID media_uuid = media_engine->getImageUUID(); 1013 }
973 updateMovieImage(media_uuid, FALSE);
974 } 1014 }
975 } 1015 }
1016 else
1017 {
1018 LLUUID media_uuid = media_engine->getImageUUID();
1019 updateMovieImage(media_uuid, FALSE);
1020 }
1021 }
976} 1022}
977 1023
978void LLViewerImageList::updateImagesUpdateStats() 1024void LLViewerImageList::updateImagesUpdateStats()
@@ -994,7 +1040,7 @@ void LLViewerImageList::decodeAllImages(F32 max_time)
994{ 1040{
995 LLTimer timer; 1041 LLTimer timer;
996 if(gNoRender) return; 1042 if(gNoRender) return;
997 1043
998 // Update texture stats and priorities 1044 // Update texture stats and priorities
999 std::vector<LLPointer<LLViewerImage> > image_list; 1045 std::vector<LLPointer<LLViewerImage> > image_list;
1000 for (image_priority_list_t::iterator iter = mImageList.begin(); 1046 for (image_priority_list_t::iterator iter = mImageList.begin();
@@ -1046,11 +1092,11 @@ void LLViewerImageList::decodeAllImages(F32 max_time)
1046 max_time -= timer.getElapsedTimeF32(); 1092 max_time -= timer.getElapsedTimeF32();
1047 max_time = llmax(max_time, .01f); 1093 max_time = llmax(max_time, .01f);
1048 F32 create_time = updateImagesCreateTextures(max_time); 1094 F32 create_time = updateImagesCreateTextures(max_time);
1049 1095
1050 llinfos << "decodeAllImages() took " << timer.getElapsedTimeF32() << " seconds. " 1096 llinfos << "decodeAllImages() took " << timer.getElapsedTimeF32() << " seconds. "
1051 << " fetch_pending " << fetch_pending 1097 << " fetch_pending " << fetch_pending
1052 << " create_time " << create_time 1098 << " create_time " << create_time
1053 << llendl; 1099 << llendl;
1054} 1100}
1055 1101
1056 1102
@@ -1060,88 +1106,88 @@ BOOL LLViewerImageList::createUploadFile(const LLString& filename,
1060{ 1106{
1061 // First, load the image. 1107 // First, load the image.
1062 LLPointer<LLImageRaw> raw_image = new LLImageRaw; 1108 LLPointer<LLImageRaw> raw_image = new LLImageRaw;
1063 1109
1064 switch (codec) 1110 switch (codec)
1065 { 1111 {
1066 case IMG_CODEC_BMP: 1112 case IMG_CODEC_BMP:
1067 { 1113 {
1068 LLPointer<LLImageBMP> bmp_image = new LLImageBMP; 1114 LLPointer<LLImageBMP> bmp_image = new LLImageBMP;
1069 1115
1070 if (!bmp_image->load(filename)) 1116 if (!bmp_image->load(filename))
1071 { 1117 {
1072 return FALSE; 1118 return FALSE;
1073 } 1119 }
1074 1120
1075 if (!bmp_image->decode(raw_image)) 1121 if (!bmp_image->decode(raw_image))
1076 { 1122 {
1077 return FALSE; 1123 return FALSE;
1078 } 1124 }
1079 } 1125 }
1080 break; 1126 break;
1081 case IMG_CODEC_TGA: 1127 case IMG_CODEC_TGA:
1082 { 1128 {
1083 LLPointer<LLImageTGA> tga_image = new LLImageTGA; 1129 LLPointer<LLImageTGA> tga_image = new LLImageTGA;
1084 1130
1085 if (!tga_image->load(filename)) 1131 if (!tga_image->load(filename))
1086 { 1132 {
1087 return FALSE; 1133 return FALSE;
1088 } 1134 }
1089 1135
1090 if (!tga_image->decode(raw_image)) 1136 if (!tga_image->decode(raw_image))
1091 { 1137 {
1092 return FALSE; 1138 return FALSE;
1093 } 1139 }
1094 1140
1095 if( (tga_image->getComponents() != 3) && 1141 if( (tga_image->getComponents() != 3) &&
1096 (tga_image->getComponents() != 4) ) 1142 (tga_image->getComponents() != 4) )
1097 { 1143 {
1098 tga_image->setLastError( "Image files with less than 3 or more than 4 components are not supported." ); 1144 tga_image->setLastError( "Image files with less than 3 or more than 4 components are not supported." );
1099 return FALSE; 1145 return FALSE;
1100 } 1146 }
1101 } 1147 }
1102 break; 1148 break;
1103 case IMG_CODEC_JPEG: 1149 case IMG_CODEC_JPEG:
1104 { 1150 {
1105 LLPointer<LLImageJPEG> jpeg_image = new LLImageJPEG; 1151 LLPointer<LLImageJPEG> jpeg_image = new LLImageJPEG;
1106 1152
1107 if (!jpeg_image->load(filename)) 1153 if (!jpeg_image->load(filename))
1108 { 1154 {
1109 return FALSE; 1155 return FALSE;
1110 } 1156 }
1111 1157
1112 if (!jpeg_image->decode(raw_image)) 1158 if (!jpeg_image->decode(raw_image))
1113 { 1159 {
1114 return FALSE; 1160 return FALSE;
1115 } 1161 }
1116 } 1162 }
1117 break; 1163 break;
1118 case IMG_CODEC_PNG: 1164 case IMG_CODEC_PNG:
1119 { 1165 {
1120 LLPointer<LLImagePNG> png_image = new LLImagePNG; 1166 LLPointer<LLImagePNG> png_image = new LLImagePNG;
1121 1167
1122 if (!png_image->load(filename)) 1168 if (!png_image->load(filename))
1123 { 1169 {
1124 return FALSE; 1170 return FALSE;
1125 } 1171 }
1126 1172
1127 if (!png_image->decode(raw_image)) 1173 if (!png_image->decode(raw_image))
1128 { 1174 {
1129 return FALSE; 1175 return FALSE;
1130 } 1176 }
1131 } 1177 }
1132 break; 1178 break;
1133 default: 1179 default:
1134 return FALSE; 1180 return FALSE;
1135 } 1181 }
1136 1182
1137 LLPointer<LLImageJ2C> compressedImage = convertToUploadFile(raw_image); 1183 LLPointer<LLImageJ2C> compressedImage = convertToUploadFile(raw_image);
1138 1184
1139 if( !compressedImage->save(out_filename) ) 1185 if( !compressedImage->save(out_filename) )
1140 { 1186 {
1141 llinfos << "Couldn't create output file " << out_filename << llendl; 1187 llinfos << "Couldn't create output file " << out_filename << llendl;
1142 return FALSE; 1188 return FALSE;
1143 } 1189 }
1144 1190
1145 // test to see if the encode and save worked. 1191 // test to see if the encode and save worked.
1146 LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C; 1192 LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
1147 if( !integrity_test->loadAndValidate( out_filename ) ) 1193 if( !integrity_test->loadAndValidate( out_filename ) )
@@ -1149,7 +1195,7 @@ BOOL LLViewerImageList::createUploadFile(const LLString& filename,
1149 llinfos << "Image: " << out_filename << " is corrupt." << llendl; 1195 llinfos << "Image: " << out_filename << " is corrupt." << llendl;
1150 return FALSE; 1196 return FALSE;
1151 } 1197 }
1152 1198
1153 return TRUE; 1199 return TRUE;
1154} 1200}
1155 1201
@@ -1166,7 +1212,7 @@ LLPointer<LLImageJ2C> LLViewerImageList::convertToUploadFile(LLPointer<LLImageRa
1166 compressedImage->setReversible(TRUE); 1212 compressedImage->setReversible(TRUE);
1167 1213
1168 compressedImage->encode(raw_image); 1214 compressedImage->encode(raw_image);
1169 1215
1170 return compressedImage; 1216 return compressedImage;
1171} 1217}
1172 1218
@@ -1175,7 +1221,7 @@ S32 LLViewerImageList::getMaxVideoRamSetting(S32 max)
1175{ 1221{
1176 const U32 vram_settings[] = { 16, 32, 64, 128, 256, 512 }; 1222 const U32 vram_settings[] = { 16, 32, 64, 128, 256, 512 };
1177 const S32 num_vram_settings = sizeof(vram_settings) / sizeof(vram_settings[0]); 1223 const S32 num_vram_settings = sizeof(vram_settings) / sizeof(vram_settings[0]);
1178 1224
1179 U32 max_vram; 1225 U32 max_vram;
1180 if (gGLManager.mVRAM != 0) 1226 if (gGLManager.mVRAM != 0)
1181 { 1227 {
@@ -1203,7 +1249,7 @@ S32 LLViewerImageList::getMaxVideoRamSetting(S32 max)
1203 { 1249 {
1204 max_vram = llmin(max_vram, (U32)((F32)system_ram/1.5f)); 1250 max_vram = llmin(max_vram, (U32)((F32)system_ram/1.5f));
1205 } 1251 }
1206 1252
1207 S32 idx; 1253 S32 idx;
1208 for (idx=0; idx < num_vram_settings; idx++) 1254 for (idx=0; idx < num_vram_settings; idx++)
1209 { 1255 {
@@ -1215,22 +1261,22 @@ S32 LLViewerImageList::getMaxVideoRamSetting(S32 max)
1215 break; 1261 break;
1216 } 1262 }
1217 } 1263 }
1218 1264
1219 if( idx == num_vram_settings ) 1265 if( idx == num_vram_settings )
1220 { 1266 {
1221 idx = num_vram_settings - 1; 1267 idx = num_vram_settings - 1;
1222 } 1268 }
1223 1269
1224 return idx; 1270 return idx;
1225} 1271}
1226 1272
1227const S32 VIDEO_CARD_MEM_SIZES[6] = { 0x1000000, // 16MB 1273const S32 VIDEO_CARD_MEM_SIZES[6] = { 0x1000000, // 16MB
1228 0x2000000, // 32MB 1274 0x2000000, // 32MB
1229 0x4000000, // 64MB 1275 0x4000000, // 64MB
1230 0x8000000, // 128MB 1276 0x8000000, // 128MB
1231 0x10000000, // 256MB 1277 0x10000000, // 256MB
1232 0x20000000, // 512MB 1278 0x20000000, // 512MB
1233 }; 1279};
1234 1280
1235const S32 VIDEO_CARD_FRAMEBUFFER_MEM = 0xC00000; // 12MB 1281const S32 VIDEO_CARD_FRAMEBUFFER_MEM = 0xC00000; // 12MB
1236 1282
@@ -1257,13 +1303,13 @@ void LLViewerImageList::updateMaxResidentTexMem(S32 max, U32 fudge)
1257 mVideoMemorySetting = cur_setting; 1303 mVideoMemorySetting = cur_setting;
1258 // TODO: set available resident texture mem based on use by other subsystems 1304 // TODO: set available resident texture mem based on use by other subsystems
1259 // currently max(12MB, VRAM/4) assumed... 1305 // currently max(12MB, VRAM/4) assumed...
1260 1306
1261 S32 vram_amt = VIDEO_CARD_MEM_SIZES[cur_setting]; 1307 S32 vram_amt = VIDEO_CARD_MEM_SIZES[cur_setting];
1262 S32 fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vram_amt/4); 1308 S32 fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vram_amt/4);
1263 mMaxResidentTexMem = vram_amt - fb_mem - fudge; 1309 mMaxResidentTexMem = vram_amt - fb_mem - fudge;
1264 1310
1265// llinfos << "Graphics Card memory set to " << (VIDEO_CARD_MEM_SIZES[cur_setting]>>20) 1311 // llinfos << "Graphics Card memory set to " << (VIDEO_CARD_MEM_SIZES[cur_setting]>>20)
1266// << " MB" << llendl; 1312 // << " MB" << llendl;
1267} 1313}
1268 1314
1269/////////////////////////////////////////////////////////////////////////////// 1315///////////////////////////////////////////////////////////////////////////////
@@ -1272,15 +1318,15 @@ void LLViewerImageList::updateMaxResidentTexMem(S32 max, U32 fudge)
1272void LLViewerImageList::receiveImageHeader(LLMessageSystem *msg, void **user_data) 1318void LLViewerImageList::receiveImageHeader(LLMessageSystem *msg, void **user_data)
1273{ 1319{
1274 LLFastTimer t(LLFastTimer::FTM_PROCESS_IMAGES); 1320 LLFastTimer t(LLFastTimer::FTM_PROCESS_IMAGES);
1275 1321
1276 // Receive image header, copy into image object and decompresses 1322 // Receive image header, copy into image object and decompresses
1277 // if this is a one-packet image. 1323 // if this is a one-packet image.
1278 1324
1279 LLUUID id; 1325 LLUUID id;
1280 1326
1281 char ip_string[256]; 1327 char ip_string[256];
1282 u32_to_ip_string(msg->getSenderIP(),ip_string); 1328 u32_to_ip_string(msg->getSenderIP(),ip_string);
1283 1329
1284 if (msg->getReceiveCompressedSize()) 1330 if (msg->getReceiveCompressedSize())
1285 { 1331 {
1286 gImageList.sTextureBits += msg->getReceiveCompressedSize() * 8; 1332 gImageList.sTextureBits += msg->getReceiveCompressedSize() * 8;
@@ -1290,7 +1336,7 @@ void LLViewerImageList::receiveImageHeader(LLMessageSystem *msg, void **user_dat
1290 gImageList.sTextureBits += msg->getReceiveSize() * 8; 1336 gImageList.sTextureBits += msg->getReceiveSize() * 8;
1291 } 1337 }
1292 gImageList.sTexturePackets++; 1338 gImageList.sTexturePackets++;
1293 1339
1294 U8 codec; 1340 U8 codec;
1295 U16 packets; 1341 U16 packets;
1296 U32 totalbytes; 1342 U32 totalbytes;
@@ -1298,7 +1344,7 @@ void LLViewerImageList::receiveImageHeader(LLMessageSystem *msg, void **user_dat
1298 msg->getU8Fast(_PREHASH_ImageID, _PREHASH_Codec, codec); 1344 msg->getU8Fast(_PREHASH_ImageID, _PREHASH_Codec, codec);
1299 msg->getU16Fast(_PREHASH_ImageID, _PREHASH_Packets, packets); 1345 msg->getU16Fast(_PREHASH_ImageID, _PREHASH_Packets, packets);
1300 msg->getU32Fast(_PREHASH_ImageID, _PREHASH_Size, totalbytes); 1346 msg->getU32Fast(_PREHASH_ImageID, _PREHASH_Size, totalbytes);
1301 1347
1302 S32 data_size = msg->getSizeFast(_PREHASH_ImageData, _PREHASH_Data); 1348 S32 data_size = msg->getSizeFast(_PREHASH_ImageData, _PREHASH_Data);
1303 if (!data_size) 1349 if (!data_size)
1304 { 1350 {
@@ -1309,14 +1355,14 @@ void LLViewerImageList::receiveImageHeader(LLMessageSystem *msg, void **user_dat
1309 // msg->getSizeFast() is probably trying to tell us there 1355 // msg->getSizeFast() is probably trying to tell us there
1310 // was an error. 1356 // was an error.
1311 llerrs << "image header chunk size was negative: " 1357 llerrs << "image header chunk size was negative: "
1312 << data_size << llendl; 1358 << data_size << llendl;
1313 return; 1359 return;
1314 } 1360 }
1315 1361
1316 // this buffer gets saved off in the packet list 1362 // this buffer gets saved off in the packet list
1317 U8 *data = new U8[data_size]; 1363 U8 *data = new U8[data_size];
1318 msg->getBinaryDataFast(_PREHASH_ImageData, _PREHASH_Data, data, data_size); 1364 msg->getBinaryDataFast(_PREHASH_ImageData, _PREHASH_Data, data, data_size);
1319 1365
1320 LLViewerImage *image = gImageList.getImage(id); 1366 LLViewerImage *image = gImageList.getImage(id);
1321 if (!image) 1367 if (!image)
1322 { 1368 {
@@ -1339,13 +1385,13 @@ void LLViewerImageList::receiveImagePacket(LLMessageSystem *msg, void **user_dat
1339 1385
1340 // Receives image packet, copy into image object, 1386 // Receives image packet, copy into image object,
1341 // checks if all packets received, decompresses if so. 1387 // checks if all packets received, decompresses if so.
1342 1388
1343 LLUUID id; 1389 LLUUID id;
1344 U16 packet_num; 1390 U16 packet_num;
1345 1391
1346 char ip_string[256]; 1392 char ip_string[256];
1347 u32_to_ip_string(msg->getSenderIP(),ip_string); 1393 u32_to_ip_string(msg->getSenderIP(),ip_string);
1348 1394
1349 if (msg->getReceiveCompressedSize()) 1395 if (msg->getReceiveCompressedSize())
1350 { 1396 {
1351 gImageList.sTextureBits += msg->getReceiveCompressedSize() * 8; 1397 gImageList.sTextureBits += msg->getReceiveCompressedSize() * 8;
@@ -1355,12 +1401,12 @@ void LLViewerImageList::receiveImagePacket(LLMessageSystem *msg, void **user_dat
1355 gImageList.sTextureBits += msg->getReceiveSize() * 8; 1401 gImageList.sTextureBits += msg->getReceiveSize() * 8;
1356 } 1402 }
1357 gImageList.sTexturePackets++; 1403 gImageList.sTexturePackets++;
1358 1404
1359 //llprintline("Start decode, image header..."); 1405 //llprintline("Start decode, image header...");
1360 msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, id); 1406 msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, id);
1361 msg->getU16Fast(_PREHASH_ImageID, _PREHASH_Packet, packet_num); 1407 msg->getU16Fast(_PREHASH_ImageID, _PREHASH_Packet, packet_num);
1362 S32 data_size = msg->getSizeFast(_PREHASH_ImageData, _PREHASH_Data); 1408 S32 data_size = msg->getSizeFast(_PREHASH_ImageData, _PREHASH_Data);
1363 1409
1364 if (!data_size) 1410 if (!data_size)
1365 { 1411 {
1366 return; 1412 return;
@@ -1370,7 +1416,7 @@ void LLViewerImageList::receiveImagePacket(LLMessageSystem *msg, void **user_dat
1370 // msg->getSizeFast() is probably trying to tell us there 1416 // msg->getSizeFast() is probably trying to tell us there
1371 // was an error. 1417 // was an error.
1372 llerrs << "image data chunk size was negative: " 1418 llerrs << "image data chunk size was negative: "
1373 << data_size << llendl; 1419 << data_size << llendl;
1374 return; 1420 return;
1375 } 1421 }
1376 if (data_size > MTUBYTES) 1422 if (data_size > MTUBYTES)
@@ -1380,7 +1426,7 @@ void LLViewerImageList::receiveImagePacket(LLMessageSystem *msg, void **user_dat
1380 } 1426 }
1381 U8 *data = new U8[data_size]; 1427 U8 *data = new U8[data_size];
1382 msg->getBinaryDataFast(_PREHASH_ImageData, _PREHASH_Data, data, data_size); 1428 msg->getBinaryDataFast(_PREHASH_ImageData, _PREHASH_Data, data, data_size);
1383 1429
1384 LLViewerImage *image = gImageList.getImage(id); 1430 LLViewerImage *image = gImageList.getImage(id);
1385 if (!image) 1431 if (!image)
1386 { 1432 {
@@ -1403,7 +1449,7 @@ void LLViewerImageList::processImageNotInDatabase(LLMessageSystem *msg,void **us
1403 LLFastTimer t(LLFastTimer::FTM_PROCESS_IMAGES); 1449 LLFastTimer t(LLFastTimer::FTM_PROCESS_IMAGES);
1404 LLUUID image_id; 1450 LLUUID image_id;
1405 msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, image_id); 1451 msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, image_id);
1406 1452
1407 LLViewerImage* image = gImageList.hasImage( image_id ); 1453 LLViewerImage* image = gImageList.hasImage( image_id );
1408 if( image ) 1454 if( image )
1409 { 1455 {
@@ -1422,10 +1468,10 @@ S32 LLViewerImageList::calcMaxTextureRAM()
1422 U32 available_memory = memory_info.getPhysicalMemoryClamped(); 1468 U32 available_memory = memory_info.getPhysicalMemoryClamped();
1423 1469
1424 clamp_rescale((F32)available_memory, 1470 clamp_rescale((F32)available_memory,
1425 (F32)(SIXTEEN_MEG * 16), 1471 (F32)(SIXTEEN_MEG * 16),
1426 (F32)U32_MAX, 1472 (F32)U32_MAX,
1427 (F32)(SIXTEEN_MEG * 4), 1473 (F32)(SIXTEEN_MEG * 4),
1428 (F32)(U32_MAX >> 1)); 1474 (F32)(U32_MAX >> 1));
1429 return available_memory; 1475 return available_memory;
1430} 1476}
1431 1477