What’s a feature level?
If you’re a game developer who has spent any amount of time with computer hardware, or perhaps a computer game which simulates working with it, you will know that graphics cards are not all the same. There’s differentiation.
Differentiation not only of overall performance characteristics, but the kinds of available functionality. Of course, Direct3D 12 provides a set of functionalities that are guaranteed for any graphics card with a Direct3D 12 driver on Windows. That kind of standardization is hugely valuable and has made life easier for everyone who writes graphical applications on Windows. At the same time, Direct3D 12 provides ways for the differentiation between graphics cards to be manageable by applications, especially as technology improves and evolves forward– applications can take advantage of the cool new hardware features as they become available.
In Direct3D, a “feature level” is the name we use to describe a bunch of graphics card capabilities. “Feature level” is a property of your graphics card. You might visit a computer hardware store or friend you borrow all your hardware from, and find two graphics cards both compatible with your Windows 10 desktop machine. But they could have different feature levels. Or, you might have a multi-GPU system where the two GPUs are different. They might also have different feature levels between them. Games and applications are expected to be programmed to detect which feature levels are available on the system and use a set of features accordingly.
Feature levels allow streamlining of application code while encouraging adoption of new hardware capabilities. They’re a convenient way for applications to make sense of generational improvements to GPUs which occur over time. A coarse grouping of GPU capabilities is something that applications can easily base their rendering paradigms on, rather than lots of permutations of individual capabilities.
Successive feature levels are supersets of functionality. For example, feature level 12_1 includes all the capabilities of feature level 12_0 plus some more things. And, of course, feature level 12_2 includes all the capabilities of the ones before it, plus some new things. Now it’s worth mentioning that the jump from 12_1 to 12_2 is huge, if we’re being honest.
Why do we need a new one?
There are some big-ticket graphics features worth exposing in Direct3D 12, and important enough to be represented in a feature level. There’s a desire to streamline applications who wish to use them, and to make it easier to reason about support for those features on everyone’s gaming environments. Those big-ticket items are
- DirectX raytracing
- Mesh shaders
- Variable rate shading
- Sampler feedback
In addition, feature level 12_2 includes a grab-bag of other capabilities, listed out below. As time moves on and newer-feature-level graphics cards become more widely available, application developers’ lives are made easier since a cumbersome capability check can be removed in favor of simple reliance on presence of the new feature level.
Querying and API
If you’re an application, you request feature level 12_2 in the same manner you request other feature levels. You do it when creating a Direct3D 12 device.
ComPtr<ID3D12Device> device; D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_12_2; HRESULT hr = D3D12CreateDevice(nullptr, featureLevel, IID_PPV_ARGS(&m_spDevice)); if (SUCCEEDED(hr)) { // feature level is supported by default adapter }
You can also query a device for 12_2 using CheckFeatureSupport, even if you created the device against a lower feature level. For example:
D3D12_FEATURE_DATA_FEATURE_LEVELS cap{}; cap.NumFeatureLevels = 1; D3D_FEATURE_LEVEL requested = D3D_FEATURE_LEVEL_12_2; cap.pFeatureLevelsRequested = &requested; if (SUCCEEDED(device->CheckFeatureSupport( D3D12_FEATURE_FEATURE_LEVELS, &cap, sizeof(cap))) && cap.MaxSupportedFeatureLevel == requested) { // feature level is supported on the device }
You see, the enumeration value for 12_2 is expressed as follows:
typedef enum D3D_FEATURE_LEVEL { // ... D3D_FEATURE_LEVEL_12_2 = 0xc200 } D3D_FEATURE_LEVEL;
Easy enough.
Capabilities
All the things which comprise feature level 12_2 also exist in terms of capabilities and feature tiers queryable through CheckFeatureSupport. No hidden capabilities or anything like that.
If a device is feature level 12_2, it has:
Feature | 12_2 minimum | Public spec |
Required driver model | WDDM 2.0 | |
Shader Model | 6.5 | Link |
Raytracing tier | Tier 1.1 | Link |
Variable shading rate | Tier 2 | Link |
Mesh shader tier | Tier 1 | Link |
Sampler feedback | Tier 0.9 | Link |
Resource Binding Tier | Tier 3 | Link |
Tiled Resources | Tier 3 | |
Conservative Rasterization | Tier 3 | Link |
Root Signature Tier | 1.1 | Link |
DepthBoundsTestSupported | TRUE | Link |
WriteBufferImmediateSupportFlags | Direct, Compute, Bundle | |
MaxGPUVirtualAddressBitsPerResource | 40 | |
MaxGPUVirtualAddressBitsPerProcess | 40 |
Additionally, it has the following flags set
Feature | 12_2 value |
WaveOps | TRUE |
OutputMergerLogicOp | TRUE |
VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportWithoutGSEmulation | TRUE |
CopyQueueTimestampQueriesSupported | TRUE |
CastingFullyTypedFormatSupported | TRUE |
Int64ShaderOps | TRUE |
Frequently asked questions (F.A.Q.’s)
Q: If my graphics card and driver report all the capabilities outlined above, does that automatically mean my graphics card is feature level 12_2?
A: Short answer: Not necessarily, you may need to get or wait for a driver update. Longer answer: When the driver talks to the Direct3D 12 runtime, it tells the runtime what feature level it is. A driver needs to explicitly report support for feature level 12_2, the runtime isn’t going to automatically infer it. A graphics hardware manufacturer may ship an updated driver which reports it. Definitely contact the manufacturer of your graphics card if you have questions about this.
Q: What Direct3D API do I use feature level 12_2 with?
A: Just Direct3D 12. Now, I know what you might be thinking. “But with some past feature levels, I could use Direct3D 11 or Direct3D 12! Why not 12_2?” This really speaks to the length of time that has passed since the last feature level, and how big a deal the things in feature level 12_2 are.
The capabilities in 12_2, in particular the big-ticket ones simply aren’t surfaced through Direct3D 11 API. You’re not going to get, say, DirectX Raytracing, through the Direct3D 11 programming model. So it hardly makes sense to request a feature level with capabilities inaccessible to your programming model. Feature level 12_1, on the other hand, went out with the initial release of Windows 10. It included things that were digestible and made sense to expose through both Direct3D 11 and Direct3D 12 programming models. Take tiled resources, for example. That’s a capability guaranteed through feature level 12_0. You have tiled resources in 11, and you have them in 12 (called “reserved resources”). Similar thing for conservative rasterization, something scoped enough to work with both programming models, which was included in 12_1. On the other hand the capabilities which comprise feature level 12_2 are huge and comprise a big API surface. A tight integration with the Direct3D 12 programming model allows them to work really well.
One detail: when you create a Direct3D 11 device, you pass an array of ordered feature levels. The first feature level that succeeds the platform-availability-check is the one you get. If that list includes feature level 12_2, it’ll ignore that and move onto the next one. It won’t fail the whole call.
Q: Which hardware platforms will support feature level 12_2?
A: We’re absolutely pleased to inform that:
- Feature level 12_2 is supported on NVIDIA GeForce RTX and NVIDIA Quadro RTX GPUs.
- AMD’s upcoming RDNA 2 architecture based GPUs will include full feature level 12_2 support.
- Intel’s roadmap includes discrete GPUs that will empower developers to take full advantage of Feature Level 12_2.
- Microsoft is collaborating with Qualcomm to bring the benefits of DirectX feature level 12_2 to Snapdragon platforms.
The powerful new capabilities in feature level 12_2 represent exciting new possibilities for game and application developers.
Q: When can I program against feature level 12_2 capabilities, and see the new feature level in an SDK?
A: Good news, capabilities which comprise feature level 12_2 can already be individually queried using CheckFeatureSupport on Windows May 2020 Update and its compatible SDK. If you have compatible hardware then you’ll see the capabilities on and you’re ready to go.
As for D3D_FEATURE_LEVEL_12_2 itself, the feature level is available through Windows Insider program, SDK and build version 20170 and later. You’ll need both the preview Windows operating system and SDK to get started. And for more low-level details, check out the Feature Level 12_2 spec in the DirectX-Specs repo on Github. Let us know what you think! Feel free to get in touch with us on our Discord server at discord.gg/directx.
The post New in DirectX— Feature Level 12_2 appeared first on DirectX Developer Blog.