Archived

This topic is now archived and is closed to further replies.

createTexture pausing execution

This topic is 5009 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A few people tried to call CreateTexture using a thread, I think. Has anyone been successful. I have to load textures on the fly, and I get pauses and jitters when I do so. I thought if I call the createTexture method in a thread, it would parallelize it, and maybe take longer, but no longer stall execution. I was not correct, it still does, though much less. Anybody have any examples of how to make such a thing work? Real time loading and unloading of textures? I don''t need them to update instantaneously, I am much more interested in keeping a constant framerate.

Share this post


Link to post
Share on other sites
what''s preventing you from pre-loading textures when the level loads or implementing some form of regional compartment system in which all the textures are pre-loaded for areas that the player is about to enter? that''s the only real way to ensure a constant framerate and not get stalls. loading assets in real-time is very difficult to do without performance hits.

-me

Share this post


Link to post
Share on other sites
Can''t pre-load. I''m streaming new textures from the internet when needed. I know it''s difficult, but I''ve seen it done, and I though threading would work, however it does not seem to. I am not really used to writing threads so I was wondering if anyone had success with this.

Share this post


Link to post
Share on other sites
ofcourse creating texturers in a thread other than the rendering thread will degrade the performance because the two threads are competing to access the device.
you can use multithreading in games only for non symmetric threads (for example thread for the mouse and another one for rendering), but not two threads that are accessing the device.
Loading textures is one of the action that cause the pipeline flush, and stops the parallelism betweent the CPU and the GPU.
OfCouse someGames have a very low loading time (like all games of Crystal Dynamics regardless of the huge worlds in their games) which means that they are making a dynamic loading of textures and geometry,but how is this done I don''t know.
another thing regarding the preformance: the creation of resources should be done in order to maintain the periority of the resources.The most used resources are the most important and should be the first to create,and it is difficult to follow this rule when using dynamic textrure loading (but not impossible).

Share this post


Link to post
Share on other sites
Yes, I searched around, and it looks like I definitley should create the texture first, then fill it as needed. They are all luckily 256x256.

How would I do this, something like?

a) Create an array of textures, by using D3DXCreateTexture?
b) When a new texture is downloaded, use D3DXLoadSurfaceFromFile, to load the texture into the first availiable surface?

It's an interesting challenge, since I've seen this done. I just have to figure out the best way to do it, don't mind hacking around to find the best solution possible.

** One more thing, threads competing for the same device, that makes a lot of sense. I haven't hacked around with D3D long enoug, but is it possible to create two device's and then load textures using one, in one thread, while rendering with the other?

[edited by - ataru on March 25, 2004 10:35:24 AM]

Share this post


Link to post
Share on other sites