Sign in to follow this  
Tispe

Single responsibility principle and dependencies

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this