OLD | NEW |
1 /* | 1 /* |
2 Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. | 2 Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. |
3 All Rights Reserved. | 3 All Rights Reserved. |
4 | 4 |
5 Redistribution and use in source and binary forms, with or without | 5 Redistribution and use in source and binary forms, with or without |
6 modification, are permitted provided that the following conditions are | 6 modification, are permitted provided that the following conditions are |
7 met: | 7 met: |
8 * Redistributions of source code must retain the above copyright | 8 * Redistributions of source code must retain the above copyright |
9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
10 * Redistributions in binary form must reproduce the above copyright | 10 * Redistributions in binary form must reproduce the above copyright |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 namespace pvt { // OSL::pvt | 120 namespace pvt { // OSL::pvt |
121 | 121 |
122 | 122 |
123 | 123 |
124 ShadingSystemImpl::ShadingSystemImpl (RendererServices *renderer, | 124 ShadingSystemImpl::ShadingSystemImpl (RendererServices *renderer, |
125 TextureSystem *texturesystem, | 125 TextureSystem *texturesystem, |
126 ErrorHandler *err) | 126 ErrorHandler *err) |
127 : m_renderer(renderer), m_texturesys(texturesystem), m_err(err), | 127 : m_renderer(renderer), m_texturesys(texturesystem), m_err(err), |
128 m_statslevel (0), m_debug (false), m_lazylayers (true), | 128 m_statslevel (0), m_debug (false), m_lazylayers (true), |
129 m_clearmemory (false), | 129 m_clearmemory (false), m_rebind (false), |
130 m_commonspace_synonym("world"), | 130 m_commonspace_synonym("world"), |
131 m_in_group (false), | 131 m_in_group (false), |
132 m_global_heap_total (0) | 132 m_global_heap_total (0) |
133 { | 133 { |
134 m_stat_shaders_loaded = 0; | 134 m_stat_shaders_loaded = 0; |
135 m_stat_shaders_requested = 0; | 135 m_stat_shaders_requested = 0; |
136 m_stat_groups = 0; | 136 m_stat_groups = 0; |
137 m_stat_groupinstances = 0; | 137 m_stat_groupinstances = 0; |
138 m_stat_regexes = 0; | 138 m_stat_regexes = 0; |
139 m_layers_executed_uncond = 0; | 139 m_layers_executed_uncond = 0; |
140 m_layers_executed_lazy = 0; | 140 m_layers_executed_lazy = 0; |
141 m_layers_executed_never = 0; | 141 m_layers_executed_never = 0; |
| 142 m_stat_rebinds = 0; |
142 | 143 |
143 init_global_heap_offsets (); | 144 init_global_heap_offsets (); |
144 | 145 |
145 // If client didn't supply an error handler, just use the default | 146 // If client didn't supply an error handler, just use the default |
146 // one that echoes to the terminal. | 147 // one that echoes to the terminal. |
147 if (! m_err) { | 148 if (! m_err) { |
148 m_err = & ErrorHandler::default_handler (); | 149 m_err = & ErrorHandler::default_handler (); |
149 } | 150 } |
150 | 151 |
151 #if 0 | 152 #if 0 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 return true; | 197 return true; |
197 } | 198 } |
198 if (name == "lazylayers" && type == TypeDesc::INT) { | 199 if (name == "lazylayers" && type == TypeDesc::INT) { |
199 m_lazylayers = *(const int *)val; | 200 m_lazylayers = *(const int *)val; |
200 return true; | 201 return true; |
201 } | 202 } |
202 if (name == "clearmemory" && type == TypeDesc::INT) { | 203 if (name == "clearmemory" && type == TypeDesc::INT) { |
203 m_clearmemory = *(const int *)val; | 204 m_clearmemory = *(const int *)val; |
204 return true; | 205 return true; |
205 } | 206 } |
| 207 if (name == "rebind" && type == TypeDesc::INT) { |
| 208 m_rebind = *(const int *)val; |
| 209 return true; |
| 210 } |
206 if (name == "commonspace" && type == TypeDesc::STRING) { | 211 if (name == "commonspace" && type == TypeDesc::STRING) { |
207 m_commonspace_synonym = ustring (*(const char **)val); | 212 m_commonspace_synonym = ustring (*(const char **)val); |
208 return true; | 213 return true; |
209 } | 214 } |
210 return false; | 215 return false; |
211 } | 216 } |
212 | 217 |
213 | 218 |
214 | 219 |
215 bool | 220 bool |
(...skipping 14 matching lines...) Expand all Loading... |
230 return true; | 235 return true; |
231 } | 236 } |
232 if (name == "lazylayers" && type == TypeDesc::INT) { | 237 if (name == "lazylayers" && type == TypeDesc::INT) { |
233 *(int *)val = m_lazylayers; | 238 *(int *)val = m_lazylayers; |
234 return true; | 239 return true; |
235 } | 240 } |
236 if (name == "clearmemory" && type == TypeDesc::INT) { | 241 if (name == "clearmemory" && type == TypeDesc::INT) { |
237 *(int *)val = m_clearmemory; | 242 *(int *)val = m_clearmemory; |
238 return true; | 243 return true; |
239 } | 244 } |
| 245 if (name == "rebind" && type == TypeDesc::INT) { |
| 246 *(int *)val = m_rebind; |
| 247 return true; |
| 248 } |
240 return false; | 249 return false; |
241 } | 250 } |
242 | 251 |
243 | 252 |
244 | 253 |
245 void | 254 void |
246 ShadingSystemImpl::error (const char *format, ...) | 255 ShadingSystemImpl::error (const char *format, ...) |
247 { | 256 { |
248 va_list ap; | 257 va_list ap; |
249 va_start (ap, format); | 258 va_start (ap, format); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 out << Strutil::format (" Unconditional: %10lld (%.1f%%)\n", | 377 out << Strutil::format (" Unconditional: %10lld (%.1f%%)\n", |
369 (long long)m_layers_executed_uncond, | 378 (long long)m_layers_executed_uncond, |
370 (100.0*m_layers_executed_uncond)/totalexec); | 379 (100.0*m_layers_executed_uncond)/totalexec); |
371 out << Strutil::format (" On demand: %10lld (%.1f%%)\n", | 380 out << Strutil::format (" On demand: %10lld (%.1f%%)\n", |
372 (long long)m_layers_executed_lazy, | 381 (long long)m_layers_executed_lazy, |
373 (100.0*m_layers_executed_lazy)/totalexec); | 382 (100.0*m_layers_executed_lazy)/totalexec); |
374 out << Strutil::format (" Skipped: %10lld (%.1f%%)\n", | 383 out << Strutil::format (" Skipped: %10lld (%.1f%%)\n", |
375 (long long)m_layers_executed_never, | 384 (long long)m_layers_executed_never, |
376 (100.0*m_layers_executed_never)/totalexec); | 385 (100.0*m_layers_executed_never)/totalexec); |
377 | 386 |
| 387 out << Strutil::format (" Rebinds: %lld / %lld (%.1f%%)\n", |
| 388 (long long)m_stat_rebinds, totalexec, |
| 389 (100.0*m_stat_rebinds)/totalexec); |
| 390 |
378 out << " Regex's compiled: " << m_stat_regexes << "\n"; | 391 out << " Regex's compiled: " << m_stat_regexes << "\n"; |
379 | 392 |
380 return out.str(); | 393 return out.str(); |
381 } | 394 } |
382 | 395 |
383 | 396 |
384 | 397 |
385 void | 398 void |
386 ShadingSystemImpl::printstats () const | 399 ShadingSystemImpl::printstats () const |
387 { | 400 { |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 return f != m_global_heap_offsets.end() ? f->second : -1; | 788 return f != m_global_heap_offsets.end() ? f->second : -1; |
776 } | 789 } |
777 | 790 |
778 | 791 |
779 }; // namespace pvt | 792 }; // namespace pvt |
780 }; // namespace OSL | 793 }; // namespace OSL |
781 | 794 |
782 #ifdef OSL_NAMESPACE | 795 #ifdef OSL_NAMESPACE |
783 }; // end namespace OSL_NAMESPACE | 796 }; // end namespace OSL_NAMESPACE |
784 #endif | 797 #endif |
OLD | NEW |