Sign in to follow this  

help with LPDIRECT3DDEVICE9

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

Quote:
Original post by Talib
Why? What do you intend to do? Please explain a bit more.


I dunno if it's the best method to do it, but this is my problem:

I want to load textures in realtime, so i used the thread technique.
so when the user presses a button i start the loading texture thread with :
AfxBeginThread(....);
after trying this method i figured out a problem of syncronisation due to the use of :
LPDIRECT3DDEVICE9 m_pd3dDevice
so i thought i would just copy my m_pd3dDevice to another one then when the thread has finished loading the texture i copy the new one to the old one.

I think it's not the best method of doing it, but i coulden't find any help on the net.

could you help?

Share this post


Link to post
Share on other sites
Still not quite sure of what you mean by copying a m_pD3DDevice to another one and then copy the new one to the old one.

A LPDIRECT3DDEVICE9 is an interface to a specific rendering device. Certain methods of both IDIRECT3D9 and IDIRECT3DDEVICE9 must be handled by the same thread that handles the Windows message pump (including creating devices). Creating more than one interface to a device wouldn't solve this issue.

Creating a multi-threaded application isn't an easy journey, especially when you add APIs like D3D and OGL.

When you create a IDIRECT3DDEVICE9 through CreateDevice, are you specifying the D3DCREATE_MULTITHREADED flag as well? It states that D3D9 should be required to be multi-threaded safe, which means it takes control of its global critical section more frequently and can degrade performance. (from the D3D9 sdk)

Share this post


Link to post
Share on other sites
Quote:
Original post by sordid
Still not quite sure of what you mean by copying a m_pD3DDevice to another one and then copy the new one to the old one.

A LPDIRECT3DDEVICE9 is an interface to a specific rendering device. Certain methods of both IDIRECT3D9 and IDIRECT3DDEVICE9 must be handled by the same thread that handles the Windows message pump (including creating devices). Creating more than one interface to a device wouldn't solve this issue.

Creating a multi-threaded application isn't an easy journey, especially when you add APIs like D3D and OGL.

When you create a IDIRECT3DDEVICE9 through CreateDevice, are you specifying the D3DCREATE_MULTITHREADED flag as well? It states that D3D9 should be required to be multi-threaded safe, which means it takes control of its global critical section more frequently and can degrade performance. (from the D3D9 sdk)


you are da man !! it's working properly now . thumbs up m8.

Share this post


Link to post
Share on other sites

This topic is 4554 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.

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