Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Single responsibility principle and dependencies


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Tispe   Members   -  Reputation: 1039

Like
0Likes
Like

Posted 13 September 2012 - 12:56 AM

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?

Sponsor:

#2 MJP   Moderators   -  Reputation: 11585

Like
1Likes
Like

Posted 13 September 2012 - 01:07 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS