· Appendix A 2. Direct3D equipment
(Cai Junsheng copyright)
Direct3D devices are very important in the Direct3D application. Because Direct3D devices provide matrix transform, three-dimensional image rendering and 3D image rasterization display. These operations require a large amount of operation, and most of them are concentrated in the graphics card. Direct3D device is an abstraction of hardware graphics, of course it is higher than hardware, because it can not only use hardware functions directly, but also use software to simulate the function of the graphics.
To use Direct3D, you should create a suitable device according to different types. The graphics card is not exclusive in the application, which will cause loss of equipment. Therefore, the application has to handle this situation. After discovering lost, try to recover the device if the device cannot recover, as an error handling.
Before using the device, check if the device supports the function supported by the application. If you don't support it, you will exit the program. If you do not quit, the entire system is likely to be wrong. At the same time detecting the vertex processing of hardware support, whether hardware, or software, or software hardware is mixed, or only one of them. The program is optimized according to different processing. Also use the data of the vertex to be transmitted to the corresponding device, otherwise it will be handled.
There are two categories in Direct3D, one is HAL Device, and a class is a reference device (Reference Device). HAL equipment is mainly used for speed requirements, and in real time processes, because it is accelerated by hardware. The benchmark equipment is implemented in software, all data is handled with CPUs, mainly for testing and research areas, correctness and accuracy are the most important purpose, and do not consider their speed. Therefore, the equipment used in the game should be HAL equipment.