DXUTCreateDeviceFromSettings

Creates a Direct3D device based on a device described by a DXUTDeviceSettings structure.

HRESULT DXUTCreateDeviceFromSettings(DXUTDeviceSettings *pDeviceSettings,BOOLbPreserveInput);

Parameters

  • pDeviceSettings
    [in] Pointer to a DXUTDeviceSettings structure that contains the settings for the new device.
  • bPreserveInput
    [in] Indicates whether the input device settings are to be preserved. If TRUE, the device settings in the pDeviceSettings structure will be used without change; however, it is possible that no valid device will be found, causing this function to return a failure code. If FALSE, a valid device will be created with device settings that are as near as possible to the original device settings in pDeviceSettings. The default value is FALSE.

Return Values

If the function succeeds, the return value is S_OK. If the function fails, the return value can be one of the error codes in DXUTERR.

Remarks

To alter the settings of a current device, the application can call DXUTGetDeviceSettings to get the device settings structure, change it, and then call DXUTCreateDeviceFromSettings. The application can use DXUTFindValidDeviceSettings to ensure that the device settings are valid before calling DXUTCreateDeviceFromSettings.

This function creates a new Direct3D device for the application; alternately, the application can handle device creation and pass the desired device to DXUT by using the DXUTSetDevice function or calling DXUTCreateDevice. If neither DXUTCreateDevice, DXUTCreateDeviceFromSettings, nor DXUTSetDevice has been called before a framework method that relies on a device object, the framework will automatically call DXUTCreateDevice using the default parameter values.

The application can call this method to change the current device that has already been created.

Requirements

Header: Declared in Dxut.h.

See Also

DXUTFindValidDeviceSettings