Changing Presentation params in realtime

Started by
2 comments, last by sirob 15 years, 6 months ago
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?
------------Anything prior to 9am should be illegal.
Advertisement
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.
Sirob Yes.» - status: Work-O-Rama.
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?
------------Anything prior to 9am should be illegal.
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.
Sirob Yes.» - status: Work-O-Rama.

This topic is closed to new replies.

Advertisement