Reprinted please indicate the source for the klayge game engine, this article address for http://www.klayge.org/2011/08/09/%e5%85%b3%e4%ba%8ed3d11%ef%bc%8c%e4%bd%a0%e5%bf%85%e9%a1%bb%e4%ba%86%e8%a7%a3%e7%9a%84%e5%87%a0%e4%bb%b6%e4%ba%8b%e6%83%85%ef%bc%88%e4%b8%80%ef%bc%89/
Only experts who think they know about d3d11 can use this document.
D3d11 has been officially released for more than two years. In this short period of time, various GPU manufacturers have successively launched d3d11 video cards, and many game engines have also quickly launched d3d11 support. However, in China, the acceptance of d3d11 is almost zero. The technical staff of many "big" game companies in China "are completely confused about d3d11, but they are not very knowledgeable about it.
You must understand some things about d3d11.
Feature Level
Since klayge 3.11.0 was released, almost every month someone asked me, "Why do we need to remove the d3d9 and d3d10 plug-ins and only retain d3d11 and OpenGL ?". (This frequency has improved significantly recently, basically one to two times a week ). In their opinion, d3d11 has to run on the hardware of d3d11, but the hardware of d3d11 has not yet been popularized. This will affect the running of klayge on the hardware of d3d10. My answers to these questions are usually very cold. "Why did you add comments if you don't know d3d11 ".
One of the most basic knowledge of d3d11 is the feature level. In fact, this is not a new invention. It was proposed at the time of d3d 10.1, but because the usage of d3d 10.1 is too small, it is ignored directly. Feature Level divides d3d11 functions. The minimum hardware requirements for different functions are different. The feature level enables d3d11 runtime to be executed on d3d10 or d3d9 hardware. Below we can see from the low to the high what each feature level can do.
Feature Level |
Typical graphics card |
Capability |
D3d_feature_9_1 |
Intel g965, NV geforcefx 5200, ATI radeon 9600 |
D3d9 hardware: must support SM2, 2 k texture, 3D texture, query, BC1-3 |
D3d_feature_9_2 |
NV geforcefx 5600, ATI radeon 9500 |
D3d9 hardware: must support SM2, occlusion query, floating point texture, all 9_1 Functions |
D3d_feature_9_3 |
NV geforcefx 6600, ATI radeon x1300 |
D3d9 hardware: sm2b, instancing, 4 K texture, MRT, floating point texture mixing, all 9_2 features must be supported |
D3d_feature_10_0 |
NV geforce 8800/GTX 280 |
D3d10 hardware: must support sm4, geometry shader, stream output, Alpha to coverage, msaa texture, double-sided stencer, texuture array, bc4/5, all 9_3 features; optional support compute shader 4.0 |
D3d_feature_10_1 |
ATI radeon HD 2/3/4, NV geforce gt220 |
D3d10.1 hardware: must support sm4.1, cubemap array, extended msaa, all 10_0 functions; optional support for compute shader 4.1 |
D3d_feature_11_0 |
ATI radeon HD 5/6, NV geforce GTX 4/5 |
D3d11 hardware: must support sm5, tessellation, hull shader, domain shader, compute shader 5, bc6h/bc7, all 10_1 Functions |
Therefore, d3d11 does not necessarily require d3d11 GPUs. On the d3d10 GPU, The d3d11 function is equivalent to the original d3d10, with compute shader 4.0 added, and the possibility of multi-threading. The performance depends on the vendor driver. Currently, the performance can be exactly the same as that of d3d10. The d3d9 GPU can also be used as an analogy. The only difference is that vertex texture fetch, even level 9_3 only has instancing and no VTF. In fact, on the Sm3 GPU, The VTF performance and supported texture formats of NV 6 series and 7 series are particularly poor, making VTF very practical. ATI has always abandoned VTF and developed its own r2vb method, which far outperforms VTF in performance. In the later stages of the driver, the Sm3 GPU of NV also supports r2vb, so r2vb has become a common function. In addition, the early implementation of d3d11 on hardware will only bring about benefits without loss.
With feature level, d3d10 is completely unnecessary. Therefore, the first-class game engines such as klayge, E3, and ue3 all skip or delete the d3d10 support and go straight to d3d11.
Let's talk about d3d9. The only reason d3d9 currently exists is for a large number of XP users. But in fact many people have d3d10 GPUs, and XP is restricted to d3d9. In fact, the OpenGL driver under XP is also keeping pace with the times, which can bring XP new GPU capabilities originally belonging to d3d10/11 without performance loss. Therefore, klayge resolutely removes d3d9 and enables OpenGL to take over the tasks of d3d9 on XP.
Optional features
When d3d10 was being promoted in the past, there was no caps. In the d3d9 era, caps almost tortured everyProgramMember. Before you implement a function, you often need to choose a different method based on caps. D3d10 removes all caps and requires that the hardware comply with certain specifications, freeing caps testing.
In fact, d3d10 still has a hand. Both id3d10device and id3d11device have a number of functions called checkformatsupport. You can check whether a format is supported, but the optional range is very narrow. (Theoretically, drivers can also expose the odd formats that d3d1x does not support, just as they do in the d3d9 era)
People who have used d3d10 usually find that d3d10 does not support the most commonly used color format on d3d9 such as argb, and then get mad. In fact, according to the definition, the format should be like this in d3d11: Feature Level 9_x and 11_0 must be supported, and feature level 10_x is optional. So the solution is simple. Upgrade to d3d11.
In addition, Feature Level 11_0 must also support r10g10b10_xr_bias_x2_a2_unorm (I do not know what the format is), while Feature Level 10_x is optional and 9_x is not. In d3d11, the supported formats generally depend on the feature level. Therefore, you can directly use the feature level check. You do not need to check each format one by one.
In addition to checkformatsupport, The checkfeaturesupport function is added to d3d11 to check whether multithread, double, atomic, and compute shader 4. x are supported. Therefore, caps do not completely disappear, but are minimized. However, the rest is meaningful and cannot be ignored.
So far, the next article will talk about other important features of d3d11.