I am trying to deal with the case when the D3D device is lost (due to window minimization in a fullscreen application)..
Everything seem to be working fine, except for the DrawPrimitive function, which keeps failing after the device is successfully reset!
Here is what my rendering function look like:
1. Call the TestCooperativeLevel function and only proceed to rendering if the function returned D3D_OK.
2. If the function returned D3DERR_DEVICELOST, return without doing anything.
3. If it returned D3DERR_DEVICENOTRESET, ReleaseResources(), reset the device (passing the same presentation parameters used when creating the device) and then RecreateResources().
4. If it returned D3D_OK, continue rendering.
Where in ReleaseResources(), I release an array of dynamic vertex buffers which I use to render all the geometry in my application, as well as releasing all the textures used in the application (I don't create any other resources), and in RecreateResources(), I recreate the textures again. (Vertex buffers are created and released as needed each rendering frame so they don't need recreation)
After debugging, I found that the device reset function succeeds, as well as the device functions: Clear(), BeginScene(), SetStreamSource(), EndScene(), Present(), and when writing vertex data to vertex buffers, the functions Lock() and Unlock() also succeed.
The only function that fails is DrawPrimitive().
Since the device was reset, I know it is not a problem of releasing resources..
So what could the problem be?
Thanks for any help, and let me know if you need any further details..
m_a_s_gpMember Since 05 Oct 2010
Offline Last Active Jul 25 2013 08:10 AM
- Group Members
- Active Posts 9
- Profile Views 494
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
m_a_s_gp hasn't added any contacts yet.