rendering multiple resources
2 posters
rendering multiple resources
Hi,
I have about 60fps on emulator and about 35fps on device. I divided resources in two - level and player (I want to unload them independently). So, in camera render 3d I have sio2RenderResource(level) and sio2RenderResource(player) and... I have 20-25 fps on emulator and about 10-15fps on device - how can I avoid this problem? Also I made only one resource render and rendered player only with sio2Objectrender - I had about 25fps on device, but there is no sound and emitters binded to player. Anyway - if I remove player sound (alpitch depends from speed) I have about 10fps more. Am I killing device in some way or openAL is just slow and heavy?
Best regards,
Mad
I have about 60fps on emulator and about 35fps on device. I divided resources in two - level and player (I want to unload them independently). So, in camera render 3d I have sio2RenderResource(level) and sio2RenderResource(player) and... I have 20-25 fps on emulator and about 10-15fps on device - how can I avoid this problem? Also I made only one resource render and rendered player only with sio2Objectrender - I had about 25fps on device, but there is no sound and emitters binded to player. Anyway - if I remove player sound (alpitch depends from speed) I have about 10fps more. Am I killing device in some way or openAL is just slow and heavy?
Best regards,
Mad
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: rendering multiple resources
Interesting yet to profile with shark to check where is the bottleneck and post the result on this thread.
Re: rendering multiple resources
There You go - hope this is what You wanted (I'm not familiar with shark). Second session is only witch bgm and two resources. Third session with player sound and the last one is with one resource render. Recorded game process in simulator (can't find the way to record device behaviour).
And for clear camera loop:
And resource open...
And for clear camera loop:
- Code:
if(camera)
{
sio2WindowEnterLandscape3D();
{
sio2CameraRender( camera );
sio2CameraUpdateFrustum( camera );
sio2ResourceCull(flamenco, camera);
glDisable( GL_DEPTH_TEST );
glDepthMask( GL_FALSE );
{
skydome->dst = 1.0f;
sio2ObjectRender( skydome,
sio2->_SIO2window,
camera,
1, 1 );
skydome->_SIO2transform->rot->z += 0.1f;
sio2TransformBindMatrix(skydome->_SIO2transform);
skydome->dst = 0.0f;
}
glDepthMask( GL_TRUE );
glEnable( GL_DEPTH_TEST );
lights->dst = 1.0f;
sio2ObjectRender( lights,
sio2->_SIO2window,
camera,
1, 1 );
lights->dst = 0.0f;
sio2MistRender( _SIO2mist );
{
sio2LampEnableLight();
if(level_demo)
{
sio2ResourceRender(level_demo,
sio2->_SIO2window,
camera,
SIO2_RENDER_SOLID_OBJECT |
SIO2_RENDER_LAMP |
SIO2_RENDER_EMITTER |
SIO2_UPDATE_SOUND_STREAM);
sio2ObjectReset();
sio2MaterialReset();
}
if(flamenco)
{
sio2ResourceRender(flamenco,
sio2->_SIO2window,
camera,
SIO2_RENDER_SOLID_OBJECT |
SIO2_UPDATE_SOUND_STREAM |
SIO2_RENDER_EMITTER);
sio2ObjectReset();
sio2MaterialReset();
}
sio2LampResetLight();
}
sio2MistReset();
}
sio2WindowLeaveLandscape3D();
}
And resource open...
- Code:
if(menu)
{
sio2ResourceUnloadAll(menu);
sio2ResourceFree(menu);
}
unsigned int i = 0;
flamenco = sio2ResourceInit();
sio2ResourceCreateDictionary(flamenco);
sio2ResourceOpen( flamenco, "bolid_flamenco.sio2",1);
printf("\nSIO2: Bolid loaded!\n");
while( i != flamenco->gi.number_entry)
{
sio2ResourceExtract(flamenco, NULL);
++i;
}
i=0;
level_demo = sio2ResourceInit();
sio2ResourceCreateDictionary( level_demo );
sio2ResourceOpen( level_demo, "cypher_level.sio2",1);
printf("\nSIO2: Scene loaded!\n");
while( i != level_demo->gi.number_entry)
{
sio2ResourceExtract(level_demo, NULL);
++i;
}
sio2ResourceClose(level_demo);
sio2ResourceClose(flamenco);
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: rendering multiple resources
Dude that doesn't tell me anything at all... you really should post the shark output...
Re: rendering multiple resources
You mean... for example - this? I'm REALY newbie "programmer"
- Code:
# Report 2 - Session 2 - Time Profile of FlowOn
SharkProfileViewer
# Generated from the visible portion of the outline view
- 24.8%, DspFuncEQ::_equalizer(float*, float*, unsigned long), DspFuncLib
- 17.8%, NativeInt32ToFloat32_X86, AppleHDA
- 3.0%, AUEmbeddedStereoMixer::AssignConstantLevel1_x32toi16(AudioBufferList&, AudioBufferList&, unsigned long), AudioToolbox
- 2.0%, mutex_lock, mach_kernel
- 2.0%, ml_set_interrupts_enabled, mach_kernel
2.0%, lo_mach_scall, mach_kernel
- 2.0%, iokit_user_client_trap, IOKit
- 2.0%, IOA_HWTime::Update(double, bool&, bool&), CoreAudio
- 2.0%, AUConverterBase::RenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long), AudioToolbox
- 2.0%, AppleHDAPath::pinDefaultDeviceType(), AppleHDA
- 1.0%, user_trap, mach_kernel
- 1.0%, throttle_lowpri_io, mach_kernel
- 1.0%, semaphore_timedwait_signal_trap, libSystem.B.dylib
- 1.0%, RemoteIOClient::PerformIO(AudioTimeStamp const*, AudioTimeStamp const*, AudioBufferList*, unsigned int, bool), AudioToolbox
- 1.0%, OSMetaClassBase::safeMetaCast(OSMetaClassBase const*, OSMetaClass const*), mach_kernel
- 1.0%, OSArray::getObject(unsigned int) const, mach_kernel
- 1.0%, NativeInt16ToFloat32_X86, AudioToolbox
- 1.0%, memcpy, libSystem.B.dylib
- 1.0%, mach_msg, libSystem.B.dylib
- 1.0%, mach_absolute_time, libSystem.B.dylib
1.0%, lo_alltraps, mach_kernel
- 1.0%, IOService::getState() const, mach_kernel
- 1.0%, IORecursiveLockLock, mach_kernel
- 1.0%, IOHDAStream::getLinkPositionInBuffer(), IOHDAFamily
- 1.0%, IOAudioEngineUserClient::performClientInput(unsigned long, IOAudioClientBufferSet*), IOAudioFamily
- 1.0%, IOA_Time::GetCurrentTime(AudioTimeStamp&) const, CoreAudio
- 1.0%, IOA_SubDeviceList::UpdateTime(), CoreAudio
- 1.0%, IOA_SubDeviceList::HasTime() const, CoreAudio
- 1.0%, IOA_MultiDevice::GetCurrentTime(AudioTimeStamp&), CoreAudio
- 1.0%, IOA_HWDevice::WriteOutputData(unsigned long, unsigned long, unsigned long, unsigned long long), CoreAudio
- 1.0%, IOA_HWDevice::HasSection(bool) const, CoreAudio
- 1.0%, IOA_Device::CallIOProcs(AudioTimeStamp const&, AudioTimeStamp const&, AudioTimeStamp const&), CoreAudio
- 1.0%, DspParameter::getMetaClass() const, DspFuncLib
- 1.0%, DspFuncVolume::process(unsigned long, unsigned long), DspFuncLib
- 1.0%, DspFuncNoiseCanceller::getMetaClass() const, DspFuncLib
- 1.0%, DspFuncGain::_balanceAdjust(float*, float*, unsigned long), DspFuncLib
- 1.0%, DspFunc::getInputBuffer(unsigned long), DspFuncLib
- 1.0%, DspBuffer::getMetaClass() const, DspFuncLib
- 1.0%, current_thread, mach_kernel
- 1.0%, CAHostTimeBase::ConvertToNanos(unsigned long long), CoreAudio
- 1.0%, bcopy, mach_kernel
- 1.0%, AUHAL::PostProcessRenderedOutput(AudioTimeStamp const&, unsigned long, AudioBufferList&), AudioToolbox
- 1.0%, AUEmbeddedStereoMixer::RenderInput(unsigned long, unsigned long&, AudioTimeStamp const&, unsigned long, bool), AudioToolbox
- 1.0%, AUEmbeddedStereoMixer::Render(unsigned long&, AudioTimeStamp const&, unsigned long), AudioToolbox
- 1.0%, AudioConverterChain::CallInputProc(unsigned long), AudioToolbox
- 1.0%, AUBase::DoRender(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long, AudioBufferList&), AudioToolbox
- 1.0%, AQMEDevice::IO_PerformOutput(AudioBufferList&, AudioTimeStamp const&, unsigned long), AudioToolbox
- 1.0%, AppleHDAWidget::pinConfigDefault(), AppleHDA
- 1.0%, AppleHDAPathSet::pinDefaultDeviceType(), AppleHDA
- 1.0%, __spin_lock, libSystem.B.dylib
- 1.0%, __gnu_cxx::__normal_iterator<HP_Command**, std::vector<HP_Command*, std::allocator<HP_Command*> > > std::__copy_normal<true, true>::copy_n<__gnu_cxx::__normal_iterator<HP_Command**, std::vector<HP_Command*, std::allocator<HP_Command*> > >, __gnu_cxx::__normal_iterator<HP_Command**, std::vector<HP_Command*, std::allocator<HP_Command*> > > >(__gnu_cxx::__normal_iterator<HP_Command**, std::vector<HP_Command*, std::allocator<HP_Command*> > >, __gnu_cxx::__normal_iterator<HP_Command**, std::vector<HP_Command*, std::allocator<HP_Command*> > >, __gnu_cxx::__normal_iterator<HP_Command**, std::vector<HP_Command*, std::allocator<HP_Command*> > >), CoreAudio
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: rendering multiple resources
Ok, I found network/iphone setup. Selecting check box with my device, select target (my app), run app in xcode on device. Game is running, I'm clicking START in Shark and... nothing. Start is blue for a while and active again, status- Shared device is ready. WTF? Once it worked, but calculating remained about hour so I closed process. Processing with emulator works perfectly.
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: rendering multiple resources
Ok, after many restarts and updates it works.
Looks like problem with vorbis synthesis... Here are stressed areas in mdct_butterfly_generic, mdct_backward, vorbis_synthesis_blockin and vorbis_boock_decodevv_add:
Hope that's it.
Looks like problem with vorbis synthesis... Here are stressed areas in mdct_butterfly_generic, mdct_backward, vorbis_synthesis_blockin and vorbis_boock_decodevv_add:
- Code:
264 STIN void mdct_butterfly_generic(DATA_TYPE *T,
265 DATA_TYPE *x,
266 int points,
0.1% 267 int trigint){
268
0.3% 269 DATA_TYPE *x1 = x + points - 8;
0.3% 270 DATA_TYPE *x2 = x + (points>>1) - 8;
271 REG_TYPE r0;
272 REG_TYPE r1;
273
274 do{
275
3.2% 276 r0 = x1[6] - x2[6]; ! Unaligned loop start, LD/ST multiple
2.8% 277 r1 = x1[7] - x2[7]; ! LD/ST multiple
3.5% 278 x1[6] += x2[6]; ! LD/ST multiple
2.7% 279 x1[7] += x2[7]; ! LD/ST multiple
4.9% 280 x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]); ! LD/ST multiple
4.3% 281 x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]); ! LD/ST multiple
282
1.7% 283 T+=trigint;
284
3.8% 285 r0 = x1[4] - x2[4]; ! LD/ST multiple
4.2% 286 r1 = x1[5] - x2[5]; ! LD/ST multiple
3.3% 287 x1[4] += x2[4]; ! LD/ST multiple
3.3% 288 x1[5] += x2[5]; ! LD/ST multiple
5.2% 289 x2[4] = MULT_NORM(r1 * T[1] + r0 * T[0]); ! LD/ST multiple
4.8% 290 x2[5] = MULT_NORM(r1 * T[0] - r0 * T[1]); ! LD/ST multiple
291
1.6% 292 T+=trigint;
293
2.6% 294 r0 = x1[2] - x2[2]; ! LD/ST multiple
3.1% 295 r1 = x1[3] - x2[3]; ! LD/ST multiple
3.6% 296 x1[2] += x2[2]; ! LD/ST multiple
4.0% 297 x1[3] += x2[3]; ! LD/ST multiple
5.5% 298 x2[2] = MULT_NORM(r1 * T[1] + r0 * T[0]); ! LD/ST multiple
4.9% 299 x2[3] = MULT_NORM(r1 * T[0] - r0 * T[1]); ! LD/ST multiple
300
1.7% 301 T+=trigint;
302
2.5% 303 r0 = x1[0] - x2[0]; ! LD/ST multiple
3.3% 304 r1 = x1[1] - x2[1]; ! LD/ST multiple
2.6% 305 x1[0] += x2[0]; ! LD/ST multiple
2.8% 306 x1[1] += x2[1]; ! LD/ST multiple
5.0% 307 x2[0] = MULT_NORM(r1 * T[1] + r0 * T[0]); ! LD/ST multiple
4.6% 308 x2[1] = MULT_NORM(r1 * T[0] - r0 * T[1]); ! LD/ST multiple
309
1.8% 310 T+=trigint;
0.6% 311 x1-=8;
0.6% 312 x2-=8;
313
0.6% 314 }while(x2>=x);
0.1% 315 }
- Code:
0.1% 397 void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
398 int n=init->n;
399 int n2=n>>1;
400 int n4=n>>2;
401
402 /* rotate */
403
0.1% 404 DATA_TYPE *iX = in+n2-7;
0.1% 405 DATA_TYPE *oX = out+n2+n4;
406 DATA_TYPE *T = init->trig+n4;
407
408 do{
0.4% 409 oX -= 4; ! Unaligned loop start
9.0% 410 oX[0] = MULT_NORM(-iX[2] * T[3] - iX[0] * T[2]); ! LD/ST multiple
4.0% 411 oX[1] = MULT_NORM (iX[0] * T[3] - iX[2] * T[2]); ! LD/ST multiple
4.6% 412 oX[2] = MULT_NORM(-iX[6] * T[1] - iX[4] * T[0]); ! LD/ST multiple
4.2% 413 oX[3] = MULT_NORM (iX[4] * T[1] - iX[6] * T[0]); ! LD/ST multiple
0.8% 414 iX -= 8;
0.4% 415 T += 4;
0.3% 416 }while(iX>=in);
417
0.0% 418 iX = in+n2-8;
0.1% 419 oX = out+n2+n4;
0.1% 420 T = init->trig+n4;
421
422 do{
0.3% 423 T -= 4; ! Unaligned loop start
5.2% 424 oX[0] = MULT_NORM (iX[4] * T[3] + iX[6] * T[2]); ! LD/ST multiple
4.0% 425 oX[1] = MULT_NORM (iX[4] * T[2] - iX[6] * T[3]); ! LD/ST multiple
3.7% 426 oX[2] = MULT_NORM (iX[0] * T[1] + iX[2] * T[0]); ! LD/ST multiple
3.2% 427 oX[3] = MULT_NORM (iX[0] * T[0] - iX[2] * T[1]); ! LD/ST multiple
0.8% 428 iX -= 8;
0.3% 429 oX += 4;
0.4% 430 }while(iX>=in);
431
432 mdct_butterflies(init,out+n2,n2);
0.0% 433 mdct_bitreverse(init,out);
- Code:
748 /* large/large */
0.2% 749 float *w=_vorbis_window_get(b->window[1]-hs);
0.1% 750 float *pcm=v->pcm[j]+prevCenter;
0.1% 751 float *p=vb->pcm[j];
5.5% 752 for(i=0;i<n1;i++)
60.5% 753 pcm[i]=pcm[i]*w[n1-i-1] + p[i]*w[i]; ! LD/ST multiple
754 }else{
755 /* large/small */
756 float *w=_vorbis_window_get(b->window[0]-hs);
757 float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
758 float *p=vb->pcm[j];
0.0% 759 for(i=0;i<n0;i++)
0.4% 760 pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i]; ! LD/ST multiple
761 }
762 }else{
763 if(v->W){
764 /* small/large */
765 float *w=_vorbis_window_get(b->window[0]-hs);
766 float *pcm=v->pcm[j]+prevCenter;
767 float *p=vb->pcm[j]+n1/2-n0/2;
768 for(i=0;i<n0;i++)
0.6% 769 pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i]; ! LD/ST multiple
0.6% 770 for(;i<n1/2+n0/2;i++)
0.6% 771 pcm[i]=p[i];
772 }else{
773 /* small/small */
0.0% 774 float *w=_vorbis_window_get(b->window[0]-hs);
775 float *pcm=v->pcm[j]+prevCenter;
776 float *p=vb->pcm[j];
0.3% 777 for(i=0;i<n0;i++)
3.7% 778 pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i]; ! Unaligned loop start, LD/ST multiple
- Code:
471 long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
0.4% 472 oggpack_buffer *b,int n){
473
474 long i,j,entry;
0.1% 475 int chptr=0;
0.7% 476 if(book->used_entries>0){
9.2% 477 for(i=offset/ch;i<(offset+n)/ch;){
2.4% 478 entry = decode_packed_entry_number(book,b);
1.6% 479 if(entry==-1)return(-1);
480 {
6.5% 481 const float *t = book->valuelist+entry*book->dim;
15.3% 482 for (j=0;j<book->dim;j++){
56.1% 483 a[chptr++][i]+=t[j]; ! LD/ST multiple
3.9% 484 if(chptr==ch){
1.1% 485 chptr=0;
2.2% 486 i++;
487 }
488 }
489 }
490 }
491 }
Hope that's it.
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: rendering multiple resources
Well seems to be that this is where the bottleneck come from Try to change the # of soundbuffer and the size of the buffer as well... put the decompression in another thread maybe?
Check what is best for your project...
Check what is best for your project...
Similar topics
» Using Multiple Resources and sio2 files
» Custom resources
» Resources - Assets and Instances
» Need help with multiple textures
» Multiple Blender exports in a single project.
» Custom resources
» Resources - Assets and Instances
» Need help with multiple textures
» Multiple Blender exports in a single project.
Permissions in this forum:
You cannot reply to topics in this forum