Sign in to follow this  
RealMarkP

Changing Presentation params in realtime

Recommended Posts

RealMarkP    216
If I want to change a setting in the D3DPRESENT_PARAMETERS structure (ie. Turning on VSync), which function should I pass it into so it would take effect immediately? Would I have to reset the device or recreate it entirely?

Share this post


Link to post
Share on other sites
sirob    1181
A reset should be enough. Keep in mind that resetting a device is more involved than just calling Reset(), you need to first release all DEFAULT_POOL resources, and call OnDeviceLost for any D3DX interface that has the method. After the reset, you need to create the resources you released and call OnDeviceReset for the D3DX interfaces you called OnDeviceLost on.

Share this post


Link to post
Share on other sites
RealMarkP    216
Cool, thanks.

Does this mean that any of the parameters can be changed without requiring the device to be recreated? Also, since you mentioned resources, does DirectX require me to release all resources before I release either the device (IDirectX9Device) or the driver (IDirectX) interfaces or can it be done at any time?

Share this post


Link to post
Share on other sites
sirob    1181
Quote:
Original post by RealMarkP
Does this mean that any of the parameters can be changed without requiring the device to be recreated? Also, since you mentioned resources, does DirectX require me to release all resources before I release either the device (IDirectX9Device) or the driver (IDirectX) interfaces or can it be done at any time?

DX uses COM reference counting throughout the interface. This means that any object that needs access to the Device (for example) will hold a reference to it. When you call Release(), you're only releasing the reference you were holding.
What this means is that objects are only really destroyed when the last reference to them is released.
To answer your question, you can release object in any order you'd like, so long as you release every reference you had before the application ends. If you don't, the OS will likely clean up after you, but that's just not clean behavior. Also, if you're using the debug runtimes, you'll get warnings for each unreleased interface at application end.

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