Slowdown on node creation

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!

Slowdown on node creation

Postby JP » Thu Jan 06, 2011 7:43 pm

Hello!

So in my project I'm working on I've seen some short hangs when I create an object for the first time...

I preload the textures assigned to the nodes by doing the following:

driver->getTexture( <path> );

But is that not enough? Does that just load the textures into RAM and not actually send them to the GFX card and that's what's causing the hang? When I create subsequent objects there's no hang at all so i'm assuming it's something along these lines....

I've seen this issue with cube scene nodes with a billboard scene node attached (both textured) and with a particle system.

Any suggestions would be great!
Image Image Image
User avatar
JP
 
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK

Postby hybrid » Thu Jan 06, 2011 9:52 pm

getTexture loads the data to the GPU for sure. Sounds as if some larger memory allocation happens somewhere. Huge particle systems can be a problem. Or any other huge array.
hybrid
Admin
 
Posts: 13943
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Postby JP » Fri Jan 07, 2011 9:08 am

Hmm.. it's all fairly simple stuff... I'll try and see if there's anything obvious that I might be doing at the same time... If not then I could try and make a minimal example for analysis :)
Image Image Image
User avatar
JP
 
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK

Postby bitplane » Fri Jan 07, 2011 11:23 am

Rather than going to all the trouble of profiling it, just hit the pause button in your debugger while it's hanging. Repeat a couple of times to be sure, 9 times out of 10 you'll stop inside the offending code!
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
User avatar
bitplane
Admin
 
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England

Postby JP » Sat Jan 08, 2011 10:43 pm

Good tip bitplane, might help out!
Image Image Image
User avatar
JP
 
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK

Re: Slowdown on node creation

Postby JP » Thu Jul 26, 2012 7:23 pm

Aaaaad 18 months later...

Can't remember what project I posted this thread about but I've come across the same issue again.

I've got a 4096x4096 texture and during, what is presumably the first call to, driver->draw2DImage it hangs for a loooong time (3-4 seconds I think).

Any more ideas why this might be? I'm running irr 1.7.1.

I'll try hooking up a debug build of irrlicht to see where in draw2DImage it's hanging.
Image Image Image
User avatar
JP
 
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK

Re: Slowdown on node creation

Postby fmx » Sun Jul 29, 2012 8:38 am

So you're finally back on the forums, cool 8)

That problem sounds like your hardware is struggling to load the massive 4096 texturemap.
If it loads faster with a smaller texture (eg, 512 or 1024) then you probably need to consider changing the system in your app to use multiple smaller textures instead of a single uber large one
User avatar
fmx
 
Posts: 559
Joined: Wed Dec 06, 2006 9:28 am
Location: UK

Re: Slowdown on node creation

Postby hendu » Sun Jul 29, 2012 11:34 am

Well, profile it, and show us which line takes that long.
hendu
 
Posts: 1552
Joined: Sat Dec 18, 2010 12:53 pm

Re: Slowdown on node creation

Postby JP » Mon Jul 30, 2012 3:22 pm

Smaller textures had a much smaller hang. 1024 textures had no perceivable hang. Using multiple smaller textures might be a possible solution i suppose...

I didn't get anywhere with the debug build of irrlicht as i couldn't get my game to load the irrlicht debug symbols, have had it working before though i'm sure...

In the end I went looking around and found it's a problem others have had with OpenGl and have solved it by hiding the stall behind a loading screen by doing the first render underneath it. That worked for me but the multiple smaller textures may be a more suitable fix I'm thinking...
Image Image Image
User avatar
JP
 
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK

Re: Slowdown on node creation

Postby hendu » Mon Jul 30, 2012 4:54 pm

Oh, you have a driver that's trying to be clever? Nvidia I guess ;)

Yes, some drivers delay loading until absolutely necessary, ie the first render using that.

solved it by hiding the stall behind a loading screen by doing the first render underneath it. That worked for me but the multiple smaller textures may be a more suitable fix I'm thinking...


Nvidia themselves recommend that solution. So better use it rather than use worse textures ;)
hendu
 
Posts: 1552
Joined: Sat Dec 18, 2010 12:53 pm

Re: Slowdown on node creation

Postby JP » Tue Jul 31, 2012 7:47 pm

My thought was not to use a single smaller texture but multiple smaller textures so instead of a single 4096 texture I'd use 4 1024 textures or something, the 4096 texture is for a 2D character sprite sheet so only part of the texture is used each frame. For that reason splitting the texture into smaller chunks would be ok.

Having said that it would be more effort to do that...

Good to hear that only certain drivers do it... it's happening on my laptop but that's not the target hardware so it might be ok there..
Image Image Image
User avatar
JP
 
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK

Re: Slowdown on node creation

Postby Nadro » Thu Aug 02, 2012 1:01 pm

You can also use a compressed textures :) REDDemon did a nice implementation for KTX.
NBK Game Studio - Official Site:
http://www.nbkgamestudio.pl/
Nadro
 
Posts: 994
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Slowdown on node creation

Postby JP » Tue Aug 07, 2012 8:01 am

Yeah I should look into those, I assume they remain compressed in memory?
Image Image Image
User avatar
JP
 
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK

Re: Slowdown on node creation

Postby Nadro » Wed Aug 08, 2012 1:31 pm

Yes, they remain compressed in memory.
NBK Game Studio - Official Site:
http://www.nbkgamestudio.pl/
Nadro
 
Posts: 994
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland


Return to Advanced Help

Who is online

Users browsing this forum: No registered users and 1 guest