Jump to content
  • Advertisement
Sign in to follow this  
Hyunkel

DX11 [SlimDX / DX11] Asynchronous resource loading

This topic is 2442 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

I've seen it mentioned in quite a few articles that DX11 supports asynchronous resource loading natively.
My question is, how do I actually do this / what's the correct way of doing it?

I generate certain meshes on the fly, and I want to upload the vertex/index buffers and maybe even a few textures without stalling the main (render) thread.

Cheers,
Hyu

Share this post


Link to post
Share on other sites
Advertisement

Just create your resources on a seperate thread, the ID3D11Device methods are thread safe. Make sure you create them as IMMUTABLE and pass in the initial data when you create them.

DICE has a little bit about their implementation in this presentation: http://www.slideshare.net/DICEStudio/directx-11-rendering-in-battlefield-3?from=ss_embed (p.35)


Can you give some more explanations? What is allowed / not allowed?
i have some problems with asynchronous resource loading.. application quits.. sometimes during the loading.. i cant really reproduce this error..
http://www.gamedev.net/topic/609954-slimdx-async-loading-problems/page__p__4857420#entry4857420

in the loading thread i create create:
textures
shader resource views / render target views
buffers (vertex, index, contants)
sampler states
effects (compile from file or load fxo)

what means immutable in this content?
no changes on the data after: [color=blue]new [color=#2b91af]Buffer(device,.... ?

thank you!.. hope to find this nasty bug soon :(

Share this post


Link to post
Share on other sites
"Immutable" means that the resource is created with D3D11_USAGE_IMMUTABLE, which means that neither the GPU or CPU can change the resource contents once it is created. I agree with Mike in the other thread that your crash does sound like a driver bug...unfortunately drivers tend to have quite a few of them and they will often crash your app in bizarre ways. Creating textures, SRV's, samplers, and shaders on your loading thread shouldn't cause any problem. The one unknown to me is creating Effects...I don't know what the effects framework does behind the scenes when you create a new effect. So I would probably start trying to narrow down the problem by not loading the effects, or moving the effect loading to another thread.

Share this post


Link to post
Share on other sites
Found the problem :)
.. stupid mistake.. i found an ImmediateContext-Call in the loading code.. in my case this was update of an constant buffer (map/unmap)...
don't update constant buffers in property setters to sync your data.. ;)

buy the way.. what helped me to find out was the DirectX Control Panel, were you can add you application to scope and force debug layer to get real exceptions instead of crashes without infos...

thanks for all who tried to help me!!!

Share this post


Link to post
Share on other sites
You can also enable the debug layer when creating the device, by passing D3D11_CREATE_DEVICE_DEBUG.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!