为了修改应用程序中的编译错误,添加程序清单3.2中的代码。
程序清单3.2 实现接口
///
/// called during device initialization, this code checks the device for a
/// minimum set of capabilities and rejects those that don’t pass by
/// returning false.
///
public bool isdeviceacceptable(caps caps, format adapterformat,
format backbufferformat, bool windowed)
{
// skip back buffer formats that don’t support alpha blending
if (!manager.checkdeviceformat(caps.adapterordinal, caps.devicetype,
adapterformat, usage.querypostpixelshaderblending,
resourcetype.textures, backbufferformat))
return false;
// skip any device that doesn’t support at least a single light
if (caps.maxactivelights == 0)
return false;
return true;
}
///
/// this callback function is called immediately before a device is created

