Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Single responsibility principle and dependencies

4: Adsense

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   

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

#2 MJP   Moderators   

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