/// to allow the application to modify the device settings. the supplied
/// settings parameter contains the settings that the framework has
/// selected for the new device, and the application can make any desired
/// changes directly to this structure. note however that the sample
/// framework will not correct invalid device settings so care must
/// be taken to return valid device settings; otherwise, creating the
/// device will fail.
///
public void modifydevicesettings(devicesettings settings, caps caps)
{
// this application is designed to work on a pure device by not using
// any get methods,so create a pure device if supported and using hwvp.
if ( (caps.devicecaps.supportspuredevice) &&
((settings.behaviorflags & createflags.hardwarevertex
processing) != 0 ) )
settings.behaviorflags |= createflags.puredevice;
}
查看声明的第一个方法,isdeviceacceptable方法。当样本框架忙于枚举系统中的设备时,它为所发现的每一个组合调用了该方法。注意该方法是如何返回一个布尔值的。通过这个返回值可以向样本框架指出该设备是否满足需求。然而,在您查看第一个方法中的代码之前,注意已经声明的第二个方法,modifydevicesettings。在创建设备之前样本框架会调用该方法,使您能够选择您需要的任何选项。仔细选择这些选项,因为这可能造成设备创建失败。
现在,回到第一个方法。首先查看它的参数。第一个参数的类型是caps,是capabilities的缩写。该结构用于保存关于特定设备的信息,这些信息将帮助您确定该设备是否是您希望使用的设备类型。后面两个参数是该设备的专用格式:一个用于反向缓冲区,另一个用于设备的格式。

