Jump to content
  • Advertisement
Sign in to follow this  
Tispe

Single responsibility principle and dependencies

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

Hi

Following the "Single responsibility principle" I have determined that my game should have its own class for loading and setting up Meshes, and another render class that recieves an array of Meshes to draw. Perhpaps on two different threads.

But the D3DXCreateMesh function is dependent on the LPDIRECT3DDEVICE9 pD3DDevice parameter! How can I have a main rendering thread while a worker thread in the background constantly goes about using the LPDIRECT3DDEVICE9 pD3DDevice?

Do I have to roll my own Mesh class? Can I just ignore it as D3DXCreateMesh does not use this parameter?

Share this post


Link to post
Share on other sites
Advertisement
Even if you roll your own mesh class you'll still the device to create vertex buffers, so you'll have the same problem. In general D3D9 just doesn't have any real multithreading capability, it wasn't until D3D11 that we got the ability create resources and submit commands on multiple threads. Probably the best you can do is handle any I/O and decompression on a worker thread, and then let the main thread use the device to actually create the D3D resources.

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!