Advertisement Jump to content
Sign in to follow this  
Reitano

Initialization of static buffers in DirectX 11

This topic is 1884 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 am adding support for DirectX 11 to my engine and I have a question about the initialization of static vertex and index buffers. The approach I am using now, common to DirectX 9 engines, is that of creating a buffer, mapping it and then filling it with data. DirectX 11 apparently requires a different approach: according to the documentation, one should create a static buffer passing initialization data at the moment of creation. For me this approach would require a good amount of refactoring. So my question is: is it still allowed to defer a static buffer initialization by mapping the buffer after its creation ? If so, are there any restrictions or performance related implications ?

 

Cheers,

 

Stefano

Share this post


Link to post
Share on other sites
Advertisement

If refactoring is really not an option you can create your buffers with D3D11_USAGE_DEFAULT instead of D3D11_USAGE_IMMUTABLE and use ID3D11DeviceContext::UpdateSubresource to fill them.

Share this post


Link to post
Share on other sites

Thank you for the advice. I will use default buffers in legacy code and gradually update it to use immutable buffers. Next step is porting effects and shaders, and that's going to cause pain!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!