The Direct3D 11 Runtime is composed of layers.
A basic principle is to add features to the layer without affecting existing behaviors. For example, the core functions have the same return values in the independent debugging layer, and even additional debugging information.
CallableD3D11CreateDeviceOrD3D11CreateDeviceAndSwapChainAnd provides one or moreD3D11_CREATE_DEVICE_FLAGThe value is used to create a layer when a device is created.
Direct3D 11 provides the following runtime layers:
# Core Layer)
# Debug Layer)
Core Layer
The core layer exists by default. A thin ing layer is provided between the api and device to minimize the performance impact caused by high-frequency function calls. The core layer is efficiency. It only performs necessary checks. The remaining layers are optional.
Debug Layer
This layer provides a large number of additional parameters and Consistency Verification (such as verifying the connection and resource binding of the shader, parameter consistency, and submission error description ).
To create a device that supports the debugging layer, you must install the DirectX SDK (to obtain D3D11SDKLayers. dll) and then callD3D11CreateDeviceOrD3D11CreateDeviceAndSwapChainSpecifiedD3D11_CREATE_DEVICE_DEBUGMark.
It should be noted that the program runs slowly after the activation of the adjustment layer. You can useDirectX Control PanelTo enable or disable the debugging layer. When the mode layer lists memory leaks, a list of interface pointers associated with friendly names is output. The default friendly name is "<unnamed> ". You can useID3D11DeviceChild: SetPrivateDataAnd WKPDID_D3DDebugObjectName GUID in D3Dcommon. h to set friendly names. For example, use the following code to name a pTexture pointer in mytexture.jpg:
const char c_szName[] = "mytexture.jpg";pTexture->SetPrivateData( WKPDID_D3DDebugObjectName, sizeof( c_szName ) - 1, c_szName );